All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] mdadm: remove journal with "remove-journal"
@ 2017-08-30 15:54 Larkin Lowrey
  2017-08-31 17:51 ` Song Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Larkin Lowrey @ 2017-08-30 15:54 UTC (permalink / raw)
  To: linux-raid

I don't see any evidence that either of these two patches made it to 
git. Is this the correct repo?

git.kernel.org/pub/scm/utils/mdadm/mdadm.git

--Larkin

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 1/2] mdadm/r5cache: allow adding journal to array without journal
@ 2017-03-15 18:28 Song Liu
  2017-03-15 18:28 ` [PATCH 2/2] mdadm: remove journal with "remove-journal" Song Liu
  0 siblings, 1 reply; 8+ messages in thread
From: Song Liu @ 2017-03-15 18:28 UTC (permalink / raw)
  To: linux-raid
  Cc: shli, neilb, kernel-team, dan.j.williams, hch, jes.sorensen, Song Liu

We use to apply constraints to --add-journal:
  1. We only support recreate journal for arrays with missing journal;
  2. The array need to be readonly when the journal is added.

As the kernel code getting more mature, these constraints are no longer
necessary. This patch removes this constraints from mdadm.

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 Manage.c   | 29 ++++-------------------------
 md_p.h     |  5 +++++
 mdadm.8.in |  7 ++-----
 3 files changed, 11 insertions(+), 30 deletions(-)

diff --git a/Manage.c b/Manage.c
index 5c3d2b9..289b7ce 100644
--- a/Manage.c
+++ b/Manage.c
@@ -946,28 +946,13 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
 
 	/* only add journal to array that supports journaling */
 	if (dv->disposition == 'j') {
-		struct mdinfo mdi;
-		struct mdinfo *mdp;
-
-		mdp = sysfs_read(fd, NULL, GET_ARRAY_STATE);
-		if (!mdp) {
-			pr_err("%s unable to read array state.\n", devname);
-			return -1;
-		}
-
-		if (strncmp(mdp->sysfs_array_state, "readonly", 8) != 0) {
-			sysfs_free(mdp);
-			pr_err("%s is not readonly, cannot add journal.\n", devname);
+		if ((array->state & (1<<MD_SB_HAS_JOURNAL)) &&
+		    !(array->state & (1<<MD_SB_JOURNAL_REMOVABLE))) {
+			pr_err("%s has a working journal. Hot spare journal device is not supported.\n",
+			       devname);
 			return -1;
 		}
 
-		sysfs_free(mdp);
-
-		tst->ss->getinfo_super(tst, &mdi, NULL);
-		if (mdi.journal_device_required == 0) {
-			pr_err("%s does not support journal device.\n", devname);
-			return -1;
-		}
 		disc.raid_disk = 0;
 	}
 
@@ -1097,12 +1082,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
 				       dv->devname, j, strerror(errno));
 			return -1;
 		}
-		if (dv->disposition == 'j') {
-			pr_err("Journal added successfully, making %s read-write\n", devname);
-			if (Manage_ro(devname, fd, -1))
-				pr_err("Failed to make %s read-write\n", devname);
-		}
-
 	}
 	if (verbose >= 0)
 		pr_err("added %s\n", dv->devname);
diff --git a/md_p.h b/md_p.h
index dc9fec1..7081bd9 100644
--- a/md_p.h
+++ b/md_p.h
@@ -121,6 +121,11 @@ typedef struct mdp_device_descriptor_s {
 				   * in container can be activated */
 #define MD_SB_CLUSTERED		5 /* MD is clustered  */
 #define	MD_SB_BITMAP_PRESENT	8 /* bitmap may be present nearby */
+#define	MD_SB_HAS_JOURNAL	9
+#define	MD_SB_JOURNAL_REMOVABLE	10 /* journal _feature_ can be removed,
+				    * which means the journal is either
+				    * missing or Faulty
+				    */
 
 typedef struct mdp_superblock_s {
 	/*
diff --git a/mdadm.8.in b/mdadm.8.in
index df1d460..087f679 100644
--- a/mdadm.8.in
+++ b/mdadm.8.in
@@ -1474,11 +1474,8 @@ the device is found or <slot>:missing in case the device is not found.
 
 .TP
 .BR \-\-add-journal
-Recreate journal for RAID-4/5/6 array that lost a journal device. In the
-current implementation, this command cannot add a journal to an array
-that had a failed journal. To avoid interrupting on-going write opertions,
-.B \-\-add-journal
-only works for array in Read-Only state.
+Add journal to an existing array, or recreate journal for RAID-4/5/6 array
+that lost a journal device.
 
 .TP
 .BR \-\-failfast
-- 
2.9.3


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

end of thread, other threads:[~2017-11-20 16:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30 15:54 [PATCH 2/2] mdadm: remove journal with "remove-journal" Larkin Lowrey
2017-08-31 17:51 ` Song Liu
2017-09-01 14:56   ` Larkin Lowrey
2017-11-16 17:35   ` Larkin Lowrey
2017-11-16 17:55     ` Song Liu
2017-11-20 16:04       ` Larkin Lowrey
  -- strict thread matches above, loose matches on Subject: below --
2017-03-15 18:28 [PATCH 1/2] mdadm/r5cache: allow adding journal to array without journal Song Liu
2017-03-15 18:28 ` [PATCH 2/2] mdadm: remove journal with "remove-journal" Song Liu
2017-03-17 19:39   ` jes.sorensen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.