* [PATCH 0/2] mdadm: minor fixes
@ 2024-10-18 8:22 Xiao Ni
0 siblings, 0 replies; 5+ messages in thread
From: Xiao Ni @ 2024-10-18 8:22 UTC (permalink / raw)
To: mariusz.tkaczyk; +Cc: linux-raid, ncroxon
Xiao Ni (2):
Clear superblock if adding new device fails
Check new_level interface rather than kernel version
Grow.c | 2 +-
Manage.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
--
2.32.0 (Apple Git-132)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 0/2] mdadm: minor fixes
@ 2024-10-18 8:48 Xiao Ni
2024-10-18 8:48 ` [PATCH V2 1/2] mdadm/Manage: Clear superblock if adding new device fails Xiao Ni
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Xiao Ni @ 2024-10-18 8:48 UTC (permalink / raw)
To: mariusz.tkaczyk; +Cc: linux-raid, ncroxon
Xiao Ni (2):
mdadm/Manage: Clear superblock if adding new device fails
mdadm/Grow: Check new_level interface rather than kernel version
Grow.c | 2 +-
Manage.c | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
--
2.32.0 (Apple Git-132)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V2 1/2] mdadm/Manage: Clear superblock if adding new device fails
2024-10-18 8:48 [PATCH 0/2] mdadm: minor fixes Xiao Ni
@ 2024-10-18 8:48 ` Xiao Ni
2024-10-18 8:48 ` [PATCH 2/2] mdadm/Grow: Check new_level interface rather than kernel version Xiao Ni
2024-10-18 12:51 ` [PATCH 0/2] mdadm: minor fixes Mariusz Tkaczyk
2 siblings, 0 replies; 5+ messages in thread
From: Xiao Ni @ 2024-10-18 8:48 UTC (permalink / raw)
To: mariusz.tkaczyk; +Cc: linux-raid, ncroxon
The superblock is kept if adding new device fails. It should clear the
superblock if it fails to add a new disk.
Signed-off-by: Xiao Ni <xni@redhat.com>
---
v2: change type of add_new_super to bool
Manage.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/Manage.c b/Manage.c
index 246ef3194aaa..8c58683b83c1 100644
--- a/Manage.c
+++ b/Manage.c
@@ -793,6 +793,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
int j;
mdu_disk_info_t disc;
struct map_ent *map = NULL;
+ bool add_new_super = false;
if (!get_dev_size(tfd, dv->devname, &ldsize)) {
if (dv->disposition == 'M')
@@ -1011,6 +1012,7 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
goto unlock;
if (tst->ss->write_init_super(tst))
goto unlock;
+ add_new_super = true;
} else if (dv->disposition == 'A') {
/* this had better be raid1.
* As we are "--re-add"ing we must find a spare slot
@@ -1078,6 +1080,8 @@ int Manage_add(int fd, int tfd, struct mddev_dev *dv,
map_unlock(&map);
return 1;
unlock:
+ if (add_new_super)
+ Kill(dv->devname, tst, 0, -1, 0);
map_unlock(&map);
return -1;
}
--
2.32.0 (Apple Git-132)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] mdadm/Grow: Check new_level interface rather than kernel version
2024-10-18 8:48 [PATCH 0/2] mdadm: minor fixes Xiao Ni
2024-10-18 8:48 ` [PATCH V2 1/2] mdadm/Manage: Clear superblock if adding new device fails Xiao Ni
@ 2024-10-18 8:48 ` Xiao Ni
2024-10-18 12:51 ` [PATCH 0/2] mdadm: minor fixes Mariusz Tkaczyk
2 siblings, 0 replies; 5+ messages in thread
From: Xiao Ni @ 2024-10-18 8:48 UTC (permalink / raw)
To: mariusz.tkaczyk; +Cc: linux-raid, ncroxon
Different os distributions have different kernel version themselves.
Check new_level sysfs interface rather than kernel version.
Signed-off-by: Xiao Ni <xni@redhat.com>
---
Grow.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Grow.c b/Grow.c
index ef1285ecebcf..9032c3e9c09f 100644
--- a/Grow.c
+++ b/Grow.c
@@ -2952,7 +2952,7 @@ static int impose_reshape(struct mdinfo *sra,
err = errno;
/* new_level is introduced in kernel 6.12 */
- if (!err && get_linux_version() >= 6012000 &&
+ if (!err && sysfs_attribute_available(sra, NULL, "new_level") &&
sysfs_set_num(sra, NULL, "new_level", info->new_level) < 0)
err = errno;
--
2.32.0 (Apple Git-132)
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] mdadm: minor fixes
2024-10-18 8:48 [PATCH 0/2] mdadm: minor fixes Xiao Ni
2024-10-18 8:48 ` [PATCH V2 1/2] mdadm/Manage: Clear superblock if adding new device fails Xiao Ni
2024-10-18 8:48 ` [PATCH 2/2] mdadm/Grow: Check new_level interface rather than kernel version Xiao Ni
@ 2024-10-18 12:51 ` Mariusz Tkaczyk
2 siblings, 0 replies; 5+ messages in thread
From: Mariusz Tkaczyk @ 2024-10-18 12:51 UTC (permalink / raw)
To: Xiao Ni; +Cc: linux-raid, ncroxon
On Fri, 18 Oct 2024 16:48:15 +0800
Xiao Ni <xni@redhat.com> wrote:
> Xiao Ni (2):
> mdadm/Manage: Clear superblock if adding new device fails
> mdadm/Grow: Check new_level interface rather than kernel version
>
> Grow.c | 2 +-
> Manage.c | 4 ++++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
Applied!
Thanks,
Mariusz
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-18 12:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-18 8:48 [PATCH 0/2] mdadm: minor fixes Xiao Ni
2024-10-18 8:48 ` [PATCH V2 1/2] mdadm/Manage: Clear superblock if adding new device fails Xiao Ni
2024-10-18 8:48 ` [PATCH 2/2] mdadm/Grow: Check new_level interface rather than kernel version Xiao Ni
2024-10-18 12:51 ` [PATCH 0/2] mdadm: minor fixes Mariusz Tkaczyk
-- strict thread matches above, loose matches on Subject: below --
2024-10-18 8:22 Xiao Ni
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).