1. 13 10月, 2017 2 次提交
    • R
      lightnvm: prevent bd removal if busy · bb6aa6f0
      Rakesh Pandit 提交于
      When a virtual block device is formatted and mounted after creating
      with "nvme lnvm create... -t pblk", a removal from "nvm lnvm remove"
      would result in this:
      
      446416.309757] bdi-block not registered
      [446416.309773] ------------[ cut here ]------------
      [446416.309780] WARNING: CPU: 3 PID: 4319 at fs/fs-writeback.c:2159
        __mark_inode_dirty+0x268/0x340
      
      Ideally removal should return -EBUSY as block device is mounted after
      formatting.  This patch tries to address this checking if whole device
      or any partition of it already mounted or not before removal.
      
      Whole device is checked using "bd_super" member of block device.  This
      member is always set once block device has been mounted using a
      filesystem.  Another member "bd_part_count" takes care of checking any
      if any partitions are under use.  "bd_part_count" is only updated
      under locks when partitions are opened or closed (first open and last
      release).  This at least does take care sending -EBUSY if removal is
      being attempted while whole block device or any partition is mounted.
      Signed-off-by: NRakesh Pandit <rakesh@tuxera.com>
      Reviewed-by: NJavier González <javier@cnexlabs.com>
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      bb6aa6f0
    • R
      lightnvm: prevent target type module removal when in use · 90014829
      Rakesh Pandit 提交于
      If target type module e.g. pblk here is unloaded (rmmod) while module
      is in use (after creating target) system crashes.  We fix this by
      using module API refcnt.
      Signed-off-by: NRakesh Pandit <rakesh@tuxera.com>
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      90014829
  2. 27 6月, 2017 2 次提交
  3. 04 5月, 2017 1 次提交
  4. 22 4月, 2017 1 次提交
  5. 20 4月, 2017 1 次提交
    • 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
  6. 17 4月, 2017 8 次提交
  7. 15 2月, 2017 2 次提交
  8. 31 1月, 2017 10 次提交
  9. 30 11月, 2016 11 次提交
  10. 10 11月, 2016 1 次提交
    • P
      lightnvm: make core.c explicitly non-modular · 389b2a1c
      Paul Gortmaker 提交于
      The Kconfig currently controlling compilation of this code is:
      
      drivers/lightnvm/Kconfig:menuconfig NVM
      drivers/lightnvm/Kconfig:       bool "Open-Channel SSD target support"
      
      ...meaning that it currently is not being built as a module by anyone.
      
      Lets remove the modular code that is essentially orphaned, so that
      when reading the driver there is no doubt it is builtin-only.
      
      Since module_misc_driver translates to device_initcall in the non-modular
      case, the init ordering remains unchanged with this commit.
      
      We also delete the MODULE_LICENSE tag etc. since all that information
      is already contained at the top of the file in the comments.
      
      We replace module.h with moduleparam.h because this file still uses
      module params to control behaviour.
      
      Also note that MODULE_ALIAS is a no-op for non-modular code.
      
      Cc: Matias Bjorling <mb@lightnvm.io>
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      389b2a1c
  11. 21 9月, 2016 1 次提交
    • S
      lightnvm: expose device geometry through sysfs · 40267efd
      Simon A. F. Lund 提交于
      For a host to access an Open-Channel SSD, it has to know its geometry,
      so that it writes and reads at the appropriate device bounds.
      
      Currently, the geometry information is kept within the kernel, and not
      exported to user-space for consumption. This patch exposes the
      configuration through sysfs and enables user-space libraries, such as
      liblightnvm, to use the sysfs implementation to get the geometry of an
      Open-Channel SSD.
      
      The sysfs entries are stored within the device hierarchy, and can be
      found using the "lightnvm" device type.
      
      An example configuration looks like this:
      
      /sys/class/nvme/
      └── nvme0n1
         ├── capabilities: 3
         ├── device_mode: 1
         ├── erase_max: 1000000
         ├── erase_typ: 1000000
         ├── flash_media_type: 0
         ├── media_capabilities: 0x00000001
         ├── media_type: 0
         ├── multiplane: 0x00010101
         ├── num_blocks: 1022
         ├── num_channels: 1
         ├── num_luns: 4
         ├── num_pages: 64
         ├── num_planes: 1
         ├── page_size: 4096
         ├── prog_max: 100000
         ├── prog_typ: 100000
         ├── read_max: 10000
         ├── read_typ: 10000
         ├── sector_oob_size: 0
         ├── sector_size: 4096
         ├── media_manager: gennvm
         ├── ppa_format: 0x380830082808001010102008
         ├── vendor_opcode: 0
         ├── max_phys_secs: 64
         └── version: 1
      Signed-off-by: NSimon A. F. Lund <slund@cnexlabs.com>
      Signed-off-by: NMatias Bjørling <m@bjorling.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      40267efd