md/raid5: STRIPE_ACTIVE has lock semantics, add barriers
PATCH 1/1 md/raid5: STRIPE_ACTIVE has lock semantics, add barriers
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 at least was the guarantee we had with sh->lock...
drivers/md/raid5.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/md/raid5.c +2 -2
@@ -3116,7 +3116,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);
@@ -3377,7 +3377,7 @@ finish:return_io (s.return_bi); -clear_bit (STRIPE_ACTIVE , &sh->state); +clear_bit_unlock (STRIPE_ACTIVE , &sh->state); }static void raid5_activate_delayed (raid5_conf_t *conf)
Quoted 36 lines · On Wed, 03 Aug 2011 17:31:23 -0700 Dan Williams <[email protected]>…
All updates that occur under
STRIPE_ACTIVEshould be globally visible whenSTRIPE_ACTIVEclears.test_and_set_bit()implies a barrier, butclear_bit()does not.Signed-off-by Dan Williams <[email protected]>---
This at least was the guarantee we had with
sh->lock...drivers/md/raid5.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)drivers/md/raid5.c +2
-3@@ -3116,7 +3116,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);@@ -3377,7 +3377,7 @@ finish:return_io (s.return_bi); -clear_bit (STRIPE_ACTIVE , &sh->state); +clear_bit_unlock (STRIPE_ACTIVE , &sh->state); }static void raid5_activate_delayed (raid5_conf_t *conf) --
Quoted 3 lines
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
sorry for missing this before...
I makes perfect sense. I've applied it and should send it upstream shortly.
Thanks,
NeilBrown