1. 20 4月, 2017 4 次提交
    • R
      ligtnvm: fix double blk_put_queue on same queue · 75ba4ada
      Rakesh Pandit 提交于
      On an error path in NVM_DEV_CREATE ioctl blk_put_queue is being called
      twice: one via blk_cleanup_queue and another via put_disk.  Straight fix
      seems to remove queue pointer so that disk_release never ends up caling
      blk_put_queue again.
      
        [  391.808827] WARNING: CPU: 1 PID: 1250 at lib/refcount.c:128 refcount_sub_and_test+0x70/0x80
        [  391.808830] refcount_t: underflow; use-after-free.
        [ 391.808832] Modules linked in: nf_conntrack_netbios_ns............
        [  391.809052] CPU: 1 PID: 1250 Comm: nvme Not tainted.........
        [  391.809057] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996),
                   BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014
        [  391.809060] Call Trace:
        [  391.809079]  dump_stack+0x63/0x86
        [  391.809094]  __warn+0xcb/0xf0
        [  391.809103]  warn_slowpath_fmt+0x5f/0x80
        [  391.809118]  refcount_sub_and_test+0x70/0x80
        [  391.809125]  refcount_dec_and_test+0x11/0x20
        [  391.809136]  kobject_put+0x1f/0x60
        [  391.809149]  blk_put_queue+0x15/0x20
        [  391.809159]  disk_release+0xae/0xf0
        [  391.809172]  device_release+0x32/0x90
        [  391.809184]  kobject_release+0x6a/0x170
        [  391.809196]  kobject_put+0x2f/0x60
        [  391.809206]  put_disk+0x17/0x20
        [  391.809219]  nvm_ioctl_dev_create.isra.16+0x897/0xa30
        [  391.809236]  nvm_ctl_ioctl+0x23c/0x4c0
        [  391.809248]  do_vfs_ioctl+0xa3/0x5f0
        [  391.809258]  SyS_ioctl+0x79/0x90
        [  391.809271]  entry_SYSCALL_64_fastpath+0x1a/0xa9
        [  391.809280] RIP: 0033:0x7f5d3ef363c7
        [  391.809286] RSP: 002b:00007ffc72ed8d78 EFLAGS: 00000206 ORIG_RAX: 0000000000000010
        [  391.809296] RAX: ffffffffffffffda RBX: 00007ffc72edb552 RCX: 00007f5d3ef363c7
        [  391.809301] RDX: 00007ffc72ed8d90 RSI: 0000000040804c22 RDI: 0000000000000003
        [  391.809306] RBP: 0000000000000001 R08: 0000000000000020 R09: 0000000000000001
        [  391.809311] R10: 000000000000053f R11: 0000000000000206 R12: 0000000000000000
        [  391.809316] R13: 0000000000000000 R14: 00007ffc72edb58d R15: 00007ffc72edb581
      Signed-off-by: NRakesh Pandit <rakesh@tuxera.com>
      Reviewed-by: NMatias Bjørling <matias@cnexlabs.com>
      Fixes: 7d1ef2f4 "lightnvm: fix cleanup order of disk on init error"
      Signed-off-by: NJens Axboe <axboe@fb.com>
      75ba4ada
    • B
      lightnvm: Use blk_init_request_from_bio() instead of open-coding it · 9460e280
      Bart Van Assche 提交于
      This patch changes the behavior of the lightnvm driver as follows:
      * REQ_FAILFAST_MASK is set for read-ahead requests.
      * If no I/O priority has been set in the bio, the I/O priority is
        copied from the I/O context.
      * The rq_disk member is initialized if bio->bi_bdev != NULL.
      * The bio sector offset is copied into req->__sector instead of
        retaining the value -1 set by blk_mq_alloc_request().
      * req->errors is initialized to zero.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Matias Bjørling <m@bjorling.me>
      Cc: Adam Manzanares <adam.manzanares@wdc.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      9460e280
    • B
      null_blk: Use blk_init_request_from_bio() instead of open-coding it · 2644a3cc
      Bart Van Assche 提交于
      This patch changes the behavior of the null_blk driver for the
      LightNVM mode as follows:
      * REQ_FAILFAST_MASK is set for read-ahead requests.
      * If no I/O priority has been set in the bio, the I/O priority is
        copied from the I/O context.
      * The rq_disk member is initialized if bio->bi_bdev != NULL.
      * req->errors is initialized to zero.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Matias Bjørling <m@bjorling.me>
      Cc: Adam Manzanares <adam.manzanares@wdc.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      2644a3cc
    • A
      lightnvm: assume 64-bit lba numbers · ef697902
      Arnd Bergmann 提交于
      The driver uses both u64 and sector_t to refer to offsets, and assigns between the
      two. This causes one harmless warning when sector_t is 32-bit:
      
      drivers/lightnvm/pblk-rb.c: In function 'pblk_rb_write_entry_gc':
      include/linux/lightnvm.h:215:20: error: large integer implicitly truncated to unsigned type [-Werror=overflow]
      drivers/lightnvm/pblk-rb.c:324:22: note: in expansion of macro 'ADDR_EMPTY'
      
      As the driver is already doing this inconsistently, changing the type
      won't make it worse and is an easy way to avoid the warning.
      
      Fixes: a4bd217b ("lightnvm: physical block device (pblk) target")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      ef697902
  2. 19 4月, 2017 2 次提交
  3. 18 4月, 2017 1 次提交
  4. 17 4月, 2017 30 次提交
  5. 15 4月, 2017 1 次提交
  6. 09 4月, 2017 2 次提交
    • M
      scsi: sd: Remove LBPRZ dependency for discards · bcd069bb
      Martin K. Petersen 提交于
      Separating discards and zeroout operations allows us to remove the LBPRZ
      block zeroing constraints from discards and honor the device preferences
      for UNMAP commands.
      
      If supported by the device, we'll also choose UNMAP over one of the
      WRITE SAME variants for discards.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      bcd069bb
    • M
      scsi: sd: Separate zeroout and discard command choices · e6bd9312
      Martin K. Petersen 提交于
      Now that zeroout and discards are distinct operations we need to
      separate the policy of choosing the appropriate command. Create a
      zeroing_mode which can be one of:
      
      write:			Zeroout assist not present, use regular WRITE
      writesame:		Allow WRITE SAME(10/16) with a zeroed payload
      writesame_16_unmap:	Allow WRITE SAME(16) with UNMAP
      writesame_10_unmap:	Allow WRITE SAME(10) with UNMAP
      
      The last two are conditional on the device being thin provisioned with
      LBPRZ=1 and LBPWS=1 or LBPWS10=1 respectively.
      
      Whether to set the UNMAP bit or not depends on the REQ_NOUNMAP flag. And
      if none of the _unmap variants are supported, regular WRITE SAME will be
      used if the device supports it.
      
      The zeroout_mode is exported in sysfs and the detected mode for a given
      device can be overridden using the string constants above.
      
      With this change in place we can now issue WRITE SAME(16) with UNMAP set
      for block zeroing applications that require hard guarantees and
      logical_block_size granularity. And at the same time use the UNMAP
      command with the device's preferred granulary and alignment for discard
      operations.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      e6bd9312