Skip to content

ocfs2: seq_file .next functions should increase position index

Joseph Qi ocfs2-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v2 Latest1 of 4 patches 2 repliesIn review

1 of 4 patches is in this archive. The cover letter announces 4.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4lockres_seq_next should increase position index+0 -05 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [Ocfs2-devel] [PATCH v2 0/4] ocfs2: seq_file .next functions should increase position index

Looks good.
Jun, could you please help verify these changes and give your tested-by? Since I don't have ocfs2 cluster locally...

Thanks,
Joseph

Quoted 42 lines · Vasily Averin

v2: resend with improved patch description

In Aug 2018 NeilBrown noticed
commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface") "Some ->next functions do not increment *pos when they return NULL... Note that such ->next functions are buggy and should be fixed.
A simple demonstration is

dd if=/proc/swaps bs=1000 skip=1

Choose any block size larger than the size of /proc/swaps. This will always show the whole last line of /proc/swaps"

/proc/swaps output was fixed recently, however there are lot of other affected files and 4 of them are related to ocfs2.

Unfortunately I'm not familiar with ocfs2 and cannot verify the patches locally.

Usually you can observe following related problems:
- read after lseek beyond end of file, described above by NeilBrown "dd if=<AFFECTED_FILE> bs=1000 skip=1" will incorrectly generate whole last line

- read after lseek on into middle of last line will output expected rest of last line but then repeat whole last line once again.

- If .show() function generates multi-line output following bash script will never finish.

 $ q=;while read -r r;do echo "$((++q)) $r";done < AFFECTED_FILE

Vasily Averin (4):
lockres_seq_next should increase position index ocfs2_dlm_seq_next should increase position index nst_seq_next should increase position index sc_seq_next should increase position index

 fs/ocfs2/cluster/netdebug.c | 2 ++
 fs/ocfs2/dlm/dlmdebug.c     | 1 +
 fs/ocfs2/dlmglue.c          | 1 +
 3 files changed, 4 insertions(+)