1. 28 1月, 2017 2 次提交
  2. 09 12月, 2016 1 次提交
  3. 21 11月, 2016 1 次提交
  4. 15 11月, 2016 1 次提交
  5. 03 11月, 2016 5 次提交
    • B
      dm: Fix a race condition related to stopping and starting queues · 7b17c2f7
      Bart Van Assche 提交于
      Ensure that all ongoing dm_mq_queue_rq() and dm_mq_requeue_request()
      calls have stopped before setting the "queue stopped" flag. This
      allows to remove the "queue stopped" test from dm_mq_queue_rq() and
      dm_mq_requeue_request(). This patch fixes a race condition because
      dm_mq_queue_rq() is called without holding the queue lock and hence
      BLK_MQ_S_STOPPED can be set at any time while dm_mq_queue_rq() is
      in progress. This patch prevents that the following hang occurs
      sporadically when using dm-mq:
      
      INFO: task systemd-udevd:10111 blocked for more than 480 seconds.
      Call Trace:
       [<ffffffff8161f397>] schedule+0x37/0x90
       [<ffffffff816239ef>] schedule_timeout+0x27f/0x470
       [<ffffffff8161e76f>] io_schedule_timeout+0x9f/0x110
       [<ffffffff8161fb36>] bit_wait_io+0x16/0x60
       [<ffffffff8161f929>] __wait_on_bit_lock+0x49/0xa0
       [<ffffffff8114fe69>] __lock_page+0xb9/0xc0
       [<ffffffff81165d90>] truncate_inode_pages_range+0x3e0/0x760
       [<ffffffff81166120>] truncate_inode_pages+0x10/0x20
       [<ffffffff81212a20>] kill_bdev+0x30/0x40
       [<ffffffff81213d41>] __blkdev_put+0x71/0x360
       [<ffffffff81214079>] blkdev_put+0x49/0x170
       [<ffffffff812141c0>] blkdev_close+0x20/0x30
       [<ffffffff811d48e8>] __fput+0xe8/0x1f0
       [<ffffffff811d4a29>] ____fput+0x9/0x10
       [<ffffffff810842d3>] task_work_run+0x83/0xb0
       [<ffffffff8106606e>] do_exit+0x3ee/0xc40
       [<ffffffff8106694b>] do_group_exit+0x4b/0xc0
       [<ffffffff81073d9a>] get_signal+0x2ca/0x940
       [<ffffffff8101bf43>] do_signal+0x23/0x660
       [<ffffffff810022b3>] exit_to_usermode_loop+0x73/0xb0
       [<ffffffff81002cb0>] syscall_return_slowpath+0xb0/0xc0
       [<ffffffff81624e33>] entry_SYSCALL_64_fastpath+0xa6/0xa8
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Acked-by: NMike Snitzer <snitzer@redhat.com>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      7b17c2f7
    • B
      dm: Use BLK_MQ_S_STOPPED instead of QUEUE_FLAG_STOPPED in blk-mq code · f0d33ab7
      Bart Van Assche 提交于
      Instead of manipulating both QUEUE_FLAG_STOPPED and BLK_MQ_S_STOPPED
      in the dm start and stop queue functions, only manipulate the latter
      flag. Change blk_queue_stopped() tests into blk_mq_queue_stopped().
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Acked-by: NMike Snitzer <snitzer@redhat.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.com>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      f0d33ab7
    • B
      blk-mq: Add a kick_requeue_list argument to blk_mq_requeue_request() · 2b053aca
      Bart Van Assche 提交于
      Most blk_mq_requeue_request() and blk_mq_add_to_requeue_list() calls
      are followed by kicking the requeue list. Hence add an argument to
      these two functions that allows to kick the requeue list. This was
      proposed by Christoph Hellwig.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Cc: Hannes Reinecke <hare@suse.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      2b053aca
    • B
      blk-mq: Remove blk_mq_cancel_requeue_work() · 9b7dd572
      Bart Van Assche 提交于
      Since blk_mq_requeue_work() no longer restarts stopped queues
      canceling requeue work is no longer needed to prevent that a
      stopped queue would be restarted. Hence remove this function.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: Keith Busch <keith.busch@intel.com>
      Cc: Hannes Reinecke <hare@suse.com>
      Cc: Johannes Thumshirn <jthumshirn@suse.de>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      9b7dd572
    • B
      blk-mq: Avoid that requeueing starts stopped queues · 52d7f1b5
      Bart Van Assche 提交于
      Since blk_mq_requeue_work() starts stopped queues and since
      execution of this function can be scheduled after a queue has
      been stopped it is not possible to stop queues without using
      an additional state variable to track whether or not the queue
      has been stopped. Hence modify blk_mq_requeue_work() such that it
      does not start stopped queues. My conclusion after a review of
      the blk_mq_stop_hw_queues() and blk_mq_{delay_,}kick_requeue_list()
      callers is as follows:
      * In the dm driver starting and stopping queues should only happen
        if __dm_suspend() or __dm_resume() is called and not if the
        requeue list is processed.
      * In the SCSI core queue stopping and starting should only be
        performed by the scsi_internal_device_block() and
        scsi_internal_device_unblock() functions but not by any other
        function. Although the blk_mq_stop_hw_queue() call in
        scsi_queue_rq() may help to reduce CPU load if a LLD queue is
        full, figuring out whether or not a queue should be restarted
        when requeueing a command would require to introduce additional
        locking in scsi_mq_requeue_cmd() to avoid a race with
        scsi_internal_device_block(). Avoid this complexity by removing
        the blk_mq_stop_hw_queue() call from scsi_queue_rq().
      * In the NVMe core only the functions that call
        blk_mq_start_stopped_hw_queues() explicitly should start stopped
        queues.
      * A blk_mq_start_stopped_hwqueues() call must be added in the
        xen-blkfront driver in its blkif_recover() function.
      Signed-off-by: NBart Van Assche <bart.vanassche@sandisk.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Roger Pau Monné <roger.pau@citrix.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: James Bottomley <jejb@linux.vnet.ibm.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NSagi Grimberg <sagi@grimberg.me>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      52d7f1b5
  6. 28 10月, 2016 1 次提交
  7. 19 10月, 2016 1 次提交
  8. 12 10月, 2016 1 次提交
    • P
      kthread: kthread worker API cleanup · 3989144f
      Petr Mladek 提交于
      A good practice is to prefix the names of functions by the name
      of the subsystem.
      
      The kthread worker API is a mix of classic kthreads and workqueues.  Each
      worker has a dedicated kthread.  It runs a generic function that process
      queued works.  It is implemented as part of the kthread subsystem.
      
      This patch renames the existing kthread worker API to use
      the corresponding name from the workqueues API prefixed by
      kthread_:
      
      __init_kthread_worker()		-> __kthread_init_worker()
      init_kthread_worker()		-> kthread_init_worker()
      init_kthread_work()		-> kthread_init_work()
      insert_kthread_work()		-> kthread_insert_work()
      queue_kthread_work()		-> kthread_queue_work()
      flush_kthread_work()		-> kthread_flush_work()
      flush_kthread_worker()		-> kthread_flush_worker()
      
      Note that the names of DEFINE_KTHREAD_WORK*() macros stay
      as they are. It is common that the "DEFINE_" prefix has
      precedence over the subsystem names.
      
      Note that INIT() macros and init() functions use different
      naming scheme. There is no good solution. There are several
      reasons for this solution:
      
        + "init" in the function names stands for the verb "initialize"
          aka "initialize worker". While "INIT" in the macro names
          stands for the noun "INITIALIZER" aka "worker initializer".
      
        + INIT() macros are used only in DEFINE() macros
      
        + init() functions are used close to the other kthread()
          functions. It looks much better if all the functions
          use the same scheme.
      
        + There will be also kthread_destroy_worker() that will
          be used close to kthread_cancel_work(). It is related
          to the init() function. Again it looks better if all
          functions use the same naming scheme.
      
        + there are several precedents for such init() function
          names, e.g. amd_iommu_init_device(), free_area_init_node(),
          jump_label_init_type(),  regmap_init_mmio_clk(),
      
        + It is not an argument but it was inconsistent even before.
      
      [arnd@arndb.de: fix linux-next merge conflict]
       Link: http://lkml.kernel.org/r/20160908135724.1311726-1-arnd@arndb.de
      Link: http://lkml.kernel.org/r/1470754545-17632-3-git-send-email-pmladek@suse.comSuggested-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NPetr Mladek <pmladek@suse.com>
      Cc: Oleg Nesterov <oleg@redhat.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Michal Hocko <mhocko@suse.cz>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3989144f
  9. 21 9月, 2016 1 次提交
  10. 15 9月, 2016 7 次提交
  11. 03 8月, 2016 1 次提交
    • M
      dm rq: fix the starting and stopping of blk-mq queues · 7d9595d8
      Mike Snitzer 提交于
      Improve dm_stop_queue() to cancel any requeue_work.  Also, have
      dm_start_queue() and dm_stop_queue() clear/set the QUEUE_FLAG_STOPPED
      for the blk-mq request_queue.
      
      On suspend dm_stop_queue() handles stopping the blk-mq request_queue
      BUT: even though the hw_queues are marked BLK_MQ_S_STOPPED at that point
      there is still a race that is allowing block/blk-mq.c to call ->queue_rq
      against a hctx that it really shouldn't.  Add a check to
      dm_mq_queue_rq() that guards against this rarity (albeit _not_
      race-free).
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org # must patch dm.c on < 4.8 kernels
      7d9595d8
  12. 19 7月, 2016 1 次提交
  13. 06 7月, 2016 1 次提交
  14. 11 6月, 2016 2 次提交
    • M
      dm mpath: add optional "queue_mode" feature · e83068a5
      Mike Snitzer 提交于
      Allow a user to specify an optional feature 'queue_mode <mode>' where
      <mode> may be "bio", "rq" or "mq" -- which corresponds to bio-based,
      request_fn rq-based, and blk-mq rq-based respectively.
      
      If the queue_mode feature isn't specified the default for the
      "multipath" target is still "rq" but if dm_mod.use_blk_mq is set to Y
      it'll default to mode "mq".
      
      This new queue_mode feature introduces the ability for each multipath
      device to have its own queue_mode (whereas before this feature all
      multipath devices effectively had to have the same queue_mode).
      
      This commit also goes a long way to eliminate the awkward (ab)use of
      DM_TYPE_*, the associated filter_md_type() and other relatively fragile
      and difficult to maintain code.
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      e83068a5
    • M
      dm: move request-based code out to dm-rq.[hc] · 4cc96131
      Mike Snitzer 提交于
      Add some seperation between bio-based and request-based DM core code.
      
      'struct mapped_device' and other DM core only structures and functions
      have been moved to dm-core.h and all relevant DM core .c files have been
      updated to include dm-core.h rather than dm.h
      
      DM targets should _never_ include dm-core.h!
      
      [block core merge conflict resolution from Stephen Rothwell]
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      4cc96131