1. 18 8月, 2017 2 次提交
    • B
      skd: Submit requests to firmware before triggering the doorbell · 5fbd545c
      Bart Van Assche 提交于
      Ensure that the members of struct skd_msg_buf have been transferred
      to the PCIe adapter before the doorbell is triggered. This patch
      avoids that I/O fails sporadically and that the following error
      message is reported:
      
      (skd0:STM000196603:[0000:00:09.0]): Completion mismatch comp_id=0x0000 skreq=0x0400 new=0x0000
      Signed-off-by: NBart Van Assche <bart.vanassche@wdc.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      5fbd545c
    • B
      skd: Avoid that module unloading triggers a use-after-free · 7277cc67
      Bart Van Assche 提交于
      Since put_disk() triggers a disk_release() call and since that
      last function calls blk_put_queue() if disk->queue != NULL, clear
      the disk->queue pointer before calling put_disk(). This avoids
      that unloading the skd kernel module triggers the following
      use-after-free:
      
      WARNING: CPU: 8 PID: 297 at lib/refcount.c:128 refcount_sub_and_test+0x70/0x80
      refcount_t: underflow; use-after-free.
      CPU: 8 PID: 297 Comm: kworker/8:1 Not tainted 4.11.10-300.fc26.x86_64 #1
      Workqueue: events work_for_cpu_fn
      Call Trace:
       dump_stack+0x63/0x84
       __warn+0xcb/0xf0
       warn_slowpath_fmt+0x5a/0x80
       refcount_sub_and_test+0x70/0x80
       refcount_dec_and_test+0x11/0x20
       kobject_put+0x1f/0x50
       blk_put_queue+0x15/0x20
       disk_release+0xae/0xf0
       device_release+0x32/0x90
       kobject_release+0x67/0x170
       kobject_put+0x2b/0x50
       put_disk+0x17/0x20
       skd_destruct+0x5c/0x890 [skd]
       skd_pci_probe+0x124d/0x13a0 [skd]
       local_pci_probe+0x42/0xa0
       work_for_cpu_fn+0x14/0x20
       process_one_work+0x19e/0x470
       worker_thread+0x1dc/0x4a0
       kthread+0x125/0x140
       ret_from_fork+0x25/0x30
      Signed-off-by: NBart Van Assche <bart.vanassche@wdc.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.de>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      7277cc67
  2. 28 6月, 2017 1 次提交
  3. 09 6月, 2017 1 次提交
    • C
      block: introduce new block status code type · 2a842aca
      Christoph Hellwig 提交于
      Currently we use nornal Linux errno values in the block layer, and while
      we accept any error a few have overloaded magic meanings.  This patch
      instead introduces a new  blk_status_t value that holds block layer specific
      status codes and explicitly explains their meaning.  Helpers to convert from
      and to the previous special meanings are provided for now, but I suspect
      we want to get rid of them in the long run - those drivers that have a
      errno input (e.g. networking) usually get errnos that don't know about
      the special block layer overloads, and similarly returning them to userspace
      will usually return somethings that strictly speaking isn't correct
      for file system operations, but that's left as an exercise for later.
      
      For now the set of errors is a very limited set that closely corresponds
      to the previous overloaded errno values, but there is some low hanging
      fruite to improve it.
      
      blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse
      typechecking, so that we can easily catch places passing the wrong values.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      2a842aca
  4. 01 2月, 2017 1 次提交
  5. 18 11月, 2016 1 次提交
  6. 10 11月, 2016 2 次提交
    • A
      skd: fix function prototype · 41c9499b
      Arnd Bergmann 提交于
      Building with W=1 shows a harmless warning for the skd driver:
      
      drivers/block/skd_main.c:2959:1: error: ‘static’ is not at beginning of declaration [-Werror=old-style-declaration]
      
      This changes the prototype to the expected formatting.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      41c9499b
    • A
      skd: fix msix error handling · 3bc8492f
      Arnd Bergmann 提交于
      As reported by gcc -Wmaybe-uninitialized, the cleanup path for
      skd_acquire_msix tries to free the already allocated msi-x vectors
      in reverse order, but the index variable may not have been
      used yet:
      
      drivers/block/skd_main.c: In function ‘skd_acquire_irq’:
      drivers/block/skd_main.c:3890:8: error: ‘i’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
      
      This changes the failure path to skip releasing the interrupts
      if we have not started requesting them yet.
      
      Fixes: 180b0ae7 ("skd: use pci_alloc_irq_vectors")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      3bc8492f
  7. 08 11月, 2016 2 次提交
  8. 28 6月, 2016 1 次提交
    • D
      block: convert to device_add_disk() · 0d52c756
      Dan Williams 提交于
      For block drivers that specify a parent device, convert them to use
      device_add_disk().
      
      This conversion was done with the following semantic patch:
      
          @@
          struct gendisk *disk;
          expression E;
          @@
      
          - disk->driverfs_dev = E;
          ...
          - add_disk(disk);
          + device_add_disk(E, disk);
      
          @@
          struct gendisk *disk;
          expression E1, E2;
          @@
      
          - disk->driverfs_dev = E1;
          ...
          E2 = disk;
          ...
          - add_disk(E2);
          + device_add_disk(E1, E2);
      
      ...plus some manual fixups for a few missed conversions.
      
      Cc: Jens Axboe <axboe@fb.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: James Bottomley <James.Bottomley@hansenpartnership.com>
      Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NDan Williams <dan.j.williams@intel.com>
      0d52c756
  9. 08 6月, 2016 1 次提交
  10. 26 4月, 2016 1 次提交
    • J
      skd: remove broken discard support · 49bdedb3
      Jeff Moyer 提交于
      Simply creating a file system on an skd device, followed by mount and
      fstrim will result in errors in the logs and then a BUG().  Let's remove
      discard support from that driver.  As far as I can tell, it hasn't
      worked right since it was merged.  This patch also has a side-effect of
      cleaning up an unintentional shadowed declaration inside of
      skd_end_request.
      
      I tested to ensure that I can still do I/O to the device using xfstests
      ./check -g quick.  I didn't do anything more extensive than that,
      though.
      Signed-off-by: NJeff Moyer <jmoyer@redhat.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      49bdedb3
  11. 13 4月, 2016 2 次提交
  12. 17 7月, 2015 1 次提交
  13. 05 10月, 2014 1 次提交
    • M
      block: disable entropy contributions for nonrot devices · b277da0a
      Mike Snitzer 提交于
      Clear QUEUE_FLAG_ADD_RANDOM in all block drivers that set
      QUEUE_FLAG_NONROT.
      
      Historically, all block devices have automatically made entropy
      contributions.  But as previously stated in commit e2e1a148 ("block: add
      sysfs knob for turning off disk entropy contributions"):
          - On SSD disks, the completion times aren't as random as they
            are for rotational drives. So it's questionable whether they
            should contribute to the random pool in the first place.
          - Calling add_disk_randomness() has a lot of overhead.
      
      There are more reliable sources for randomness than non-rotational block
      devices.  From a security perspective it is better to err on the side of
      caution than to allow entropy contributions from unreliable "random"
      sources.
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      b277da0a
  14. 13 8月, 2014 1 次提交
  15. 09 8月, 2014 1 次提交
  16. 22 4月, 2014 1 次提交
  17. 17 4月, 2014 1 次提交
  18. 16 4月, 2014 1 次提交
    • J
      block: remove struct request buffer member · b4f42e28
      Jens Axboe 提交于
      This was used in the olden days, back when onions were proper
      yellow. Basically it mapped to the current buffer to be
      transferred. With highmem being added more than a decade ago,
      most drivers map pages out of a bio, and rq->buffer isn't
      pointing at anything valid.
      
      Convert old style drivers to just use bio_data().
      
      For the discard payload use case, just reference the page
      in the bio.
      Signed-off-by: NJens Axboe <axboe@fb.com>
      b4f42e28
  19. 22 2月, 2014 4 次提交
  20. 19 12月, 2013 1 次提交
  21. 09 11月, 2013 13 次提交