Skip to content

Commit

Permalink
md: Fix missing unused status line of /proc/mdstat
Browse files Browse the repository at this point in the history
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.

Cc: stable@vger.kernel.org
Fixes: 1f4aace ("fs/seq_file.c: simplify seq_file iteration code and interface")
Signed-off-by: Jan Glauber <jglauber@digitalocean.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
  • Loading branch information
Jan Glauber authored and Song Liu committed Mar 24, 2021
1 parent 254c271 commit 7abfaba
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit 7abfaba

Please sign in to comment.