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

truncate does not set file size correctly in corner case

    XMLWordPrintable

Details

    • 3
    • 9223372036854775807

    Description

      created a file with layout with "lfs setstripe -E 4m -E 1g -c 4 -E -1 /mnt/lustre/test"

      and truncate then seek and read of it

      54917 1600771094.532399 ftruncate(11, 1070596096) = 0 <0.002077>
      54917 1600771094.534496 lseek(11, 1070596092, SEEK_SET) = 1070596092 <0.000020>
      54917 1600771094.534535 read(11, "", 4) = 0 <0.000477>
      

      while the same operations upon a plain file is like follows

      176699 1600824857.107003 lseek(11, 0, SEEK_CUR) = 1069547272 <0.000016>
      176699 1600824857.107034 ftruncate(11, 1070596096) = 0 <0.002115>
      176699 1600824857.109166 lseek(11, 1070596092, SEEK_SET) = 1070596092 <0.000016>
      176699 1600824857.109197 read(11, "\0\0\0\0", 4) = 4 <0.001038>
      

      The location 1070596096 (1021M) is exactly at the end of the 1st stripe of the 2nd component, and truncate will not set the OST object size of the 1st stripe (because it's not intersected with [1070596096, EOF)) and set the 2nd, 3rd and 4th stripe object size, from the 4th stripe object we can get file size of 1069547520 (1020M). This is incorrect, so the seek and read think we are reading after the EOF of the file, so return 0 instead of 4 bytes.

      Attachments

        Activity

          People

            bobijam Zhenyu Xu
            bobijam Zhenyu Xu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: