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

layout swap on open unlinked file appears to succeed at first but does not

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • Lustre 2.5.0
    • Lustre 2.4.0
    • 3
    • 7052

    Description

      Layout swap in which one file is unlinked after open appears to succeed, but the data in the remaining file will be unreadable after cache invalidation.

      fd0 = open("f0", O_RDWR|O_CREAT, 0666);
      fd1 = open("f1", O_RDWR|O_CREAT, 0666);
      unlink("f1");
      swap_layouts(fd0, fd1);
      close(fd0);
      close(fd1);
      umount
      mount
      fd0 = open("f0", O_RDWR|O_CREAT, 0666);
      read(fd0, buf, size); returns -ENOENT.
      
      # llmount.sh
      # cd /mnt/lustre
      # echo 000 > f0
      # echo 111 > f1
      # exec 7<>f1
      # rm f1
      # lfs swap_layouts f0 /proc/self/fd/7
      # exec 7>&-
      # cat f0
      111
      # cat f0
      111
      # cat f0
      111
      # cat f1
      cat: f1: No such file or directory
      # cat f0
      cat: f0: No such file or directory
      # ls
      f0
      # stat f0
        File: `f0'
        Size: 4         	Blocks: 8          IO Block: 4194304 regular file
      Device: 2c54f966h/743766374d	Inode: 144115205255725073  Links: 1
      Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
      Access: 2013-03-08 14:32:29.000000000 -0600
      Modify: 2013-03-08 14:32:29.000000000 -0600
      Change: 2013-03-08 14:32:29.000000000 -0600
      # cat f0
      cat: f0: No such file or directory
      # strace cat f0
      execve("/bin/cat", ["cat", "f0"], [/* 36 vars */]) = 0
      ...
      open("f0", O_RDONLY)                    = 3
      fstat(3, {st_mode=S_IFREG|0644, st_size=4, ...}) = 0
      ...
      read(3, 0x7f4ef153f000, 4194304)        = -1 ENOENT (No such file or directory)
      ...
      

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: