[LU-13985] seq_file next function must change *pos Created: 24/Sep/20  Updated: 12/Oct/20  Resolved: 12/Oct/20

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.14.0

Type: Bug Priority: Minor
Reporter: Neil Brown Assignee: Neil Brown
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Duplicate
duplicates LU-13543 hsm.actions file is broken on RHEL 8.2 Resolved
Related
is related to LU-8066 Move lustre procfs handling to sysfs ... Open
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

If the .next function used to implement a seq_file ever doesn't change the value of *pos, the result of reading the file can be incorrect.

This specifically includes when the end-of-file is found and NULL is returned.

The error occurs if a 'read()' request is performed while the file pointer is in the middle of the last record, as you could happen if you seek there, or read a block that is not a whole number of records.  In this case the remainder of the last record will be returned followed by a complete copy of that last record.  To avoid the complete copy, *pos must be be changed so that a subsequent call to ->start reports an immediate end of file.
Because this is a common bug, seq_file core code will report a warning if *pos is not changed.

There are several ->next functions in lustre which don't always change *pos.

 



 Comments   
Comment by Gerrit Updater [ 24/Sep/20 ]

Neil Brown (neilb@suse.de) uploaded a new patch: https://review.whamcloud.com/40035
Subject: LU-13985 lustre: seq_file .next functions must update *pos
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 10f498a9e008cf31fa8b45b04b31bf361e5909ab

Comment by Gerrit Updater [ 12/Oct/20 ]

Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/40035/
Subject: LU-13985 lustre: seq_file .next functions must update *pos
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 817d6c116599639599919bcde7999a7f06b74d2c

Comment by Peter Jones [ 12/Oct/20 ]

Landed for 2.14

Generated at Sat Feb 10 03:05:52 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.