* [PATCH] md: Fix missing unused status line of /proc/mdstat
@ 2021-03-17 14:04 Jan Glauber
2021-03-22 17:39 ` Song Liu
0 siblings, 1 reply; 2+ messages in thread
From: Jan Glauber @ 2021-03-17 14:04 UTC (permalink / raw)
To: linux-raid; +Cc: linux-kernel, Song Liu, Jan Glauber
Reading /proc/mdstat with a read buffer size that would not
fit the unused status line in the first read will skip this
line from the output.
So 'dd if=/proc/mdstat bs=64 2>/dev/null' will not print something
like: unused devices: <none>
Don't return NULL immediately in start() for v=2 but call
show() once to print the status line also for multiple reads.
Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")
Signed-off-by: Jan Glauber <jglauber@digitalocean.com>
---
drivers/md/md.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 21da0c48f6c2..cb19d50fa672 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -8153,7 +8153,11 @@ static void *md_seq_start(struct seq_file *seq, loff_t *pos)
loff_t l = *pos;
struct mddev *mddev;
- if (l >= 0x10000)
+ if (l == 0x10000) {
+ ++*pos;
+ return (void *)2;
+ }
+ if (l > 0x10000)
return NULL;
if (!l--)
/* header */
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] md: Fix missing unused status line of /proc/mdstat
2021-03-17 14:04 [PATCH] md: Fix missing unused status line of /proc/mdstat Jan Glauber
@ 2021-03-22 17:39 ` Song Liu
0 siblings, 0 replies; 2+ messages in thread
From: Song Liu @ 2021-03-22 17:39 UTC (permalink / raw)
To: Jan Glauber; +Cc: linux-raid, open list
On Wed, Mar 17, 2021 at 7:05 AM Jan Glauber <jglauber@digitalocean.com> wrote:
>
> Reading /proc/mdstat with a read buffer size that would not
> fit the unused status line in the first read will skip this
> line from the output.
>
> So 'dd if=/proc/mdstat bs=64 2>/dev/null' will not print something
> like: unused devices: <none>
>
> Don't return NULL immediately in start() for v=2 but call
> show() once to print the status line also for multiple reads.
>
> Fixes: 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface")
> Signed-off-by: Jan Glauber <jglauber@digitalocean.com>
Applied to md-next. Thanks!
Song
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-03-22 17:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-17 14:04 [PATCH] md: Fix missing unused status line of /proc/mdstat Jan Glauber
2021-03-22 17:39 ` Song Liu
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).