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

lfs mirror resync may truncate file to wrong size

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not a Bug
    • Minor
    • None
    • None
    • None
    • 3
    • 9223372036854775807

    Description

      To reproduce:

      export OSTCOUNT=4
      export OSTSIZE=800000
      $LUSTRE/tests/llmount.sh
      
      lctl pool_new lustre.ddn_ssd
      lctl pool_new lustre.ddn_hdd
      lctl pool_add lustre.ddn_ssd lustre-OST0000
      lctl pool_add lustre.ddn_ssd lustre-OST0001
      lctl pool_add lustre.ddn_hdd lustre-OST0002
      lctl pool_add lustre.ddn_hdd lustre-OST0003
      
      lfs setstripe -c 1 -p ddn_ssd /mnt/lustre
      
      rm -f /tmp/f0 /mnt/lustre/f0
      dd if=/dev/urandom of=/tmp/f0 bs=4096 count=1 seek=$(( (134217728 - 3 * 4096) / 4096 ))
      dd if=/dev/urandom of=/tmp/f0 bs=4096 count=1 seek=$(( (134217728 + 3 * 4096) / 4096 )) conv=notrunc
      /usr/bin/truncate --size=2G /tmp/f0
      
      cp /tmp/f0 /mnt/lustre/f0
      stat --format='%s %b %B' /tmp/f0 /mnt/lustre/f0
      
      hole=0
      data=0
      while true; do
        data=$(lseek_test --data $hole /mnt/lustre/f0) || break
        hole=$(lseek_test --hole $data /mnt/lustre/f0) || break
        echo $data $hole
      done
      
      lfs mirror extend -N -p ddn_ssd /mnt/lustre/f0
      stat --format='%s %b %B' /tmp/f0 /mnt/lustre/f0
      
      cp /tmp/f0 /mnt/lustre/f0
      stat --format='%s %b %B' /tmp/f0 /mnt/lustre/f0
      
      lfs mirror resync /mnt/lustre/f0
      stat --format='%s %b %B' /tmp/f0 /mnt/lustre/f0
      

      Output:

       lfs setstripe -c 1 -p ddn_ssd /mnt/lustre
      # rm -f /tmp/f0 /mnt/lustre/f0
      # dd if=/dev/urandom of=/tmp/f0 bs=4096 count=1 seek=$(( (134217728 - 3 * 4096) / 4096 ))
      1+0 records in
      1+0 records out
      4096 bytes (4.1 kB) copied, 0.000328655 s, 12.5 MB/s
      # dd if=/dev/urandom of=/tmp/f0 bs=4096 count=1 seek=$(( (134217728 + 3 * 4096) / 4096 )) conv=notrunc
      1+0 records in
      1+0 records out
      4096 bytes (4.1 kB) copied, 0.0011132 s, 3.7 MB/s
      # /usr/bin/truncate --size=2G /tmp/f0
      # 
      # cp /tmp/f0 /mnt/lustre/f0
      # stat --format='%s %b %B' /tmp/f0 /mnt/lustre/f0
      2147483648 112 512
      2147483648 1 512
      # 
      # hole=0
      # data=0
      # while true; do
      >   data=$(lseek_test --data $hole /mnt/lustre/f0) || break
      >   hole=$(lseek_test --hole $data /mnt/lustre/f0) || break
      >   echo $data $hole
      > done
      134205440 134209536
      134230016 134283264
      lseek to 134283264 failed with 6
      # 
      # lfs mirror extend -N -p ddn_ssd /mnt/lustre/f0
      # stat --format='%s %b %B' /tmp/f0 /mnt/lustre/f0
      2147483648 112 512
      2147483648 112 512
      # 
      # cp /tmp/f0 /mnt/lustre/f0
      # stat --format='%s %b %B' /tmp/f0 /mnt/lustre/f0
      2147483648 112 512
      2147483648 1 512
      # 
      # lfs mirror resync /mnt/lustre/f0
      # stat --format='%s %b %B' /tmp/f0 /mnt/lustre/f0
      2147483648 112 512
      134283264 224 512
      

      Attachments

        Issue Links

          Activity

            People

              jhammond John Hammond
              jhammond John Hammond
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: