1. 14 8月, 2015 1 次提交
    • K
      block: kill merge_bvec_fn() completely · 8ae12666
      Kent Overstreet 提交于
      As generic_make_request() is now able to handle arbitrarily sized bios,
      it's no longer necessary for each individual block driver to define its
      own ->merge_bvec_fn() callback. Remove every invocation completely.
      
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Lars Ellenberg <drbd-dev@lists.linbit.com>
      Cc: drbd-user@lists.linbit.com
      Cc: Jiri Kosina <jkosina@suse.cz>
      Cc: Yehuda Sadeh <yehuda@inktank.com>
      Cc: Sage Weil <sage@inktank.com>
      Cc: Alex Elder <elder@kernel.org>
      Cc: ceph-devel@vger.kernel.org
      Cc: Alasdair Kergon <agk@redhat.com>
      Cc: Mike Snitzer <snitzer@redhat.com>
      Cc: dm-devel@redhat.com
      Cc: Neil Brown <neilb@suse.de>
      Cc: linux-raid@vger.kernel.org
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Acked-by: NeilBrown <neilb@suse.de> (for the 'md' bits)
      Acked-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NKent Overstreet <kent.overstreet@gmail.com>
      [dpark: also remove ->merge_bvec_fn() in dm-thin as well as
       dm-era-target, and resolve merge conflicts]
      Signed-off-by: NDongsu Park <dpark@posteo.net>
      Signed-off-by: NMing Lin <ming.l@ssi.samsung.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      8ae12666
  2. 29 7月, 2015 1 次提交
    • C
      block: add a bi_error field to struct bio · 4246a0b6
      Christoph Hellwig 提交于
      Currently we have two different ways to signal an I/O error on a BIO:
      
       (1) by clearing the BIO_UPTODATE flag
       (2) by returning a Linux errno value to the bi_end_io callback
      
      The first one has the drawback of only communicating a single possible
      error (-EIO), and the second one has the drawback of not beeing persistent
      when bios are queued up, and are not passed along from child to parent
      bio in the ever more popular chaining scenario.  Having both mechanisms
      available has the additional drawback of utterly confusing driver authors
      and introducing bugs where various I/O submitters only deal with one of
      them, and the others have to add boilerplate code to deal with both kinds
      of error returns.
      
      So add a new bi_error field to store an errno value directly in struct
      bio and remove the existing mechanisms to clean all this up.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NHannes Reinecke <hare@suse.de>
      Reviewed-by: NNeilBrown <neilb@suse.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      4246a0b6
  3. 12 6月, 2015 4 次提交
  4. 30 5月, 2015 7 次提交
  5. 22 5月, 2015 1 次提交
    • M
      block: remove management of bi_remaining when restoring original bi_end_io · 326e1dbb
      Mike Snitzer 提交于
      Commit c4cf5261 ("bio: skip atomic inc/dec of ->bi_remaining for
      non-chains") regressed all existing callers that followed this pattern:
       1) saving a bio's original bi_end_io
       2) wiring up an intermediate bi_end_io
       3) restoring the original bi_end_io from intermediate bi_end_io
       4) calling bio_endio() to execute the restored original bi_end_io
      
      The regression was due to BIO_CHAIN only ever getting set if
      bio_inc_remaining() is called.  For the above pattern it isn't set until
      step 3 above (step 2 would've needed to establish BIO_CHAIN).  As such
      the first bio_endio(), in step 2 above, never decremented __bi_remaining
      before calling the intermediate bi_end_io -- leaving __bi_remaining with
      the value 1 instead of 0.  When bio_inc_remaining() occurred during step
      3 it brought it to a value of 2.  When the second bio_endio() was
      called, in step 4 above, it should've called the original bi_end_io but
      it didn't because there was an extra reference that wasn't dropped (due
      to atomic operations being optimized away since BIO_CHAIN wasn't set
      upfront).
      
      Fix this issue by removing the __bi_remaining management complexity for
      all callers that use the above pattern -- bio_chain() is the only
      interface that _needs_ to be concerned with __bi_remaining.  For the
      above pattern callers just expect the bi_end_io they set to get called!
      Remove bio_endio_nodec() and also remove all bio_inc_remaining() calls
      that aren't associated with the bio_chain() interface.
      
      Also, the bio_inc_remaining() interface has been moved local to bio.c.
      
      Fixes: c4cf5261 ("bio: skip atomic inc/dec of ->bi_remaining for non-chains")
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Reviewed-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NJens Axboe <axboe@fb.com>
      326e1dbb
  6. 06 5月, 2015 1 次提交
  7. 10 2月, 2015 1 次提交
  8. 24 1月, 2015 1 次提交
    • J
      dm cache: fix problematic dual use of a single migration count variable · a59db676
      Joe Thornber 提交于
      Introduce a new variable to count the number of allocated migration
      structures.  The existing variable cache->nr_migrations became
      overloaded.  It was used to:
      
       i) track of the number of migrations in flight for the purposes of
          quiescing during suspend.
      
       ii) to estimate the amount of background IO occuring.
      
      Recent discard changes meant that REQ_DISCARD bios are processed with
      a migration.  Discards are not background IO so nr_migrations was not
      incremented.  However this could cause quiescing to complete early.
      
      (i) is now handled with a new variable cache->nr_allocated_migrations.
      cache->nr_migrations has been renamed cache->nr_io_migrations.
      cleanup_migration() is now called free_io_migration(), since it
      decrements that variable.
      
      Also, remove the unused cache->next_migration variable that got replaced
      with with prealloc_structs a while ago.
      Signed-off-by: NJoe Thornber <ejt@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org
      a59db676
  9. 02 12月, 2014 7 次提交
  10. 13 11月, 2014 1 次提交
  11. 11 11月, 2014 5 次提交
  12. 10 9月, 2014 1 次提交
    • A
      dm cache: fix race causing dirty blocks to be marked as clean · 40aa978e
      Anssi Hannula 提交于
      When a writeback or a promotion of a block is completed, the cell of
      that block is removed from the prison, the block is marked as clean, and
      the clear_dirty() callback of the cache policy is called.
      
      Unfortunately, performing those actions in this order allows an incoming
      new write bio for that block to come in before clearing the dirty status
      is completed and therefore possibly causing one of these two scenarios:
      
      Scenario A:
      
      Thread 1                      Thread 2
      cell_defer()                  .
      - cell removed from prison    .
      - detained bios queued        .
      .                             incoming write bio
      .                             remapped to cache
      .                             set_dirty() called,
      .                               but block already dirty
      .                               => it does nothing
      clear_dirty()                 .
      - block marked clean          .
      - policy clear_dirty() called .
      
      Result: Block is marked clean even though it is actually dirty. No
      writeback will occur.
      
      Scenario B:
      
      Thread 1                      Thread 2
      cell_defer()                  .
      - cell removed from prison    .
      - detained bios queued        .
      clear_dirty()                 .
      - block marked clean          .
      .                             incoming write bio
      .                             remapped to cache
      .                             set_dirty() called
      .                             - block marked dirty
      .                             - policy set_dirty() called
      - policy clear_dirty() called .
      
      Result: Block is properly marked as dirty, but policy thinks it is clean
      and therefore never asks us to writeback it.
      This case is visible in "dmsetup status" dirty block count (which
      normally decreases to 0 on a quiet device).
      
      Fix these issues by calling clear_dirty() before calling cell_defer().
      Incoming bios for that block will then be detained in the cell and
      released only after clear_dirty() has completed, so the race will not
      occur.
      
      Found by inspecting the code after noticing spurious dirty counts
      (scenario B).
      Signed-off-by: NAnssi Hannula <anssi.hannula@iki.fi>
      Acked-by: NJoe Thornber <ejt@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org
      40aa978e
  13. 02 8月, 2014 5 次提交
  14. 27 5月, 2014 1 次提交
  15. 02 5月, 2014 1 次提交
  16. 05 4月, 2014 1 次提交
    • J
      dm cache: fix a lock-inversion · 0596661f
      Joe Thornber 提交于
      When suspending a cache the policy is walked and the individual policy
      hints written to the metadata via sync_metadata().  This led to this
      lock order:
      
            policy->lock
              cache_metadata->root_lock
      
      When loading the cache target the policy is populated while the metadata
      lock is held:
      
            cache_metadata->root_lock
               policy->lock
      
      Fix this potential lock-inversion (ABBA) deadlock in sync_metadata() by
      ensuring the cache_metadata root_lock is held whilst all the hints are
      written, rather than being repeatedly locked while policy->lock is held
      (as was the case with each callout that policy_walk_mappings() made to
      the old save_hint() method).
      
      Found by turning on the CONFIG_PROVE_LOCKING ("Lock debugging: prove
      locking correctness") build option.  However, it is not clear how the
      LOCKDEP reported paths can lead to a deadlock since the two paths,
      suspending a target and loading a target, never occur at the same time.
      But that doesn't mean the same lock-inversion couldn't have occurred
      elsewhere.
      Reported-by: NMarian Csontos <mcsontos@redhat.com>
      Signed-off-by: NJoe Thornber <ejt@redhat.com>
      Signed-off-by: NMike Snitzer <snitzer@redhat.com>
      Cc: stable@vger.kernel.org
      0596661f
  17. 28 3月, 2014 1 次提交