Skip to content

Commit

Permalink
Merge tag 'md/3.19-fixes' of git://neil.brown.name/md
Browse files Browse the repository at this point in the history
Pull two fixes for md from Neil Brown:

 - Another live lock, needs backporting

 - work-around false positive with new warnings.

* tag 'md/3.19-fixes' of git://neil.brown.name/md:
  md/bitmap: fix a might_sleep() warning.
  md/raid5: fix another livelock caused by non-aligned writes.
  • Loading branch information
Linus Torvalds committed Feb 4, 2015
2 parents 0f98c38 + d959014 commit 59acf65
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ __acquires(bitmap->lock)
/* this page has not been allocated yet */

spin_unlock_irq(&bitmap->lock);
/* It is possible that this is being called inside a
* prepare_to_wait/finish_wait loop from raid5c:make_request().
* In general it is not permitted to sleep in that context as it
* can cause the loop to spin freely.
* That doesn't apply here as we can only reach this point
* once with any loop.
* When this function completes, either bp[page].map or
* bp[page].hijacked. In either case, this function will
* abort before getting to this point again. So there is
* no risk of a free-spin, and so it is safe to assert
* that sleeping here is allowed.
*/
sched_annotate_sleep();
mappage = kzalloc(PAGE_SIZE, GFP_NOIO);
spin_lock_irq(&bitmap->lock);

Expand Down
5 changes: 5 additions & 0 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -3195,6 +3195,11 @@ static void handle_stripe_dirtying(struct r5conf *conf,
(unsigned long long)sh->sector,
rcw, qread, test_bit(STRIPE_DELAYED, &sh->state));
}

if (rcw > disks && rmw > disks &&
!test_bit(STRIPE_PREREAD_ACTIVE, &sh->state))
set_bit(STRIPE_DELAYED, &sh->state);

/* now if nothing is locked, and if we have enough data,
* we can start a write request
*/
Expand Down

0 comments on commit 59acf65

Please sign in to comment.