linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] md:array cannot be opened again after 'md_set_readonly'
@ 2017-03-27  7:52 Zhilong Liu
  2017-03-27 18:22 ` Shaohua Li
  2017-03-28 21:13 ` NeilBrown
  0 siblings, 2 replies; 6+ messages in thread
From: Zhilong Liu @ 2017-03-27  7:52 UTC (permalink / raw)
  To: neilb, shli; +Cc: linux-raid, Zhilong Liu, Guoqing Jiang

This is a bug about array cannot be opened again after 'md_set_readonly',
because the MD_CLOSING bit is still waiting for clear.
MD_CLOSING should only be set for a short period or time to avoid certain
races. After the operation that set it completes, it should be cleared.

Reviewed-by: NeilBrown <neilb@suse.com>
Cc: Guoqing Jiang <gqjiang@suse.com>
Signed-off-by: Zhilong Liu <zlliu@suse.com>
---
 drivers/md/md.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/md/md.c b/drivers/md/md.c
index f6ae1d6..7f2db7c 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -5588,6 +5588,7 @@ static int md_set_readonly(struct mddev *mddev, struct block_device *bdev)
 	int err = 0;
 	int did_freeze = 0;
 
+	test_and_clear_bit(MD_CLOSING, &mddev->flags);
 	if (!test_bit(MD_RECOVERY_FROZEN, &mddev->recovery)) {
 		did_freeze = 1;
 		set_bit(MD_RECOVERY_FROZEN, &mddev->recovery);
-- 
2.6.6


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-28 21:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-27  7:52 [PATCH] md:array cannot be opened again after 'md_set_readonly' Zhilong Liu
2017-03-27 18:22 ` Shaohua Li
2017-03-28 13:19   ` Zhilong Liu
2017-03-28 16:12     ` Shaohua Li
2017-03-28 21:18     ` NeilBrown
2017-03-28 21:13 ` NeilBrown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).