Skip to content

Commit

Permalink
md/raid5: STRIPE_ACTIVE has lock semantics, add barriers
Browse files Browse the repository at this point in the history
All updates that occur under STRIPE_ACTIVE should be globally visible
when STRIPE_ACTIVE clears.  test_and_set_bit() implies a barrier, but
clear_bit() does not.

This is suitable for 3.1-stable.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Cc: stable@kernel.org
  • Loading branch information
Dan Williams authored and NeilBrown committed Nov 8, 2011
1 parent 9a3f530 commit 257a4b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/md/raid5.c
Original file line number Diff line number Diff line change
Expand Up @@ -3110,7 +3110,7 @@ static void handle_stripe(struct stripe_head *sh)
struct r5dev *pdev, *qdev;

clear_bit(STRIPE_HANDLE, &sh->state);
if (test_and_set_bit(STRIPE_ACTIVE, &sh->state)) {
if (test_and_set_bit_lock(STRIPE_ACTIVE, &sh->state)) {
/* already being handled, ensure it gets handled
* again when current action finishes */
set_bit(STRIPE_HANDLE, &sh->state);
Expand Down Expand Up @@ -3375,7 +3375,7 @@ static void handle_stripe(struct stripe_head *sh)

return_io(s.return_bi);

clear_bit(STRIPE_ACTIVE, &sh->state);
clear_bit_unlock(STRIPE_ACTIVE, &sh->state);
}

static void raid5_activate_delayed(struct r5conf *conf)
Expand Down

0 comments on commit 257a4b4

Please sign in to comment.