Message ID | 20240706143038.7253-1-mat.jonczyk@o2.pl (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [REGRESSION] Cannot start degraded RAID1 array with device with write-mostly flag | expand |
Context | Check | Description |
---|---|---|
mdraidci/vmtest-md-6_11-PR | success | PR summary |
mdraidci/vmtest-md-6_11-VM_Test-0 | success | Logs for build-kernel |
W dniu 6.07.2024 o 16:30, Mateusz Jończyk pisze: > Hello, > > Linux 6.9+ cannot start a degraded RAID1 array when the only remaining > device has the write-mostly flag set. Linux 6.8.0 works fine, as does > 6.1.96. [snip] > After some investigation, I have determined that the bug is most likely in > choose_slow_rdev() in drivers/md/raid1.c, which doesn't set max_sectors > before returning early. A test patch (below) seems to fix this issue (Linux > boots and appears to be working correctly with it, but I didn't do any more > advanced experiments yet). > > This points to > commit dfa8ecd167c1 ("md/raid1: factor out choose_slow_rdev() from read_balance()") > as the most likely culprit. However, I was running into other bugs in mdadm when > trying to test this commit directly. > > Distribution: Ubuntu 20.04, hardware: a HP 17-by0001nw laptop. I have been testing this patch carefully: 1. I have been reliably getting deadlocks when adding / removing devices on an array that contains a component with the write-mostly flag set - while the array was loaded with fsstress. When the array was idle, no such deadlocks happened. This occurred also on Linux 6.8.0 though, but not on 6.1.97-rc1, so this is likely an independent regression. 2. When adding a device to the array (/dev/sda1), I once got the following warnings in dmesg on patched 6.10-rc6: [ 8253.337816] md: could not open device unknown-block(8,1). [ 8253.337832] md: md_import_device returned -16 [ 8253.338152] md: could not open device unknown-block(8,1). [ 8253.338169] md: md_import_device returned -16 [ 8253.674751] md: recovery of RAID array md2 (/dev/sda1 has device major/minor numbers = 8,1). This may be caused by some interaction with udev, though. I have also seen this on Linux 6.8. Additionally, on an unpatched 6.1.97-rc1 (which was handy for testing), I got a deadlock when removing a bitmap from such an array while it was loaded with fsstress. I'll file independent reports, but wanted to give a head's up. Greetings, Mateusz
Hi, 在 2024/07/06 22:30, Mateusz Jończyk 写道: > Subject: [RFC PATCH] md/raid1: fill in max_sectors > > > > Not yet fully tested or carefully investigated. > > > > Signed-off-by: Mateusz Jo艅czyk<mat.jonczyk@o2.pl> > > > > --- > > drivers/md/raid1.c | 1 + > > 1 file changed, 1 insertion(+) > > > > diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c > > index 7b8a71ca66dd..82f70a4ce6ed 100644 > > --- a/drivers/md/raid1.c > > +++ b/drivers/md/raid1.c > > @@ -680,6 +680,7 @@ static int choose_slow_rdev(struct r1conf *conf, struct r1bio *r1_bio, > > len = r1_bio->sectors; > > read_len = raid1_check_read_range(rdev, this_sector, &len); > > if (read_len == r1_bio->sectors) { > > + *max_sectors = read_len; > > update_read_sectors(conf, disk, this_sector, read_len); > > return disk; > > } This looks correct, can you give it a test and cook a patch? Thanks, Kuai
W dniu 8.07.2024 o 03:54, Yu Kuai pisze: > Hi, > > 在 2024/07/06 22:30, Mateusz Jończyk 写道: >> Subject: [RFC PATCH] md/raid1: fill in max_sectors >> >> >> >> Not yet fully tested or carefully investigated. >> >> >> >> Signed-off-by: Mateusz Jo艅czyk<mat.jonczyk@o2.pl> >> >> >> >> --- >> >> drivers/md/raid1.c | 1 + >> >> 1 file changed, 1 insertion(+) >> >> >> >> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c >> >> index 7b8a71ca66dd..82f70a4ce6ed 100644 >> >> --- a/drivers/md/raid1.c >> >> +++ b/drivers/md/raid1.c >> >> @@ -680,6 +680,7 @@ static int choose_slow_rdev(struct r1conf *conf, struct r1bio *r1_bio, >> >> len = r1_bio->sectors; >> >> read_len = raid1_check_read_range(rdev, this_sector, &len); >> >> if (read_len == r1_bio->sectors) { >> >> + *max_sectors = read_len; >> >> update_read_sectors(conf, disk, this_sector, read_len); >> >> return disk; >> >> } > > This looks correct, can you give it a test and cook a patch? > > Thanks, > Kuai Hello, Yes, I'm working on it. Patch description is nearly done. Kernel with this patch works well with normal usage and fsstress, except when modifying the array, as I have written in my previous email. Will test some more. I'm feeling nervous working on such sensitive code as md, though. I'm not an experienced kernel dev. Greetings, Mateusz
Hi, 在 2024/07/09 4:09, Mateusz Jończyk 写道: > W dniu 8.07.2024 o 03:54, Yu Kuai pisze: >> Hi, >> >> 在 2024/07/06 22:30, Mateusz Jończyk 写道: >>> Subject: [RFC PATCH] md/raid1: fill in max_sectors >>> >>> >>> >>> Not yet fully tested or carefully investigated. >>> >>> >>> >>> Signed-off-by: Mateusz Jo艅czyk<mat.jonczyk@o2.pl> >>> >>> >>> >>> --- >>> >>> drivers/md/raid1.c | 1 + >>> >>> 1 file changed, 1 insertion(+) >>> >>> >>> >>> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c >>> >>> index 7b8a71ca66dd..82f70a4ce6ed 100644 >>> >>> --- a/drivers/md/raid1.c >>> >>> +++ b/drivers/md/raid1.c >>> >>> @@ -680,6 +680,7 @@ static int choose_slow_rdev(struct r1conf *conf, struct r1bio *r1_bio, >>> >>> len = r1_bio->sectors; >>> >>> read_len = raid1_check_read_range(rdev, this_sector, &len); >>> >>> if (read_len == r1_bio->sectors) { >>> >>> + *max_sectors = read_len; >>> >>> update_read_sectors(conf, disk, this_sector, read_len); >>> >>> return disk; >>> >>> } >> >> This looks correct, can you give it a test and cook a patch? >> >> Thanks, >> Kuai > Hello, > > Yes, I'm working on it. Patch description is nearly done. > Kernel with this patch works well with normal usage and > fsstress, except when modifying the array, as I have written > in my previous email. Will test some more. Please run mdadm tests at least. And we may need to add a new test. https://kernel.googlesource.com/pub/scm/utils/mdadm/mdadm.git ./test --dev=loop Thanks, Kuai > > I'm feeling nervous working on such sensitive code as md, though. > I'm not an experienced kernel dev. > > Greetings, > > Mateusz > > . >
On Mon, 8 Jul 2024 22:09:51 +0200 Mateusz Jończyk <mat.jonczyk@o2.pl> wrote: > > This looks correct, can you give it a test and cook a patch? > > > > Thanks, > > Kuai > Hello, > > Yes, I'm working on it. Patch description is nearly done. > Kernel with this patch works well with normal usage and > fsstress, except when modifying the array, as I have written > in my previous email. Will test some more. > > I'm feeling nervous working on such sensitive code as md, though. > I'm not an experienced kernel dev. > > Greetings, > > Mateusz > > Hi Mateusz, If there is something I can help with, fell free to ask (even in Polish). You can reach me by the mail I sent it or mariusz.tkaczyk@intel.com I cannot answer you directly (this is the first problem you have to solve): The following message to <mat.jonczyk@o2.pl> was undeliverable. The reason for the problem: 5.1.0 - Unknown address error 554-'sorry, refused mailfrom because return MX does not exist' Please consider using different mail provider (so far I know, gmail works well). Thanks, Mariusz
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 7b8a71ca66dd..82f70a4ce6ed 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -680,6 +680,7 @@ static int choose_slow_rdev(struct r1conf *conf, struct r1bio *r1_bio, len = r1_bio->sectors; read_len = raid1_check_read_range(rdev, this_sector, &len); if (read_len == r1_bio->sectors) { + *max_sectors = read_len; update_read_sectors(conf, disk, this_sector, read_len); return disk; }