1. 16 11月, 2020 4 次提交
  2. 12 3月, 2020 1 次提交
    • S
      s390/dasd: fix data corruption for thin provisioned devices · 5e6bdd37
      Stefan Haberland 提交于
      Devices are formatted in multiple of tracks.
      For an Extent Space Efficient (ESE) volume we get errors when accessing
      unformatted tracks. In this case the driver either formats the track on
      the flight for write requests or returns zero data for read requests.
      
      In case a request spans multiple tracks, the indication of an unformatted
      track presented for the first track is incorrectly applied to all tracks
      covered by the request. As a result, tracks containing data will be handled
      as empty, resulting in zero data being returned on read, or overwriting
      existing data with zero on write.
      
      Fix by determining the track that gets the NRF error.
      For write requests only format the track that is surely not formatted.
      For Read requests all tracks before have returned valid data and should not
      be touched.
      All tracks after the unformatted track might be formatted or not. Those are
      returned to the blocklayer to build a new request.
      
      When using alias devices there is a chance that multiple write requests
      trigger a format of the same track which might lead to data loss. Ensure
      that a track is formatted only once by maintaining a list of currently
      processed tracks.
      
      Fixes: 5e2b17e7 ("s390/dasd: Add dynamic formatting support for ESE volumes")
      Cc: stable@vger.kernel.org # 5.3+
      Signed-off-by: NStefan Haberland <sth@linux.ibm.com>
      Reviewed-by: NJan Hoeppner <hoeppner@linux.ibm.com>
      Reviewed-by: NPeter Oberparleiter <oberpar@linux.ibm.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5e6bdd37
  3. 21 12月, 2019 2 次提交
  4. 01 10月, 2019 2 次提交
    • S
      Revert "s390/dasd: Add discard support for ESE volumes" · 964ce509
      Stefan Haberland 提交于
      This reverts commit 7e64db15.
      
      The thin provisioning feature introduces an IOCTL and the discard support
      to allow userspace tools and filesystems to release unused and previously
      allocated space respectively.
      
      During some internal performance improvements and further tests, the
      release of allocated space revealed some issues that may lead to data
      corruption in some configurations when filesystems are mounted with
      discard support enabled.
      
      While we're working on a fix and trying to clarify the situation,
      this commit reverts the discard support for ESE volumes to prevent
      potential data corruption.
      
      Cc: <stable@vger.kernel.org> # 5.3
      Signed-off-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      964ce509
    • J
      s390/dasd: Fix error handling during online processing · dd454839
      Jan Höppner 提交于
      It is possible that the CCW commands for reading volume and extent pool
      information are not supported, either by the storage server (for
      dedicated DASDs) or by z/VM (for virtual devices, such as MDISKs).
      
      As a command reject will occur in such a case, the current error
      handling leads to a failing online processing and thus the DASD can't be
      used at all.
      
      Since the data being read is not essential for an fully operational
      DASD, the error handling can be removed. Information about the failing
      command is sent to the s390dbf debug feature.
      
      Fixes: c729696b ("s390/dasd: Recognise data for ESE volumes")
      Cc: <stable@vger.kernel.org> # 5.3
      Reported-by: NFrank Heimes <frank.heimes@canonical.com>
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Signed-off-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      dd454839
  5. 12 7月, 2019 8 次提交
    • J
      s390/dasd: Handle out-of-space constraint · 9e12e54c
      Jan Höppner 提交于
      The storage server issues three different types of out-of-space messages
      whenever the Extent Pool or Extent Repository space runs short. When a
      configured warning watermark is reached, the physical space is
      completeley exhausted, or the capacity constraints have been relieved, a
      message is received.
      
      A log entry for the sysadmin to react to is generated in any case. In
      case the physical space is completely exhausted, sense data that reads
      "no space left on device" is received. In this case, currently running
      I/O will be blocked until space has either been released or added to the
      extent pool, and a relieve message was received via an attention
      interrupt.
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Reviewed-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      9e12e54c
    • J
      s390/dasd: Add discard support for ESE volumes · 7e64db15
      Jan Höppner 提交于
      ESE (Extent Space Efficient) volumes are thin-provisioned and therefore
      space is only occupied with real data. In order to make previously used
      space available for re-allocation again, discard support is enabled for
      ESE volumes allowing the DASD driver to release said space.
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Reviewed-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      7e64db15
    • J
      s390/dasd: Make dasd_setup_queue() a discipline function · a0610a8a
      Jan Höppner 提交于
      ECKD, FBA, and the DIAG discipline use slightly different block layer
      settings. In preparation of even more diverse queue settings, make
      dasd_setup_queue() a discipline function.
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Reviewed-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      a0610a8a
    • J
      s390/dasd: Add new ioctl to release space · 91dc4a19
      Jan Höppner 提交于
      Userspace tools might have the need to release space for Extent Space
      Efficient (ESE) volumes when working with such a device.
      
      Provide the necessarry interface for such a task by implementing a new
      ioctl BIODASDRAS. The ioctl uses the format_data_t data structure for
      data input:
      
      typedef struct format_data_t {
              unsigned int start_unit;        /* from track */
              unsigned int stop_unit;         /* to track */
              unsigned int blksize;           /* sectorsize */
              unsigned int intensity;
      } format_data_t;
      
      If the intensity is set to 0x40, start_unit and stop_unit are ignored
      and space for the entire volume is released. Otherwise, if intensity is
      set to 0, the respective range is released (if possible).
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Reviewed-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      91dc4a19
    • J
      s390/dasd: Add dynamic formatting support for ESE volumes · 5e2b17e7
      Jan Höppner 提交于
      A dynamic formatting is issued whenever a write request returns with
      either a No Record Found error (Command Mode), Incorrect Length error
      (Transport Mode), or File Protected error (Transport Mode). All three
      cases mean that the tracks in question haven't been initialized in a
      desired format yet.
      
      The part of the volume that was tried to be written on is then formatted
      and the original request is re-queued.
      
      As the formatting will happen during normal I/O operations, it is quite
      likely that there won't be any memory available to build the respective
      request. Another two pages of memory are allocated per volume
      specifically for the dynamic formatting.
      
      The dasd_eckd_build_format() function is extended to make sure that the
      original startdev is reused. Also, all formatting and format check
      functions use the new memory pool exclusively now to reduce complexity.
      
      Read operations will always return zero data when unformatted areas are
      read.
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Reviewed-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      5e2b17e7
    • J
      s390/dasd: Recognise data for ESE volumes · c729696b
      Jan Höppner 提交于
      In order to work with Extent Space Efficient (ESE) volumes, certain
      viable information about those volumes and the corresponding extent
      pool (such as extent size, configured space, allocated space, etc.) can
      be provided.
      
      Use the CCW commands Volume Storage Query and Logical Configuration
      Query to receive detailed information about ESE volumes and the extent
      pool respectively. These information are made accessible via internal
      functions for subsequent users, and via sysfs attributes for userpsace
      usage.
      
      The new sysfs attributes reside in separate directories called capacity
      and extent_pool.
      
      attributes:
      ese:
          0/1 depending on whether the volume is an ESE volume
      
      Capacity related attributes:
      space_allocated:
          Space currently allocated by the volume (in cyl)
      space_configured:
          Remaining space in the extent pool (in cyl)
      logical_capacity:
          The entire addressable space for this volume (in cyl)
      
      Extent Pool related attributes:
      pool_id:
          ID of the extent pool the volume in question resides in
      pool_oos:
          Extent pool is out-of-space
      extent_size:
          Size of a single extent in this pool
      cap_at_warnlevel
          Extent pool capacity at warn level
      warn_threshold:
          Threshold at which percentage of remaining extent pool space a
          warning message is issued
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Reviewed-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      c729696b
    • J
      s390/dasd: Make layout analysis ESE compatible · ce6915f5
      Jan Höppner 提交于
      The disk layout and volume information of a DASD reside in the first two
      tracks of cylinder 0. When a DASD is set online, currently the first
      three tracks are read and analysed to confirm an expected layout.
      
      For CDL (Compatible Disk Layout) only count area data of the first track
      is evaluated and checked against expected key and data lengths. For LDL
      (Linux Disk Layout) the first and third track is evaluated. However,
      an LDL formatted volume is expected to be in the same format across all
      tracks. Checking the third track therefore doesn't have any more value
      than checking any other track at random.
      
      Now, an Extent Space Efficient (ESE) DASD is initialised by only
      formatting the first two tracks, as those tracks always contain all
      information necessarry.
      
      Checking the third track on an ESE volume will therefore most likely
      fail with a record not found error, as the third track will be empty.
      This in turn leads to the device being recognised with a volume size of
      0. Attempts to write volume information on the first two tracks then
      fail with "no space left on device" errors.
      
      Initialising the first three tracks for an ESE volume is not a viable
      solution, because the third track is already a regular track and could
      contain user data. With that there is potential for data corruption.
      
      Instead, always only analyse the first two tracks, as it is sufficiant
      for both CDL and LDL, and allow ESE volumes to be recognised as well.
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Reviewed-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      ce6915f5
    • J
      s390/dasd: Remove old defines and function · 8a9f606f
      Jan Höppner 提交于
      Commit 4d284cac ("[S390] Avoid excessive inlining.") removed
      bytes_per_record() which was the only user of the defines ECKD_C0 and
      ECKD_F*, and round_up_multiple(). Let's get rid of those.
      Signed-off-by: NJan Höppner <hoeppner@linux.ibm.com>
      Reviewed-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NVasily Gorbik <gor@linux.ibm.com>
      8a9f606f
  6. 09 5月, 2019 1 次提交
  7. 29 3月, 2019 1 次提交
  8. 28 1月, 2019 1 次提交
    • S
      s390/dasd: fix using offset into zero size array error · 4a8ef699
      Stefan Haberland 提交于
      Dan Carpenter reported the following:
      
      The patch 52898025: "[S390] dasd: security and PSF update patch
      for EMC CKD ioctl" from Mar 8, 2010, leads to the following static
      checker warning:
      
      	drivers/s390/block/dasd_eckd.c:4486 dasd_symm_io()
      	error: using offset into zero size array 'psf_data[]'
      
      drivers/s390/block/dasd_eckd.c
        4458          /* Copy parms from caller */
        4459          rc = -EFAULT;
        4460          if (copy_from_user(&usrparm, argp, sizeof(usrparm)))
                                          ^^^^^^^
      The user can specify any "usrparm.psf_data_len".  They choose zero by
      mistake.
      
        4461                  goto out;
        4462          if (is_compat_task()) {
        4463                  /* Make sure pointers are sane even on 31 bit. */
        4464                  rc = -EINVAL;
        4465                  if ((usrparm.psf_data >> 32) != 0)
        4466                          goto out;
        4467                  if ((usrparm.rssd_result >> 32) != 0)
        4468                          goto out;
        4469                  usrparm.psf_data &= 0x7fffffffULL;
        4470                  usrparm.rssd_result &= 0x7fffffffULL;
        4471          }
        4472          /* alloc I/O data area */
        4473          psf_data = kzalloc(usrparm.psf_data_len, GFP_KERNEL
        			   				 | GFP_DMA);
        4474          rssd_result = kzalloc(usrparm.rssd_result_len, GFP_KERNEL
      							       | GFP_DMA);
        4475          if (!psf_data || !rssd_result) {
      
      kzalloc() returns a ZERO_SIZE_PTR (0x16).
      
        4476                  rc = -ENOMEM;
        4477                  goto out_free;
        4478          }
        4479
        4480          /* get syscall header from user space */
        4481          rc = -EFAULT;
        4482          if (copy_from_user(psf_data,
        4483                             (void __user *)(unsigned long)
        				   	 		 usrparm.psf_data,
        4484                             usrparm.psf_data_len))
      
      That all works great.
      
        4485                  goto out_free;
        4486          psf0 = psf_data[0];
        4487          psf1 = psf_data[1];
      
      But now we're assuming that "->psf_data_len" was at least 2 bytes.
      
      Fix this by checking the user specified length psf_data_len.
      
      Fixes: 52898025 ("[S390] dasd: security and PSF update patch for EMC CKD ioctl")
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NStefan Haberland <sth@linux.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      4a8ef699
  9. 09 8月, 2018 2 次提交
  10. 19 7月, 2018 1 次提交
  11. 12 6月, 2018 1 次提交
  12. 26 3月, 2018 1 次提交
  13. 27 2月, 2018 1 次提交
  14. 23 1月, 2018 1 次提交
  15. 05 12月, 2017 1 次提交
  16. 24 11月, 2017 1 次提交
    • G
      s390: block: add SPDX identifiers to the remaining files · 6a55d2cd
      Greg Kroah-Hartman 提交于
      It's good to have SPDX identifiers in all files to make it easier to
      audit the kernel tree for correct licenses.
      
      Update the drivers/s390/block/ files with the correct SPDX license
      identifier based on the license text in the file itself.  The SPDX
      identifier is a legally binding shorthand, which can be used instead of
      the full boiler plate text.
      
      This work is based on a script and data from Thomas Gleixner, Philippe
      Ombredanne, and Kate Stewart.
      
      Cc: Stefan Haberland <sth@linux.vnet.ibm.com>
      Cc: Jan Hoeppner <hoeppner@linux.vnet.ibm.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      6a55d2cd
  17. 23 8月, 2017 1 次提交
  18. 05 7月, 2017 3 次提交
  19. 28 3月, 2017 2 次提交
  20. 23 2月, 2017 1 次提交
  21. 31 1月, 2017 1 次提交
  22. 25 12月, 2016 1 次提交
  23. 12 12月, 2016 2 次提交