1. 22 Feb, 2017 27 commits
  2. 21 Feb, 2017 13 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
    • Mark Brown's avatar
      sched/core: Fix build paravirt build on arm and arm64 · fd4a61e0
      Mark Brown authored
      Commit 004172bd ("sched/core: Remove unnecessary #include headers")
      removed the inclusion of asm/paravirt.h which is used to get
      declarations of paravirt_steal_rq_enabled and paravirt_steal_clock.
      
      It is implicitly included on x86 but not on arm and arm64 breaking the
      build if paravirtualization is used.  Since things from that header are
      used directly fix the build by putting the direct inclusion back.
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fd4a61e0
    • Linus Torvalds's avatar
      Merge tag 'gfs2-4.11.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2 · 9763dd6f
      Linus Torvalds authored
      Pull GFS2 updates from Robert Peterson:
       "We've got eight GFS2 patches for this merge window:
      
         - Andy Price submitted a patch to make gfs2_write_full_page a static
           function.
      
         - Dan Carpenter submitted a patch to fix a ERR_PTR thinko.
      
        Three patches fix bugs related to deleting very large files, which
        cause GFS2 to run out of journal space:
      
         - The first one prevents GFS2 delete operation from requesting too
           much journal space.
      
         - The second one fixes a problem whereby GFS2 can hang because it
           wasn't taking journal space demand into its calculations.
      
         - The third one wakes up IO waiters when a flush is done to restart
           processes stuck waiting for journal space to become available.
      
        The final three patches are a performance improvement related to
        spin_lock contention between multiple writers:
      
         - The "tr_touched" variable was switched to a flag to be more atomic
           and eliminate the possibility of some races.
      
         - Function meta_lo_add was moved inline with its only caller to make
           the code more readable and efficient.
      
         - Contention on the gfs2_log_lock spinlock was greatly reduced by
           avoiding the lock altogether in cases where we don't really need
           it: buffers that already appear in the appropriate metadata list
           for the journal. Many thanks to Steve Whitehouse for the ideas and
           principles behind these patches"
      
      * tag 'gfs2-4.11.fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
        gfs2: Make gfs2_write_full_page static
        GFS2: Reduce contention on gfs2_log_lock
        GFS2: Inline function meta_lo_add
        GFS2: Switch tr_touched to flag in transaction
        GFS2: Wake up io waiters whenever a flush is done
        GFS2: Made logd daemon take into account log demand
        GFS2: Limit number of transaction blocks requested for truncates
        GFS2: Fix reference to ERR_PTR in gfs2_glock_iter_next
      9763dd6f
    • Linus Torvalds's avatar
      Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs · 70fcf5c3
      Linus Torvalds authored
      Pull UDF fixes and cleanups from Jan Kara:
       "Several small UDF fixes and cleanups and a small cleanup of fanotify
        code"
      
      * 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs:
        fanotify: simplify the code of fanotify_merge
        udf: simplify udf_ioctl()
        udf: fix ioctl errors
        udf: allow implicit blocksize specification during mount
        udf: check partition reference in udf_read_inode()
        udf: atomically read inode size
        udf: merge module informations in super.c
        udf: remove next_epos from udf_update_extent_cache()
        udf: Factor out trimming of crtime
        udf: remove empty condition
        udf: remove unneeded line break
        udf: merge bh free
        udf: use pointer for kernel_long_ad argument
        udf: use __packed instead of __attribute__ ((packed))
        udf: Make stat on symlink report symlink length as st_size
        fs/udf: make #ifdef UDF_PREALLOCATE unconditional
        fs: udf: Replace CURRENT_TIME with current_time()
      70fcf5c3
    • Linus Torvalds's avatar
      Merge branch 'for-next' of git://git.samba.org/sfrench/cifs-2.6 · 2bfe01ef
      Linus Torvalds authored
      Pull CIFS/SMB3 updates from Steve French:
       "Includes support for a critical SMB3 security feature: per-share
        encryption from Pavel, and a cleanup from Jean Delvare.
      
        Will have another cifs/smb3 merge next week"
      
      * 'for-next' of git://git.samba.org/sfrench/cifs-2.6:
        CIFS: Allow to switch on encryption with seal mount option
        CIFS: Add capability to decrypt big read responses
        CIFS: Decrypt and process small encrypted packets
        CIFS: Add copy into pages callback for a read operation
        CIFS: Add mid handle callback
        CIFS: Add transform header handling callbacks
        CIFS: Encrypt SMB3 requests before sending
        CIFS: Enable encryption during session setup phase
        CIFS: Add capability to transform requests before sending
        CIFS: Separate RFC1001 length processing for SMB2 read
        CIFS: Separate SMB2 sync header processing
        CIFS: Send RFC1001 length in a separate iov
        CIFS: Make send_cancel take rqst as argument
        CIFS: Make SendReceive2() takes resp iov
        CIFS: Separate SMB2 header structure
        CIFS: Fix splice read for non-cached files
        cifs: Add soft dependencies
        cifs: Only select the required crypto modules
        cifs: Simplify SMB2 and SMB311 dependencies
      2bfe01ef