summaryrefslogtreecommitdiff
path: root/drivers/md
diff options
context:
space:
mode:
authorJan Glauber <jglauber@digitalocean.com>2021-03-17 15:04:39 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-05-14 09:44:13 +0200
commitaf7ea06b3cae9c02e88fcc017b9e51dab047002e (patch)
tree7c6cc34e721cd0ec2469bc7da84f99c8b4605910 /drivers/md
parent79c1bfae668d34db9b946a5de86d90a615cca0b1 (diff)
md: Fix missing unused status line of /proc/mdstat
commit 7abfabaf5f805f5171d133ce6af9b65ab766e76a upstream. 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: 1f4aace60b0e ("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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 2f7d29711758..761d43829b2b 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -7971,7 +7971,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 */