Uploaded image for project: 'Lustre'
  1. Lustre
  2. LU-13985

seq_file next function must change *pos

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.14.0
    • None
    • None
    • 3
    • 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.

       

      Attachments

        Issue Links

          Activity

            [LU-13985] seq_file next function must change *pos
            pjones Peter Jones added a comment -

            Landed for 2.14

            pjones Peter Jones added a comment - Landed for 2.14

            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

            gerrit Gerrit Updater added a comment - 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

            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

            gerrit Gerrit Updater added a comment - 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

            People

              neilb Neil Brown
              neilb Neil Brown
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: