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

Implement renameat2() with RENAME_EXCHANGE and RENAME_WHITEOUT

Details

    • Improvement
    • Resolution: Unresolved
    • Minor
    • None
    • Lustre 2.10.5, Lustre 2.12.2
    • CentOS 7
    • 9223372036854775807

    Description

      It would be nice to have support for renameat2()'s linux specific flags RENAME_EXCHANGE and RENAME_WHITEOUT so that Lustre could be safely used as a backend to some overlayfs implementations in user space.

      For example, the code snippet below works on ext4 and xfs but not on Lustre:

      #include <errno.h>
      #include <fcntl.h>
      #include <stdio.h>
      #include <unistd.h>
      #include <linux/fs.h>
      #include <sys/syscall.h>
      
      int main(int argc, char *argv[])
      {
        int ret;
      
        ret = syscall(SYS_renameat2, AT_FDCWD, argv[1], AT_FDCWD, argv[2], RENAME_EXCHANGE);
        if (ret != 0)
          fprintf(stderr, "renameat2(%s, %s) ret=%d, errno=%d\n", argv[1], argv[2], ret, errno);
        return ret;
      }
      
      $ renameat2 file1 file2
      renameat2(file1, file2) ret=-1 errno=22 
      

       

      Example on ext4:

      $ echo file1 > file1
      $ echo file2 > file2
      $ ./renameat2 file1 file2
      renameat2 ret=0 errno=0
      $ cat file1
      file2
      $ cat file2
      file1
      

       

      Thanks!
      Stephane

       

      Attachments

        Issue Links

          Activity

            People

              wc-triage WC Triage
              sthiell Stephane Thiell
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated: