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

truncate does not set file size correctly in corner case

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

          [LU-14128] truncate does not set file size correctly in corner case

          "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/45448/
          Subject: LU-14128 lov: correctly set OST obj size
          Project: fs/lustre-release
          Branch: b2_12
          Current Patch Set:
          Commit: cfb24815e825738cea16270bbd6e7841b0e7d09b

          gerrit Gerrit Updater added a comment - "Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/45448/ Subject: LU-14128 lov: correctly set OST obj size Project: fs/lustre-release Branch: b2_12 Current Patch Set: Commit: cfb24815e825738cea16270bbd6e7841b0e7d09b

          "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/45448
          Subject: LU-14128 lov: correctly set OST obj size
          Project: fs/lustre-release
          Branch: b2_12
          Current Patch Set: 1
          Commit: fc68ce9fdfed82ff483b997b0887cdfe06e1ad34

          gerrit Gerrit Updater added a comment - "Patrick Farrell <pfarrell@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/45448 Subject: LU-14128 lov: correctly set OST obj size Project: fs/lustre-release Branch: b2_12 Current Patch Set: 1 Commit: fc68ce9fdfed82ff483b997b0887cdfe06e1ad34
          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/40581/
          Subject: LU-14128 lov: correctly set OST obj size
          Project: fs/lustre-release
          Branch: master
          Current Patch Set:
          Commit: 98015004516cad1173e2bac2a4695bdc56e4d9a4

          gerrit Gerrit Updater added a comment - Oleg Drokin (green@whamcloud.com) merged in patch https://review.whamcloud.com/40581/ Subject: LU-14128 lov: correctly set OST obj size Project: fs/lustre-release Branch: master Current Patch Set: Commit: 98015004516cad1173e2bac2a4695bdc56e4d9a4

          Bobi Jam (bobijam@hotmail.com) uploaded a new patch: https://review.whamcloud.com/40581
          Subject: LU-14128 lov: correctly set OST obj size
          Project: fs/lustre-release
          Branch: master
          Current Patch Set: 1
          Commit: 138e852e30e6a68f78543ca8f5fbaad17bb6e9db

          gerrit Gerrit Updater added a comment - Bobi Jam (bobijam@hotmail.com) uploaded a new patch: https://review.whamcloud.com/40581 Subject: LU-14128 lov: correctly set OST obj size Project: fs/lustre-release Branch: master Current Patch Set: 1 Commit: 138e852e30e6a68f78543ca8f5fbaad17bb6e9db

          People

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

            Dates

              Created:
              Updated:
              Resolved: