mdadm/r5cache: allow adding journal to array without journal

Currently, --add-journal can be only used to recreate broken journal
for arrays with journal since  creation. As the kernel code getting
more mature, this constraint is no longer necessary.

This patch allows --add-journal to add journal to array without
journal.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Song Liu 2017-03-28 11:04:44 -07:00 committed by Jes Sorensen
parent 795bd44ed1
commit 3373d49f32
2 changed files with 2 additions and 9 deletions

View File

@ -911,7 +911,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
/* only add journal to array that supports journaling */ /* only add journal to array that supports journaling */
if (dv->disposition == 'j') { if (dv->disposition == 'j') {
struct mdinfo mdi;
struct mdinfo *mdp; struct mdinfo *mdp;
mdp = sysfs_read(fd, NULL, GET_ARRAY_STATE); mdp = sysfs_read(fd, NULL, GET_ARRAY_STATE);
@ -928,11 +927,6 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
sysfs_free(mdp); 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; disc.raid_disk = 0;
} }

View File

@ -1526,9 +1526,8 @@ the device is found or <slot>:missing in case the device is not found.
.TP .TP
.BR \-\-add-journal .BR \-\-add-journal
Recreate journal for RAID-4/5/6 array that lost a journal device. In the Add journal to an existing array, or recreate journal for RAID-4/5/6 array
current implementation, this command cannot add a journal to an array that lost a journal device. To avoid interrupting on-going write opertions,
that had a failed journal. To avoid interrupting on-going write opertions,
.B \-\-add-journal .B \-\-add-journal
only works for array in Read-Only state. only works for array in Read-Only state.