1. 31 5月, 2018 1 次提交
  2. 25 5月, 2018 1 次提交
  3. 01 3月, 2018 1 次提交
    • B
      block: Fix a race between the cgroup code and request queue initialization · 498f6650
      Bart Van Assche 提交于
      Initialize the request queue lock earlier such that the following
      race can no longer occur:
      
      blk_init_queue_node()             blkcg_print_blkgs()
        blk_alloc_queue_node (1)
          q->queue_lock = &q->__queue_lock (2)
          blkcg_init_queue(q) (3)
                                          spin_lock_irq(blkg->q->queue_lock) (4)
        q->queue_lock = lock (5)
                                          spin_unlock_irq(blkg->q->queue_lock) (6)
      
      (1) allocate an uninitialized queue;
      (2) initialize queue_lock to its default internal lock;
      (3) initialize blkcg part of request queue, which will create blkg and
          then insert it to blkg_list;
      (4) traverse blkg_list and find the created blkg, and then take its
          queue lock, here it is the default *internal lock*;
      (5) *race window*, now queue_lock is overridden with *driver specified
          lock*;
      (6) now unlock *driver specified lock*, not the locked *internal lock*,
          unlock balance breaks.
      
      The changes in this patch are as follows:
      - Move the .queue_lock initialization from blk_init_queue_node() into
        blk_alloc_queue_node().
      - Only override the .queue_lock pointer for legacy queues because it
        is not useful for blk-mq queues to override this pointer.
      - For all all block drivers that initialize .queue_lock explicitly,
        change the blk_alloc_queue() call in the driver into a
        blk_alloc_queue_node() call and remove the explicit .queue_lock
        initialization. Additionally, initialize the spin lock that will
        be used as queue lock earlier if necessary.
      Reported-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Signed-off-by: NBart Van Assche <bart.vanassche@wdc.com>
      Reviewed-by: NJoseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Philipp Reisner <philipp.reisner@linbit.com>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      498f6650
  4. 03 12月, 2017 1 次提交
  5. 07 11月, 2017 1 次提交
    • K
      drbd: Convert timers to use timer_setup() · 2bccef39
      Kees Cook 提交于
      In preparation for unconditionally passing the struct timer_list pointer to
      all timer callbacks, switch to using the new timer_setup() and from_timer()
      to pass the timer pointer explicitly.
      
      Cc: Philipp Reisner <philipp.reisner@linbit.com>
      Cc: Lars Ellenberg <lars.ellenberg@linbit.com>
      Cc: drbd-dev@lists.linbit.com
      Signed-off-by: NKees Cook <keescook@chromium.org>
      2bccef39
  6. 30 8月, 2017 8 次提交
  7. 28 6月, 2017 1 次提交
  8. 19 6月, 2017 3 次提交
    • N
      drbd: use bio_clone_fast() instead of bio_clone() · 8cb0defb
      NeilBrown 提交于
      drbd does not modify the bi_io_vec of the cloned bio,
      so there is no need to clone that part.  So bio_clone_fast()
      is the better choice.
      For bio_clone_fast() we need to specify a bio_set.
      We could use fs_bio_set, which bio_clone() uses, or
      drbd_md_io_bio_set, which drbd uses for metadata, but it is
      generally best to avoid sharing bio_sets unless you can
      be certain that there are no interdependencies.
      
      So create a new bio_set, drbd_io_bio_set, and use bio_clone_fast().
      
      Also remove a "XXX cannot fail ???" comment because it definitely
      cannot fail - bio_clone_fast() doesn't fail if the GFP flags allow for
      sleeping.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      8cb0defb
    • N
      blk: make the bioset rescue_workqueue optional. · 47e0fb46
      NeilBrown 提交于
      This patch converts bioset_create() to not create a workqueue by
      default, so alloctions will never trigger punt_bios_to_rescuer().  It
      also introduces a new flag BIOSET_NEED_RESCUER which tells
      bioset_create() to preserve the old behavior.
      
      All callers of bioset_create() that are inside block device drivers,
      are given the BIOSET_NEED_RESCUER flag.
      
      biosets used by filesystems or other top-level users do not
      need rescuing as the bio can never be queued behind other
      bios.  This includes fs_bio_set, blkdev_dio_pool,
      btrfs_bioset, xfs_ioend_bioset, and one allocated by
      target_core_iblock.c.
      
      biosets used by md/raid do not need rescuing as
      their usage was recently audited and revised to never
      risk deadlock.
      
      It is hoped that most, if not all, of the remaining biosets
      can end up being the non-rescued version.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Credit-to: Ming Lei <ming.lei@redhat.com> (minor fixes)
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      47e0fb46
    • N
      blk: replace bioset_create_nobvec() with a flags arg to bioset_create() · 011067b0
      NeilBrown 提交于
      "flags" arguments are often seen as good API design as they allow
      easy extensibility.
      bioset_create_nobvec() is implemented internally as a variation in
      flags passed to __bioset_create().
      
      To support future extension, make the internal structure part of the
      API.
      i.e. add a 'flags' argument to bioset_create() and discard
      bioset_create_nobvec().
      
      Note that the bio_split allocations in drivers/md/raid* do not need
      the bvec mempool - they should have used bioset_create_nobvec().
      Suggested-by: NChristoph Hellwig <hch@infradead.org>
      Reviewed-by: NChristoph Hellwig <hch@infradead.org>
      Reviewed-by: NMing Lei <ming.lei@redhat.com>
      Signed-off-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NJens Axboe <axboe@kernel.dk>
      011067b0
  9. 28 5月, 2017 1 次提交
  10. 09 4月, 2017 2 次提交
  11. 02 3月, 2017 1 次提交
  12. 14 2月, 2017 1 次提交
  13. 02 2月, 2017 1 次提交
  14. 14 1月, 2017 1 次提交
  15. 27 12月, 2016 1 次提交
  16. 10 11月, 2016 1 次提交
  17. 08 8月, 2016 1 次提交
    • J
      block: rename bio bi_rw to bi_opf · 1eff9d32
      Jens Axboe 提交于
      Since commit 63a4cc24, bio->bi_rw contains flags in the lower
      portion and the op code in the higher portions. This means that
      old code that relies on manually setting bi_rw is most likely
      going to be broken. Instead of letting that brokeness linger,
      rename the member, to force old and out-of-tree code to break
      at compile time instead of at runtime.
      
      No intended functional changes in this commit.
      Signed-off-by: NJens Axboe <axboe@fb.com>
      1eff9d32
  18. 14 6月, 2016 5 次提交
  19. 08 6月, 2016 2 次提交
  20. 13 4月, 2016 1 次提交
  21. 27 1月, 2016 1 次提交
  22. 26 11月, 2015 4 次提交