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

truncate to start of uninstantiated PFL component silently fails

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Critical
    • Lustre 2.14.0
    • Lustre 2.13.0, Lustre 2.12.2, Lustre 2.10.8
    • None
    • 3
    • 9223372036854775807

    Description

      Truncate to exactly the first byte of an uninstantiated PFL component doesn't work - It has no effect.

      Example:

      [root@cent7c02 lustre]# mkdir testdir; lfs setstripe -E 4M --stripe-count=1 -E -1 testdir
      [root@cent7c02 lustre]# touch testdir/testfile; lfs getstripe testdir/testfile
      testdir/testfile
        lcm_layout_gen:    2
        lcm_mirror_count:  1
        lcm_entry_count:   2
          lcme_id:             1
          lcme_mirror_id:      0
          lcme_flags:          init
          lcme_extent.e_start: 0
          lcme_extent.e_end:   4194304
            lmm_stripe_count:  1
            lmm_stripe_size:   1048576
            lmm_pattern:       raid0
            lmm_layout_gen:    0
            lmm_stripe_offset: 0
            lmm_objects:
            - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x24b:0x0] }    lcme_id:             2
          lcme_mirror_id:      0
          lcme_flags:          0
          lcme_extent.e_start: 4194304
          lcme_extent.e_end:   EOF
            lmm_stripe_count:  1
            lmm_stripe_size:   1048576
            lmm_pattern:       raid0
            lmm_layout_gen:    0
            lmm_stripe_offset: -1[root@cent7c02 lustre]# truncate --size 4194304 testdir/testfile; ls -la testdir/testfile
      -rw-r--r-- 1 root root 0 Jul 24 15:11 testdir/testfile
      [root@cent7c02 lustre]# truncate --size 4194303 testdir/testfile; ls -la testdir/testfile
      -rw-r--r-- 1 root root 4194303 Jul 24 15:11 testdir/testfile
      [root@cent7c02 lustre]# truncate --size 4194305 testdir/testfile; ls -la testdir/testfile
      -rw-r--r-- 1 root root 4194305 Jul 24 15:11 testdir/testfile 

      Notice that the truncate to 4 MiB (4194304) leaves the size at 0, but truncate to 4194303 or 4194305 works fine.

      Once the component is instantiated, this works fine:

      [root@cent7c02 lustre]# truncate --size 4194305 testdir/testfile; ls -la testdir/testfile
      -rw-r--r-- 1 root root 4194305 Jul 24 15:14 testdir/testfile
      [root@cent7c02 lustre]# lfs getstripe testdir/testfile
      testdir/testfile
        lcm_layout_gen:    3
        lcm_mirror_count:  1
        lcm_entry_count:   2
          lcme_id:             1
          lcme_mirror_id:      0
          lcme_flags:          init
          lcme_extent.e_start: 0
          lcme_extent.e_end:   4194304
            lmm_stripe_count:  1
            lmm_stripe_size:   1048576
            lmm_pattern:       raid0
            lmm_layout_gen:    0
            lmm_stripe_offset: 1
            lmm_objects:
            - 0: { l_ost_idx: 1, l_fid: [0x100010000:0x24d:0x0] }    lcme_id:             2
          lcme_mirror_id:      0
          lcme_flags:          init
          lcme_extent.e_start: 4194304
          lcme_extent.e_end:   EOF
            lmm_stripe_count:  1
            lmm_stripe_size:   1048576
            lmm_pattern:       raid0
            lmm_layout_gen:    0
            lmm_stripe_offset: 0
            lmm_objects:
            - 0: { l_ost_idx: 0, l_fid: [0x100000000:0x24e:0x0] }
      [root@cent7c02 lustre]# truncate --size 4194304 testdir/testfile; ls -la testdir/testfile
      -rw-r--r-- 1 root root 4194304 Jul 24 15:14 testdir/testfile 

      This is due to a slightly mixup in the write intent code between "end" for truncate, which is a size, and "end" for a normal write, which is actually "endpos", ie, the position of the write cursor after a write, which is not actually accessed and so does not need to be instantiated.  But "end" for truncate is not endpos, it's end, ie, it's included.

      Fix coming momentarily.

      Attachments

        Activity

          People

            bobijam Zhenyu Xu
            pfarrell Patrick Farrell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: