Linux RAID subsystem development
 help / color / mirror / Atom feed
From: Song Liu <songliubraving@fb.com>
To: linux-raid@vger.kernel.org
Cc: shli@fb.com, neilb@suse.com, kernel-team@fb.com,
	dan.j.williams@intel.com, hch@infradead.org,
	jes.sorensen@gmail.com, Song Liu <songliubraving@fb.com>
Subject: [PATCH v2 2/2] md/raid5: use consistency_policy to remove journal feature
Date: Thu, 16 Mar 2017 15:14:09 -0700	[thread overview]
Message-ID: <20170316221409.3283344-2-songliubraving@fb.com> (raw)
In-Reply-To: <20170316221409.3283344-1-songliubraving@fb.com>

When journal device of an array fails, the array is forced into read-only
mode. To make the array normal without adding another journal device, we
need to remove journal _feature_ from the array.

This patch allows remove journal _feature_ from an array, For journal
existing journal should be either missing or faulty.

To remove journal feature, one can simply echo into the sysfs file:

 cat /sys/block/md0/md/consistency_policy
 journal

 echo resync > /sys/block/md0/md/consistency_policy
 cat /sys/block/md0/md/consistency_policy
 resync

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 drivers/md/raid5.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 7a6e7ea..2302ec4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8369,11 +8369,19 @@ static int raid5_change_consistency_policy(struct mddev *mddev, const char *buf)
 		if (!err)
 			raid5_reset_stripe_cache(mddev);
 		mddev_resume(mddev);
-	} else if (strncmp(buf, "resync", 6) == 0 && raid5_has_ppl(conf)) {
-		mddev_suspend(mddev);
-		log_exit(conf);
-		raid5_reset_stripe_cache(mddev);
-		mddev_resume(mddev);
+	} else if (strncmp(buf, "resync", 6) == 0) {
+		if (raid5_has_ppl(conf)) {
+			mddev_suspend(mddev);
+			log_exit(conf);
+			raid5_reset_stripe_cache(mddev);
+			mddev_resume(mddev);
+		} else if (test_bit(MD_HAS_JOURNAL, &conf->mddev->flags) &&
+			   r5l_log_disk_error(conf)) {
+			mddev_suspend(mddev);
+			clear_bit(MD_HAS_JOURNAL, &mddev->flags);
+			mddev_resume(mddev);
+		} else
+			err = -EINVAL;
 	} else {
 		err = -EINVAL;
 	}
-- 
2.9.3


  reply	other threads:[~2017-03-16 22:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-16 22:14 [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Song Liu
2017-03-16 22:14 ` Song Liu [this message]
2017-03-24 14:48   ` [PATCH v2 2/2] md/raid5: use consistency_policy to remove journal feature Shaohua Li
2017-03-24 14:45 ` [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Shaohua Li
2017-03-24 15:17   ` Artur Paszkiewicz
2017-03-24 17:08     ` Shaohua Li

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170316221409.3283344-2-songliubraving@fb.com \
    --to=songliubraving@fb.com \
    --cc=dan.j.williams@intel.com \
    --cc=hch@infradead.org \
    --cc=jes.sorensen@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=neilb@suse.com \
    --cc=shli@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox