1. 24 Apr, 2017 31 commits
  2. 23 Apr, 2017 6 commits
  3. 21 Apr, 2017 3 commits
    • Dan Carpenter's avatar
      lightnvm: don't print a warning for ADDR_EMPTY · 659226eb
      Dan Carpenter authored
      Reading from ADDR_EMPTY is out of bounds.  The current code generates a
      static checker warning because we check for out of bounds "lba" before
      we check for ADDR_EMPTY, so the second check is always false.  It looks
      like we intended ADDR_EMPTY to be a no-op without printing a warning.
      
      Fixes: a4bd217b ("lightnvm: physical block device (pblk) target")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarJavier González <javier@cnexlabs.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      659226eb
    • Dan Carpenter's avatar
      lightnvm: potential underflow in pblk_read_rq() · 5bf1e1ee
      Dan Carpenter authored
      This is a static checker fix, and perhaps not a real bug.  The static
      checker thinks that nr_secs could be negative.  It would result in
      zeroing more memory than intended.  Anyway, even if it's not a bug,
      changing this variable to unsigned makes the code easier to audit.
      
      Fixes: a4bd217b ("lightnvm: physical block device (pblk) target")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Reviewed-by: default avatarJavier González <javier@cnexlabs.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      5bf1e1ee
    • Ilya Dryomov's avatar
      block: get rid of blk_integrity_revalidate() · 19b7ccf8
      Ilya Dryomov authored
      Commit 25520d55 ("block: Inline blk_integrity in struct gendisk")
      introduced blk_integrity_revalidate(), which seems to assume ownership
      of the stable pages flag and unilaterally clears it if no blk_integrity
      profile is registered:
      
          if (bi->profile)
                  disk->queue->backing_dev_info->capabilities |=
                          BDI_CAP_STABLE_WRITES;
          else
                  disk->queue->backing_dev_info->capabilities &=
                          ~BDI_CAP_STABLE_WRITES;
      
      It's called from revalidate_disk() and rescan_partitions(), making it
      impossible to enable stable pages for drivers that support partitions
      and don't use blk_integrity: while the call in revalidate_disk() can be
      trivially worked around (see zram, which doesn't support partitions and
      hence gets away with zram_revalidate_disk()), rescan_partitions() can
      be triggered from userspace at any time.  This breaks rbd, where the
      ceph messenger is responsible for generating/verifying CRCs.
      
      Since blk_integrity_{un,}register() "must" be used for (un)registering
      the integrity profile with the block layer, move BDI_CAP_STABLE_WRITES
      setting there.  This way drivers that call blk_integrity_register() and
      use integrity infrastructure won't interfere with drivers that don't
      but still want stable pages.
      
      Fixes: 25520d55 ("block: Inline blk_integrity in struct gendisk")
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org # 4.4+, needs backporting
      Tested-by: default avatarDan Williams <dan.j.williams@intel.com>
      Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      19b7ccf8