1. 23 Feb, 2017 4 commits
  2. 22 Feb, 2017 27 commits
  3. 21 Feb, 2017 9 commits
    • Omar Sandoval's avatar
      scsi_transport_sas: fix BSG ioctl memory corruption · bd1599d9
      Omar Sandoval authored
      The end_device and sas_host devices support BSG ioctls, but the
      request_queue allocated for them isn't set up to allocate the struct
      scsi_request payload. This leads to memory corruption in the call to
      scsi_req_init() in bsg_map_hdr(), since it will memset past the end of
      the allocated request. Fix it by setting ->cmd_size on the allocated
      request_queue.
      
      Fixes: 82ed4db4 ("block: split scsi_request out of struct request")
      Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
      Acked-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      bd1599d9
    • Jan Kara's avatar
      block: Revalidate i_bdev reference in bd_aquire() · cccd9fb9
      Jan Kara authored
      When a device gets removed, block device inode unhashed so that it is not
      used anymore (bdget() will not find it anymore). Later when a new device
      gets created with the same device number, we create new block device
      inode. However there may be file system device inodes whose i_bdev still
      points to the original block device inode and thus we get two active
      block device inodes for the same device. They will share the same
      gendisk so the only visible differences will be that page caches will
      not be coherent and BDIs will be different (the old block device inode
      still points to unregistered BDI).
      
      Fix the problem by checking in bd_acquire() whether i_bdev still points
      to active block device inode and re-lookup the block device if not. That
      way any open of a block device happening after the old device has been
      removed will get correct block device inode.
      Tested-by: default avatarLekshmi Pillai <lekshmicpillai@in.ibm.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      cccd9fb9
    • Jan Kara's avatar
      block: Unhash also block device inode for the whole device · d06e05c0
      Jan Kara authored
      Iteration over partitions in del_gendisk() omits part0. Add
      bdev_unhash_inode() call for the whole device. Otherwise if the device
      number gets reused, bdev inode will be still associated with the old
      (stale) bdi.
      Tested-by: default avatarLekshmi Pillai <lekshmicpillai@in.ibm.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      d06e05c0
    • Jan Kara's avatar
      block: Move bdev_unhash_inode() after invalidate_partition() · 4b8c861a
      Jan Kara authored
      Move bdev_unhash_inode() after invalidate_partition() as
      invalidate_partition() looks up bdev and it cannot find the right bdev
      inode after bdev_unhash_inode() is called. Thus invalidate_partition()
      would not invalidate page cache of the previously used bdev. Also use
      part_devt() when calling bdev_unhash_inode() instead of manually
      creating the device number.
      Tested-by: default avatarLekshmi Pillai <lekshmicpillai@in.ibm.com>
      Acked-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      4b8c861a
    • Josef Bacik's avatar
      nbd: cleanup workqueue on error properly · 6330a2d0
      Josef Bacik authored
      If we fail to register the blockdev we need to make sure to destroy the
      recv workqueue.
      Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      6330a2d0
    • Josef Bacik's avatar
      nbd: set the logical and physical blocksize properly · e544541b
      Josef Bacik authored
      We noticed when trying to do O_DIRECT to an export on the server side
      that we were getting requests smaller than the 4k sectorsize of the
      device.  This is because the client isn't setting the logical and
      physical blocksizes properly for the underlying device.  Fix this up by
      setting the queue blocksizes and then calling bd_set_size.
      Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      e544541b
    • Josef Bacik's avatar
      nbd: cleanup ioctl handling · 9442b739
      Josef Bacik authored
      Break the ioctl handling out into helper functions, some of these things
      are getting pretty big and unwieldy.
      Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      9442b739
    • Christoph Hellwig's avatar
      scsi: zero per-cmd driver data before each I/O · ee524236
      Christoph Hellwig authored
      Without this drivers that don't clear the state themselves can see off
      effects.  For example Hyper-V VMs using the storvsc driver will often
      hang during boot due to uncleared Test Unit Ready failures.
      
      Fixes: e9c787e6 ("scsi: allocate scsi_cmnd structures as part of struct request")
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Reported-by: default avatarDexuan Cui <decui@microsoft.com>
      Tested-by: default avatarDexuan Cui <decui@microsoft.com>
      Reviewed-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      ee524236
    • Linus Torvalds's avatar
      Merge tag 'for-4.11/linus-merge-signed' of git://git.kernel.dk/linux-block · 772c8f6f
      Linus Torvalds authored
      Pull block layer updates from Jens Axboe:
      
       - blk-mq scheduling framework from me and Omar, with a port of the
         deadline scheduler for this framework. A port of BFQ from Paolo is in
         the works, and should be ready for 4.12.
      
       - Various fixups and improvements to the above scheduling framework
         from Omar, Paolo, Bart, me, others.
      
       - Cleanup of the exported sysfs blk-mq data into debugfs, from Omar.
         This allows us to export more information that helps debug hangs or
         performance issues, without cluttering or abusing the sysfs API.
      
       - Fixes for the sbitmap code, the scalable bitmap code that was
         migrated from blk-mq, from Omar.
      
       - Removal of the BLOCK_PC support in struct request, and refactoring of
         carrying SCSI payloads in the block layer. This cleans up the code
         nicely, and enables us to kill the SCSI specific parts of struct
         request, shrinking it down nicely. From Christoph mainly, with help
         from Hannes.
      
       - Support for ranged discard requests and discard merging, also from
         Christoph.
      
       - Support for OPAL in the block layer, and for NVMe as well. Mainly
         from Scott Bauer, with fixes/updates from various others folks.
      
       - Error code fixup for gdrom from Christophe.
      
       - cciss pci irq allocation cleanup from Christoph.
      
       - Making the cdrom device operations read only, from Kees Cook.
      
       - Fixes for duplicate bdi registrations and bdi/queue life time
         problems from Jan and Dan.
      
       - Set of fixes and updates for lightnvm, from Matias and Javier.
      
       - A few fixes for nbd from Josef, using idr to name devices and a
         workqueue deadlock fix on receive. Also marks Josef as the current
         maintainer of nbd.
      
       - Fix from Josef, overwriting queue settings when the number of
         hardware queues is updated for a blk-mq device.
      
       - NVMe fix from Keith, ensuring that we don't repeatedly mark and IO
         aborted, if we didn't end up aborting it.
      
       - SG gap merging fix from Ming Lei for block.
      
       - Loop fix also from Ming, fixing a race and crash between setting loop
         status and IO.
      
       - Two block race fixes from Tahsin, fixing request list iteration and
         fixing a race between device registration and udev device add
         notifiations.
      
       - Double free fix from cgroup writeback, from Tejun.
      
       - Another double free fix in blkcg, from Hou Tao.
      
       - Partition overflow fix for EFI from Alden Tondettar.
      
      * tag 'for-4.11/linus-merge-signed' of git://git.kernel.dk/linux-block: (156 commits)
        nvme: Check for Security send/recv support before issuing commands.
        block/sed-opal: allocate struct opal_dev dynamically
        block/sed-opal: tone down not supported warnings
        block: don't defer flushes on blk-mq + scheduling
        blk-mq-sched: ask scheduler for work, if we failed dispatching leftovers
        blk-mq: don't special case flush inserts for blk-mq-sched
        blk-mq-sched: don't add flushes to the head of requeue queue
        blk-mq: have blk_mq_dispatch_rq_list() return if we queued IO or not
        block: do not allow updates through sysfs until registration completes
        lightnvm: set default lun range when no luns are specified
        lightnvm: fix off-by-one error on target initialization
        Maintainers: Modify SED list from nvme to block
        Move stack parameters for sed_ioctl to prevent oversized stack with CONFIG_KASAN
        uapi: sed-opal fix IOW for activate lsp to use correct struct
        cdrom: Make device operations read-only
        elevator: fix loading wrong elevator type for blk-mq devices
        cciss: switch to pci_irq_alloc_vectors
        block/loop: fix race between I/O and set_status
        blk-mq-sched: don't hold queue_lock when calling exit_icq
        block: set make_request_fn manually in blk_mq_update_nr_hw_queues
        ...
      772c8f6f