17 Oct, 2016

1 commit

  • the mdc value can be quite big (like 65535), so we are in undefined
    territory when doing the multiplication with the (also signed)
    FCX_MAX_DATA_FACTOR as outlined by UBSAN:

    UBSAN: Undefined behaviour in drivers/s390/block/dasd_eckd.c:1678:14
    signed integer overflow:
    65535 * 65536 cannot be represented in type 'int'
    CPU: 5 PID: 183 Comm: kworker/u512:1 Not tainted 4.7.0+ #150
    Workqueue: events_unbound async_run_entry_fn
    000000fb8b59f900 000000fb8b59f990 0000000000000002 0000000000000000
    000000fb8b59fa30 000000fb8b59f9a8 000000fb8b59f9a8 000000000011732e
    00000000000000a4 0000000000a309e2 0000000000a4c072 000000000000000b
    000000fb8b59f9f0 000000fb8b59f990 0000000000000000 0000000000000000
    0400000000d83238 000000000011732e 000000fb8b59f990 000000fb8b59f9f0
    Call Trace:
    ([] show_trace+0x98/0xa8)
    ([] show_stack+0x70/0xf0)
    ([] dump_stack+0x86/0xb8)
    ([] ubsan_epilogue+0x28/0x70)
    ([] handle_overflow+0xde/0xf0)
    ([] dasd_eckd_check_characteristics+0x50a/0x550)
    ([] dasd_generic_set_online+0xba/0x380)
    ([] ccw_device_set_online+0x192/0x550)
    ([] dasd_generic_auto_online+0x2e/0x70)
    ([] async_run_entry_fn+0x70/0x270)
    ([] process_one_work+0x26a/0x638)
    ([] worker_thread+0x4a/0x658)
    ([] kthread+0x10c/0x110)
    ([] kernel_thread_starter+0x6/0xc)
    ([] kernel_thread_starter+0x0/0xc)

    As this is a runtime value there is actually no risk of any sane
    compiler to detect and (ab)use this undefinedness, but let's make
    the multiplication defined by making mdc unsigned.

    Signed-off-by: Christian Borntraeger
    Acked-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Christian Borntraeger
     

26 Sep, 2016

1 commit

  • If the DASD device gets blocked for any reason, e.g. because it is reserved
    somewhere, the host_access_count sysfs entry or the host_access_list
    debugfs entry may sleep forever. Make it interruptible so that userspace
    can use ^C to abort the operation.

    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     

11 Aug, 2016

1 commit

  • On LPAR the read message buffer command should be executed on the path
    it was received on otherwise there is a chance that the CUIR assignment
    might be faulty and the wrong channel path is set online/offline.

    Fix by setting the path mask accordingly.
    On z/VM we might not be able to do I/O on this path but there it does
    not matter on which path the read message buffer command is executed.
    Therefor implement a retry with an open path mask.

    Signed-off-by: Stefan Haberland

    Stefan Haberland
     

13 Jun, 2016

1 commit

  • It is possible to specify a user offset for the TOD clock, e.g. +2 hours.
    The TOD clock will carry this offset even if the clock is synchronized
    with STP. This makes the time stamps acquired with get_sync_clock()
    useless as another LPAR migth use a different TOD offset.

    Use the PTFF instrution to get the TOD epoch difference and subtract
    it from the TOD clock value to get a physical timestamp. As the epoch
    difference contains the sync check delta as well the LPAR offset value
    to the physical clock needs to be refreshed after each clock
    synchronization.

    Signed-off-by: Martin Schwidefsky

    Martin Schwidefsky
     

16 Apr, 2016

2 commits

  • Implement new DASD IOCTL BIODASDCHECKFMT to check a range of tracks on a
    DASD volume for correct formatting. The following characteristics are
    checked:
    - Block size
    - ECKD key length
    - ECKD record ID
    - Number of records per track

    Signed-off-by: Jan Höppner
    Signed-off-by: Martin Schwidefsky

    Jan Höppner
     
  • With this feature, applications can query if a DASD volume is online
    to another operating system instances by checking the online status of
    all attached hosts from the storage server.

    Reviewed-by: Sebastian Ott
    Reviewed-by: Heiko Carstens
    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     

17 Mar, 2016

1 commit

  • Reorder lcu and device lock to get rid of the error-prone trylock
    mechanism.

    The locking order is lcu lock -> device lock.
    This protects against changes to the lcu device lists and enables us
    to iterate over the devices, take the cdev lock and make changes to
    the device structures.

    The complicated part is the summary unit check handler that gets an
    interrupt on one device of the lcu that leads to structural changes of
    the whole lcu itself. This work needs to be done even if devices on
    the lcu disappear. So a device independent worker is used.
    The old approach tried to update some lcu structures and set up the
    lcu worker in the interrupt context with the device lock held.
    But this forced the lock order "cdev lock -> lcu lock" that made it
    hard to have the lcu lock held and iterate over all devices and change
    them.

    The new approach is to schedule a device specific worker that gets
    out of the interrupt context and rid of the device lock for summary
    unit checks. This worker is able to take the lcu lock and schedule the
    lcu worker that updates all devices. The time between interrupt and
    worker execution is no problem because the devices in the lcu reject
    all I/O in this time with an appropriate error. The dasd driver can
    deal with this situation and re-drive the I/O later on.

    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     

07 Mar, 2016

3 commits

  • Convert dasd_device.private to be a void pointer to get
    rid of a lot of explicit casts.

    Signed-off-by: Sebastian Ott
    Reviewed-by: Stefan Haberland
    Acked-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Sebastian Ott
     
  • Prepare for new format checking function by renaming functions and
    moving reusable code to separate functions:

    - Move sanity checks into a new function and make it reusable.
    - Move common format code to a new function called
    dasd_eckd_format_process_data.
    - Create the generic function dasd_eckd_format_build_ccw_req, which
    itself will then decide what ccw request is being built according to
    the input data. (with upcoming functionality).

    Signed-off-by: Jan Höppner
    Signed-off-by: Martin Schwidefsky

    Jan Höppner
     
  • - Make sure a calling function can rely on data in fdata by resetting to
    its initial values
    - Move special treatment for track 0 and 1 to dasd_eckd_build_format
    - Replace dangerous backward goto with a loop logic
    - Add define for number that specifies the maximum amount of CCWs per
    request and is used for format_step calculation
    - Remove unused variable

    Signed-off-by: Jan Höppner
    Signed-off-by: Martin Schwidefsky

    Jan Höppner
     

03 Nov, 2015

3 commits

  • Path verification is either done via dasd_eckd_read_conf() which is
    triggered during online processing and resume or via
    do_path_verification_work() which is triggered after path events.
    The dasd_eckd_read_conf() version added paths unconditionally and did
    not check if the path mask was empty. This led to devices having the
    disconnected stop flag set but a valid path mask. So they where not
    working although they had paths validated successfully. After a resume
    this state could even not be solved with additional paths added.

    Fix by checking for an empty path mask in dasd_eckd_read_conf() and
    clearing the device stop bits for a newly added channel path.

    Reviewed-by: Sebastian Ott
    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     
  • For a valid PAV assignment the DASD driver needs to notice possibly
    changed configuration data. Thus the failing of read configuration
    data should also fail the device restore to prevent invalid PAV
    assignment. The failed device may get restored after additional paths
    get available later on.
    If the restore fails after the device was added to the lcu alias
    handling it needs to be removed from the alias handling before exiting
    the restore function.

    Reviewed-by: Sebastian Ott
    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     
  • The configuration data is stored per path and also the first valid
    configuration data per device. When dasd_eckd_read_conf is called
    again after a path got lost the device configuration data is cleared
    but possibly not the per path configuration data. This might lead to a
    double free when the lost path gets operational again.

    Fix by clearing all per path configuration data when the first valid
    configuration data is received and stored.

    Reviewed-by: Sebastian Ott
    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     

14 Oct, 2015

1 commit

  • We often need to correlate an 8 bit path mask with the position
    in a channel path array. Introduce and use pathmask_to_pos for
    that task.

    Reviewed-by: Peter Oberparleiter
    Signed-off-by: Sebastian Ott
    Signed-off-by: Martin Schwidefsky

    Sebastian Ott
     

19 Aug, 2015

1 commit


10 Aug, 2015

2 commits

  • This patch adds an enhanced detection for control unit initiated
    reconfiguration request scope.
    The first approach assumed the scope of the reconfiguration request
    to be restricted to the path on which the message was received.
    The enhanced approach determines the full scope of the reconfiguration
    request by evaluating additional path and device selection information
    contained in the reconfiguration message.

    Reviewed-by: Peter Oberparleiter
    Reviewed-by: Sebastian Ott
    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     
  • DASD path verification requires the usage of sleep_on_immediatly to
    ensure that no other I/O request is blocking the recovery of
    disconnected devices. But two concurrent path verification workers for
    the same device may kill each others requests due to the usage of the
    immediate sleep_on function. This may lead to unsuccessful path
    verifications.

    Prevent that two parallel path verification workers conflict with
    each other by implementing a device flag signalling a already running
    worker.

    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     

15 Apr, 2015

1 commit

  • Fix ref counting for DASD devices leading to an inability to set a
    DASD device offline.
    Before a worker is scheduled the DASD device driver takes a reference
    to the device. If the worker was already scheduled this reference was
    never freed.
    Fix by giving the reference to the DASD device free when
    schedule_work() returns false.

    Signed-off-by: Stefan Haberland
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     

25 Mar, 2015

1 commit

  • Remove the 31 bit support in order to reduce maintenance cost and
    effectively remove dead code. Since a couple of years there is no
    distribution left that comes with a 31 bit kernel.

    The 31 bit kernel also has been broken since more than a year before
    anybody noticed. In addition I added a removal warning to the kernel
    shown at ipl for 5 minutes: a960062e5826 ("s390: add 31 bit warning
    message") which let everybody know about the plan to remove 31 bit
    code. We didn't get any response.

    Given that the last 31 bit only machine was introduced in 1999 let's
    remove the code.
    Anybody with 31 bit user space code can still use the compat mode.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     

09 Oct, 2014

1 commit


01 Aug, 2014

1 commit


22 Jul, 2014

2 commits


01 Jan, 2014

1 commit

  • Needed to bring blk-mq uptodate, since changes have been going in
    since for-3.14/core was established.

    Fixup merge issues related to the immutable biovec changes.

    Signed-off-by: Jens Axboe

    Conflicts:
    block/blk-flush.c
    fs/btrfs/check-integrity.c
    fs/btrfs/extent_io.c
    fs/btrfs/scrub.c
    fs/logfs/dev_bdev.c

    Jens Axboe
     

24 Nov, 2013

1 commit

  • More prep work for immutable biovecs - with immutable bvecs drivers
    won't be able to use the biovec directly, they'll need to use helpers
    that take into account bio->bi_iter.bi_bvec_done.

    This updates callers for the new usage without changing the
    implementation yet.

    Signed-off-by: Kent Overstreet
    Cc: Jens Axboe
    Cc: Geert Uytterhoeven
    Cc: Benjamin Herrenschmidt
    Cc: Paul Mackerras
    Cc: "Ed L. Cashin"
    Cc: Nick Piggin
    Cc: Lars Ellenberg
    Cc: Jiri Kosina
    Cc: Paul Clements
    Cc: Jim Paris
    Cc: Geoff Levand
    Cc: Yehuda Sadeh
    Cc: Sage Weil
    Cc: Alex Elder
    Cc: ceph-devel@vger.kernel.org
    Cc: Joshua Morris
    Cc: Philip Kelleher
    Cc: Konrad Rzeszutek Wilk
    Cc: Jeremy Fitzhardinge
    Cc: Neil Brown
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: linux390@de.ibm.com
    Cc: Nagalakshmi Nandigama
    Cc: Sreekanth Reddy
    Cc: support@lsi.com
    Cc: "James E.J. Bottomley"
    Cc: Greg Kroah-Hartman
    Cc: Alexander Viro
    Cc: Steven Whitehouse
    Cc: Herton Ronaldo Krzesinski
    Cc: Tejun Heo
    Cc: Andrew Morton
    Cc: Guo Chao
    Cc: Asai Thambi S P
    Cc: Selvan Mani
    Cc: Sam Bradshaw
    Cc: Matthew Wilcox
    Cc: Keith Busch
    Cc: Stephen Hemminger
    Cc: Quoc-Son Anh
    Cc: Sebastian Ott
    Cc: Nitin Gupta
    Cc: Minchan Kim
    Cc: Jerome Marchand
    Cc: Seth Jennings
    Cc: "Martin K. Petersen"
    Cc: Mike Snitzer
    Cc: Vivek Goyal
    Cc: "Darrick J. Wong"
    Cc: Chris Metcalf
    Cc: Jan Kara
    Cc: linux-m68k@lists.linux-m68k.org
    Cc: linuxppc-dev@lists.ozlabs.org
    Cc: drbd-user@lists.linbit.com
    Cc: nbd-general@lists.sourceforge.net
    Cc: cbe-oss-dev@lists.ozlabs.org
    Cc: xen-devel@lists.xensource.com
    Cc: virtualization@lists.linux-foundation.org
    Cc: linux-raid@vger.kernel.org
    Cc: linux-s390@vger.kernel.org
    Cc: DL-MPTFusionLinux@lsi.com
    Cc: linux-scsi@vger.kernel.org
    Cc: devel@driverdev.osuosl.org
    Cc: linux-fsdevel@vger.kernel.org
    Cc: cluster-devel@redhat.com
    Cc: linux-mm@kvack.org
    Acked-by: Geoff Levand

    Kent Overstreet
     

20 Nov, 2013

1 commit


15 Oct, 2013

1 commit


22 Aug, 2013

1 commit

  • The ECKD protocol supports reading of tracks with arbitrary format as
    raw track images. The DASD device driver supports this in its
    raw_track_access mode. In this mode it maps each track to sixteen 4096
    byte sectors and rejects all requests that are not properly aligned to
    this mapping.

    An application that wants to use a DASD in raw_track_access mode will
    usually use direct I/O to make sure that properly aligned requests are
    directly submitted to the driver. However, applications that are not
    aware of this mode, e.g. udev, will encounter I/O errors.

    To make the use without direct I/O possible and avoid this kind of
    alignment errors, we now pad unaligned read requests with a dummy
    page, so that we can always read full tracks. Please note that
    writing is still only possible for full track images that are properly
    aligned.

    Signed-off-by: Stefan Weinhuber
    Signed-off-by: Martin Schwidefsky

    Stefan Weinhuber
     

01 Jul, 2013

2 commits

  • This patch implements generic block layer timeout handling
    callbacks for DASDs. When the timeout expires the respective
    cqr is aborted.

    With this timeout handler time-critical request abort
    is guaranteed as the abort does not depend on the internal
    state of the various DASD driver queues.

    Signed-off-by: Hannes Reinecke
    Acked-by: Stefan Weinhuber
    Signed-off-by: Stefan Weinhuber
    Signed-off-by: Martin Schwidefsky

    Hannes Reinecke
     
  • Instead of having the number of retries hard-coded in the various
    functions we should be using a default retry value, which can
    be modified via sysfs.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Stefan Weinhuber
    Signed-off-by: Martin Schwidefsky

    Hannes Reinecke
     

27 Jun, 2013

1 commit


17 Apr, 2013

1 commit


28 Feb, 2013

1 commit


14 Feb, 2013

1 commit


08 Jan, 2013

1 commit

  • Now that irq sum accounting for /proc/stat's "intr" line works again we
    have the oddity that the sum field (first field) contains only the sum
    of the second (external irqs) and third field (I/O interrupts).
    The reason for that is that these two fields are already sums of all other
    fields. So if we would sum up everything we would count every interrupt
    twice.
    This is broken since the split interrupt accounting was merged two years
    ago: 052ff461c8427629aee887ccc27478fc7373237c "[S390] irq: have detailed
    statistics for interrupt types".
    To fix this remove the split interrupt fields from /proc/stat's "intr"
    line again and only have them in /proc/interrupts.

    This restores the old behaviour, seems to be the only sane fix and mimics
    a behaviour from other architectures where /proc/interrupts also contains
    more than /proc/stat's "intr" line does.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     

30 Nov, 2012

1 commit

  • If a channel path is cabled incorrectly and the device is suspended and
    resumed the device may be inaccessible afterwards.
    Make the path connection check not interrupt the resume callback there
    could be other valid paths available.

    Signed-off-by: Stefan Haberland
    Reference-ID: RQM 1262
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     

23 Nov, 2012

1 commit


26 Sep, 2012

3 commits

  • A common way to prepare a z/VM mini disk is to format the real device
    with a z/VM tool like CPFMTXA and then define a mini disk that excludes
    the first cylinder, i.e. the cylinder 0 of the virtual disk is located
    at cylinder 1 of the real device.

    The DASD device driver will recognize such a mini disk as formatted, as
    the uniform record layout on the disk matches that of an LDL formatted
    device. However, the cylinder value in the 'count' field of the ECKD
    records matches the geometry of the real device, and not that of the
    mini disk, so I/O requests will fail with 'record not found' errors.

    To make the mini disk usable, it needs to be formatted with a tool like
    dasdfmt. To enable tools like distribution installation tools to
    recognize this situation, the DASD device driver should report such a
    mini disk as 'not formatted'.
    To this end we need to extend the device recognition code to check not
    just for proper record sizes, but also for proper cylinder/head/record
    values.

    Signed-off-by: Stefan Haberland
    Reviewed-by: Stefan Weinhuber
    Signed-off-by: Martin Schwidefsky

    Stefan Haberland
     
  • Change -ENOSYS to -EOPNOTSUPP. Return value is used only internally.

    Signed-off-by: Heiko Carstens
    Signed-off-by: Martin Schwidefsky

    Heiko Carstens
     
  • Add the eadm facility bits to the css characteristics and move
    them to a new header.

    Signed-off-by: Sebastian Ott
    Signed-off-by: Martin Schwidefsky

    Sebastian Ott