Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xattrs do not work on nfs mounted mergerfs pool #1132

Open
Tomaszal opened this issue Jan 31, 2023 · 9 comments
Open

xattrs do not work on nfs mounted mergerfs pool #1132

Tomaszal opened this issue Jan 31, 2023 · 9 comments

Comments

@Tomaszal
Copy link

Describe the bug

nfs supports xattrs since Linux 5.9 and nfs 4.2. I have tested it on my setup by exporting a regular folder on an ext4 filesystem over nfs and attempting to use xattrs. However, when exporting a mergerfs pool over nfs, trying to use xattrs errors with Operation not supported. I have tried using the nfsopenhack=all option, but it does not help. From the nfsopenhack description it's unrelated anyway, so I did not expect it to help, but it was the only relevant option I could try.

To Reproduce

  1. Create a mergerfs pool on a server host, f.e. at /mnt/storage/pool
  2. Export the pool on the server host using nfs 4.2 or newer and Linux 5.9 or newer, f.e. with the following in /etc/exports:
    /mnt/storage/pool 192.168.1.0/24(rw,fsid=0,no_root_squash)
    
  3. Mount the nfs directory on a client host, f.e.:
    mount -t nfs -o vers=4 servername:/ /mnt/storage
    
  4. Create a test file on the client host nfs directory, f.e.:
    touch /mnt/storage/test
    
  5. Try setting an xattr on the test file on the client host, f.e.:
    attr -s foo -V bar /mnt/storage/test
    

Expected behavior

The xattr gets set successfully on the client host:

Attribute "foo" set to a 4 byte value for /mnt/storage/test:
bar

And can be accessed afterwards on the client host:

attr -l /mnt/storage/test 
Attribute "foo" has a 4 byte value for /mnt/storage/test

System information:

  • OS, kernel version: NixOS unstable, Linux 6.1.8
  • mergerfs version: 2.34.1
  • mergerfs settings
    /mnt/storage/data/* /mnt/storage/pool fuse.mergerfs defaults,nonempty,allow_other,use_ino,cache.files=partial,dropcacheonclose=true,category.create=mfs,fsname=mergerfs,nfsopenhack=all,xattr=passthrough 0 0
    
  • List of drives, filesystems, & sizes:
    • df -h:
      mergerfs    /mnt/storage/pool
      /dev/sdb1   /mnt/storage/data/01
      /dev/sdc1   /mnt/storage/data/02
      
    • lsblk -f:
      sdb                                                                               
      └─sdb1 ext4   1.0   data-01   /mnt/storage/data/01
      sdc                                                                               
      └─sdc1 ext4   1.0   data-02   /mnt/storage/data/02
      
  • A strace of the application having a problem:
    1166  18:43:21.866654 execve("/run/current-system/sw/bin/attr", ["attr", "-s", "foo", "/mnt/storage/test", "-V", "bar"], ["SHELL=/run/current-system/sw/bin/bash", "__ETC_PROFILE_DONE=1", "XDG_CONFIG_DIRS=/etc/xdg:/root/.nix-profile/etc/xdg:/etc/profiles/per-user/root/etc/xdg:/nix/var/nix/profiles/default/etc/xdg:/run/current-system/sw/etc/xdg", "SUDO_GID=100", "SSH_AUTH_SOCK=/tmp/ssh-XXXXv53pID/agent.971", "XCURSOR_PATH=/root/.icons:/root/.local/share/icons:/root/.nix-profile/share/icons:/root/.nix-profile/share/pixmaps:/etc/profiles/per-user/root/share/icons:/etc/profiles/per-user/root/share/pixmaps:/nix/var/nix/profiles/default/share/icons:/nix/var/nix/prof"..., "SUDO_COMMAND=/run/current-system/sw/bin/bash", "SUDO_USER=admin", "NO_AT_BRIDGE=1", "EDITOR=nano", "PWD=/home/admin", "NIX_PROFILES=/run/current-system/sw /nix/var/nix/profiles/default /etc/profiles/per-user/root /root/.nix-profile", "LOGNAME=root", "NIX_PATH=/root/.nix-defexpr/channels:nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels", "NIXPKGS_CONFIG=/etc/nix/nixpkgs-config.nix", "HOME=/root", "SSH_ASKPASS=", "LANG=en_US.UTF-8", "LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=00:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lz"..., "GTK_A11Y=none", "NIX_USER_PROFILE_DIR=/nix/var/nix/profiles/per-user/root", "INFOPATH=/root/.nix-profile/info:/root/.nix-profile/share/info:/etc/profiles/per-user/root/info:/etc/profiles/per-user/root/share/info:/nix/var/nix/profiles/default/info:/nix/var/nix/profiles/default/share/info:/run/current-system/sw/info:/run/current-syst"..., "TERM=xterm-256color", "GTK_PATH=/root/.nix-profile/lib/gtk-2.0:/root/.nix-profile/lib/gtk-3.0:/root/.nix-profile/lib/gtk-4.0:/etc/profiles/per-user/root/lib/gtk-2.0:/etc/profiles/per-user/root/lib/gtk-3.0:/etc/profiles/per-user/root/lib/gtk-4.0:/nix/var/nix/profiles/default/lib/"..., "LESSOPEN=|/nix/store/qyzhcdapbvjljbrz2c41fc4r6ac6mkcm-lesspipe-2.06/bin/lesspipe.sh %s", "USER=root", "TZDIR=/etc/zoneinfo", "SHLVL=1", "PAGER=less", "QTWEBKIT_PLUGIN_PATH=/root/.nix-profile/lib/mozilla/plugins/:/etc/profiles/per-user/root/lib/mozilla/plugins/:/nix/var/nix/profiles/default/lib/mozilla/plugins/:/run/current-system/sw/lib/mozilla/plugins/", "__NIXOS_SET_ENVIRONMENT_DONE=1", "LOCALE_ARCHIVE=/run/current-system/sw/lib/locale/locale-archive", "LESSKEYIN_SYSTEM=/nix/store/r550v6ravaq0vkps7sv2fjv8r2bca89p-lessconfig", "TERMINFO_DIRS=/root/.nix-profile/share/terminfo:/etc/profiles/per-user/root/share/terminfo:/nix/var/nix/profiles/default/share/terminfo:/run/current-system/sw/share/terminfo", "MOZ_PLUGIN_PATH=/root/.nix-profile/lib/mozilla/plugins:/etc/profiles/per-user/root/lib/mozilla/plugins:/nix/var/nix/profiles/default/lib/mozilla/plugins:/run/current-system/sw/lib/mozilla/plugins", "KDEDIRS=/root/.nix-profile:/etc/profiles/per-user/root:/nix/var/nix/profiles/default:/run/current-system/sw", "XDG_DATA_DIRS=/nix/store/sj78jirpmmafckx1npi75f67vfmh55mr-desktops/share:/root/.nix-profile/share:/etc/profiles/per-user/root/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share", "LIBEXEC_PATH=/root/.nix-profile/lib/libexec:/etc/profiles/per-user/root/lib/libexec:/nix/var/nix/profiles/default/lib/libexec:/run/current-system/sw/lib/libexec", "PATH=/run/wrappers/bin:/root/.nix-profile/bin:/etc/profiles/per-user/root/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin", "SUDO_UID=1000", "MAIL=/var/mail/root", "QT_PLUGIN_PATH=/root/.nix-profile/lib/qt4/plugins:/root/.nix-profile/lib/kde4/plugins:/etc/profiles/per-user/root/lib/qt4/plugins:/etc/profiles/per-user/root/lib/kde4/plugins:/nix/var/nix/profiles/default/lib/qt4/plugins:/nix/var/nix/profiles/default/lib/k"..., "OLDPWD=/root", "_=/run/current-system/sw/bin/strace"]) = 0 <0.000187>
    1166  18:43:21.866986 brk(NULL)         = 0x1b6b000 <0.000006>
    1166  18:43:21.867022 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffd5fe5f920) = -1 EINVAL (Invalid argument) <0.000006>
    1166  18:43:21.867110 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5d93f9a000 <0.000011>
    1166  18:43:21.867155 access("/etc/ld-nix.so.preload", R_OK) = -1 ENOENT (No such file or directory) <0.000009>
    1166  18:43:21.867193 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/glibc-hwcaps/x86-64-v3/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000039>
    1166  18:43:21.867257 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/glibc-hwcaps/x86-64-v3", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.867290 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/glibc-hwcaps/x86-64-v2/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.867319 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/glibc-hwcaps/x86-64-v2", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867347 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/tls/haswell/x86_64/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.867374 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/tls/haswell/x86_64", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867401 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/tls/haswell/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867428 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/tls/haswell", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867455 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/tls/x86_64/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.867502 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/tls/x86_64", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.867547 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/tls/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000008>
    1166  18:43:21.867589 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/tls", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867616 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/haswell/x86_64/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.867643 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/haswell/x86_64", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867669 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/haswell/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867696 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/haswell", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867722 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/x86_64/libattr.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867749 newfstatat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/x86_64", 0x7ffd5fe5eb20, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.867775 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/libattr.so.1", O_RDONLY|O_CLOEXEC) = 3 <0.000009>
    1166  18:43:21.867804 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\0\0\0\0\0\0\0\0@\0\0\0\0\0\0\0\350r\0\0\0\0\0\0\0\0\0\0@\08\0\n\0@\0\35\0\34\0\1\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08\25\0\0\0\0\0\08\25\0\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\0 \0\0\0\0\0\0\331\"\0\0\0\0\0\0\331\"\0\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\4\0\0\0\0P\0\0\0\0\0\0\0P\0\0\0\0\0\0\0P\0\0\0\0\0\0H\10\0\0\0\0\0\0H\10\0\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\6\0\0\0@\\\0\0\0\0\0\0@l\0\0\0\0\0\0"..., 832) = 832 <0.000006>
    1166  18:43:21.867837 pread64(3, "\4\0\0\0 \0\0\0\5\0\0\0GNU\0\1\0\1\300\4\0\0\0\1\0\0\0\0\0\0\0\2\0\1\300\4\0\0\0\1\0\0\0\0\0\0\0", 48, 22552) = 48 <0.000006>
    1166  18:43:21.867865 newfstatat(3, "", {st_dev=makedev(0x103, 0x1), st_ino=9587219, st_mode=S_IFREG|0555, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=64, st_size=31272, st_atime=1675136288 /* 2023-01-31T03:38:08.363366977+0000 */, st_atime_nsec=363366977, st_mtime=1 /* 1970-01-01T00:00:01+0000 */, st_mtime_nsec=0, st_ctime=1675049354 /* 2023-01-30T03:29:14.798631670+0000 */, st_ctime_nsec=798631670}, AT_EMPTY_PATH) = 0 <0.000007>
    1166  18:43:21.867914 mmap(NULL, 28696, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5d93f92000 <0.000010>
    1166  18:43:21.867942 mmap(0x7f5d93f94000, 12288, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7f5d93f94000 <0.000015>
    1166  18:43:21.867976 mmap(0x7f5d93f97000, 4096, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x7f5d93f97000 <0.000010>
    1166  18:43:21.868004 mmap(0x7f5d93f98000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x5000) = 0x7f5d93f98000 <0.000009>
    1166  18:43:21.868040 close(3)          = 0 <0.000006>
    1166  18:43:21.868064 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000008>
    1166  18:43:21.868093 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/glibc-hwcaps/x86-64-v3/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.868122 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/glibc-hwcaps/x86-64-v3", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868148 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/glibc-hwcaps/x86-64-v2/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868175 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/glibc-hwcaps/x86-64-v2", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868202 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/tls/haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868228 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/tls/haswell/x86_64", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868254 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/tls/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868281 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/tls/haswell", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868307 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/tls/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868334 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/tls/x86_64", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868360 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868387 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/tls", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868418 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/haswell/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868445 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/haswell/x86_64", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868471 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000008>
    1166  18:43:21.868521 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/haswell", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868561 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/x86_64/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.868588 newfstatat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/x86_64", 0x7ffd5fe5eb00, 0) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.868614 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 <0.000007>
    1166  18:43:21.868641 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\224\2\0\0\0\0\0@\0\0\0\0\0\0\0\230\217$\0\0\0\0\0\0\0\0\0@\08\0\16\0@\0@\0?\0\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0\20\3\0\0\0\0\0\0\20\3\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\340>\34\0\0\0\0\0\340>\34\0\0\0\0\0\340>\34\0\0\0\0\0T\0\0\0\0\0\0\0T\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\1\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270\177\2\0\0\0\0\0\270\177\2\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\200\2\0\0\0\0\0\0\200\2\0\0\0\0\0"..., 832) = 832 <0.000006>
    1166  18:43:21.868668 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0\20\3\0\0\0\0\0\0\20\3\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\340>\34\0\0\0\0\0\340>\34\0\0\0\0\0\340>\34\0\0\0\0\0T\0\0\0\0\0\0\0T\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\1\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270\177\2\0\0\0\0\0\270\177\2\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\200\2\0\0\0\0\0\0\200\2\0\0\0\0\0\0\200\2\0\0\0\0\0\207R\27\0\0\0\0\0\207R\27\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\4\0\0\0\0\340\31\0\0\0\0\0\0\340\31\0\0\0\0\0\0\340\31\0\0\0\0\0"..., 784, 64) = 784 <0.000005>
    1166  18:43:21.868694 pread64(3, "\4\0\0\0\20\0\0\0\5\0\0\0GNU\0\2\200\0\300\4\0\0\0\1\0\0\0\0\0\0\0", 32, 848) = 32 <0.000005>
    1166  18:43:21.868719 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0\276\227s\234K\257\36\332\236\200q\tr\374s`K\204\4;\4\0\0\0\20\0\0\0\1\0\0\0GNU\0\0\0\0\0\2\0\0\0\6\0\0\0 \0\0\0", 68, 880) = 68 <0.000005>
    1166  18:43:21.868744 newfstatat(3, "", {st_dev=makedev(0x103, 0x1), st_ino=9463496, st_mode=S_IFREG|0555, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=4688, st_size=2400152, st_atime=1675136288 /* 2023-01-31T03:38:08.351366977+0000 */, st_atime_nsec=351366977, st_mtime=1 /* 1970-01-01T00:00:01+0000 */, st_mtime_nsec=0, st_ctime=1675049354 /* 2023-01-30T03:29:14.528393081+0000 */, st_ctime_nsec=528393081}, AT_EMPTY_PATH) = 0 <0.000006>
    1166  18:43:21.868789 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0\20\3\0\0\0\0\0\0\20\3\0\0\0\0\0\0\10\0\0\0\0\0\0\0\3\0\0\0\4\0\0\0\340>\34\0\0\0\0\0\340>\34\0\0\0\0\0\340>\34\0\0\0\0\0T\0\0\0\0\0\0\0T\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\1\0\0\0\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270\177\2\0\0\0\0\0\270\177\2\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\5\0\0\0\0\200\2\0\0\0\0\0\0\200\2\0\0\0\0\0\0\200\2\0\0\0\0\0\207R\27\0\0\0\0\0\207R\27\0\0\0\0\0\0\20\0\0\0\0\0\0\1\0\0\0\4\0\0\0\0\340\31\0\0\0\0\0\0\340\31\0\0\0\0\0\0\340\31\0\0\0\0\0"..., 784, 64) = 784 <0.000005>
    1166  18:43:21.868815 mmap(NULL, 2133456, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f5d93c00000 <0.000008>
    1166  18:43:21.868841 mmap(0x7f5d93c28000, 1531904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x28000) = 0x7f5d93c28000 <0.000014>
    1166  18:43:21.868877 mmap(0x7f5d93d9e000, 360448, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x19e000) = 0x7f5d93d9e000 <0.000010>
    1166  18:43:21.868904 mmap(0x7f5d93df6000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1f6000) = 0x7f5d93df6000 <0.000011>
    1166  18:43:21.868938 mmap(0x7f5d93dfc000, 52688, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7f5d93dfc000 <0.000009>
    1166  18:43:21.868972 close(3)          = 0 <0.000006>
    1166  18:43:21.869004 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f5d93f8f000 <0.000007>
    1166  18:43:21.869033 arch_prctl(ARCH_SET_FS, 0x7f5d93f8f740) = 0 <0.000006>
    1166  18:43:21.869056 set_tid_address(0x7f5d93f8fa10) = 1166 <0.000006>
    1166  18:43:21.869080 set_robust_list(0x7f5d93f8fa20, 24) = 0 <0.000005>
    1166  18:43:21.869101 rseq(0x7f5d93f900e0, 0x20, 0, 0x53053053) = 0 <0.000005>
    1166  18:43:21.869156 mprotect(0x7f5d93df6000, 16384, PROT_READ) = 0 <0.000010>
    1166  18:43:21.869191 mprotect(0x7f5d93f98000, 4096, PROT_READ) = 0 <0.000008>
    1166  18:43:21.869222 mprotect(0x403000, 4096, PROT_READ) = 0 <0.000008>
    1166  18:43:21.869250 mprotect(0x7f5d93fd1000, 8192, PROT_READ) = 0 <0.000009>
    1166  18:43:21.869285 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 <0.000006>
    1166  18:43:21.869341 getrandom("\x3b\x62\x22\x6e\xbe\xb5\xe0\x5c", 8, GRND_NONBLOCK) = 8 <0.000006>
    1166  18:43:21.869369 brk(NULL)         = 0x1b6b000 <0.000006>
    1166  18:43:21.869393 brk(0x1b8c000)    = 0x1b8c000 <0.000009>
    1166  18:43:21.869423 openat(AT_FDCWD, "/run/current-system/sw/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 <0.000016>
    1166  18:43:21.869461 newfstatat(3, "", {st_dev=makedev(0x103, 0x1), st_ino=10098232, st_mode=S_IFREG|0444, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=5968, st_size=3054672, st_atime=1675049491 /* 2023-01-30T03:31:31.949390501+0000 */, st_atime_nsec=949390501, st_mtime=1 /* 1970-01-01T00:00:01+0000 */, st_mtime_nsec=0, st_ctime=1675049360 /* 2023-01-30T03:29:20.325790929+0000 */, st_ctime_nsec=325790929}, AT_EMPTY_PATH) = 0 <0.000010>
    1166  18:43:21.869541 mmap(NULL, 3054672, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5d93800000 <0.000008>
    1166  18:43:21.869571 close(3)          = 0 <0.000006>
    1166  18:43:21.869616 lsetxattr("/mnt/storage/test", "user.foo", "bar", 3, 0) = -1 EOPNOTSUPP (Operation not supported) <0.002702>
    1166  18:43:21.872354 lsetxattr("/mnt/storage/test", "user.foo", "bar", 3, 0) = -1 EOPNOTSUPP (Operation not supported) <0.000011>
    1166  18:43:21.872415 dup(2)            = 3 <0.000006>
    1166  18:43:21.872441 fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) <0.000006>
    1166  18:43:21.872474 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 4 <0.000025>
    1166  18:43:21.872547 newfstatat(4, "", {st_dev=makedev(0x103, 0x1), st_ino=9464370, st_mode=S_IFREG|0444, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=2998, st_atime=1675049354 /* 2023-01-30T03:29:14+0000 */, st_atime_nsec=0, st_mtime=1 /* 1970-01-01T00:00:01+0000 */, st_mtime_nsec=0, st_ctime=1675049354 /* 2023-01-30T03:29:14.528393081+0000 */, st_ctime_nsec=528393081}, AT_EMPTY_PATH) = 0 <0.000007>
    1166  18:43:21.872599 read(4, "# Locale name alias data base.\n# Copyright (C) 1996-2022 Free Software Foundation, Inc.\n#\n# This program is free software; you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foun"..., 4096) = 2998 <0.000007>
    1166  18:43:21.872636 read(4, "", 4096) = 0 <0.000006>
    1166  18:43:21.872660 close(4)          = 0 <0.000006>
    1166  18:43:21.872692 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/share/locale/en_US.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000008>
    1166  18:43:21.872722 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000008>
    1166  18:43:21.872757 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.872786 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/share/locale/en.UTF-8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.872813 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000006>
    1166  18:43:21.872840 openat(AT_FDCWD, "/nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.872871 newfstatat(3, "", {st_dev=makedev(0, 0x13), st_ino=3, st_mode=S_IFCHR|0620, st_nlink=1, st_uid=1000, st_gid=3, st_blksize=1024, st_blocks=0, st_rdev=makedev(0x88, 0), st_atime=1675190600 /* 2023-01-31T18:43:20.733639195+0000 */, st_atime_nsec=733639195, st_mtime=1675190600 /* 2023-01-31T18:43:20.733639195+0000 */, st_mtime_nsec=733639195, st_ctime=1675188281 /* 2023-01-31T18:04:41.733639195+0000 */, st_ctime_nsec=733639195}, AT_EMPTY_PATH) = 0 <0.000006>
    1166  18:43:21.872917 write(3, "attr_set: Operation not supported\n", 34) = 34 <0.000037>
    1166  18:43:21.873024 close(3)          = 0 <0.000007>
    1166  18:43:21.873120 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/share/locale/en_US.UTF-8/LC_MESSAGES/attr.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000011>
    1166  18:43:21.873185 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/share/locale/en_US.utf8/LC_MESSAGES/attr.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000014>
    1166  18:43:21.873228 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/share/locale/en_US/LC_MESSAGES/attr.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000008>
    1166  18:43:21.873261 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/share/locale/en.UTF-8/LC_MESSAGES/attr.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000008>
    1166  18:43:21.873293 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/share/locale/en.utf8/LC_MESSAGES/attr.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.873322 openat(AT_FDCWD, "/nix/store/vv0xndc0ip83f72n0hz0wlcf3g8jhsjd-attr-2.5.1/share/locale/en/LC_MESSAGES/attr.mo", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000007>
    1166  18:43:21.873359 write(2, "Could not set \"foo\" for /mnt/storage/test\n", 42) = 42 <0.000007>
    1166  18:43:21.873391 exit_group(1)     = ?
    1166  18:43:21.873489 +++ exited with 1 +++
    
  • strace of mergerfs while app tried to do it's thing:
    615   18:24:07.792735 restart_syscall(<... resuming interrupted io_setup ...> <unfinished ...>
    614   18:24:07.792782 futex(0xffffd251bb80, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
    621   18:24:10.350666 <... read resumed>"8\0\0\0\3\0\0\0\212\0\0\0\0\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0d\4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 1052672) = 56 <2.558193>
    621   18:24:10.351196 setreuid(-1, 0)   = 0 <0.000204>
    621   18:24:10.351531 setregid(-1, 0)   = 0 <0.000045>
    621   18:24:10.351683 newfstatat(AT_FDCWD, "/mnt/storage/data/01/test", {st_dev=makedev(0x8, 0x11), st_ino=11, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=13, st_atime=1675185317 /* 2023-01-31T17:15:17.490641902+0000 */, st_atime_nsec=490641902, st_mtime=1675185317 /* 2023-01-31T17:15:17.490641902+0000 */, st_mtime_nsec=490641902, st_ctime=1675188840 /* 2023-01-31T18:14:00.187013990+0000 */, st_ctime_nsec=187013990}, AT_SYMLINK_NOFOLLOW) = 0 <0.000107>
    621   18:24:10.352107 newfstatat(AT_FDCWD, "/mnt/storage/data/01/test", {st_dev=makedev(0x8, 0x11), st_ino=11, st_mode=S_IFREG|0644, st_nlink=1, st_uid=0, st_gid=0, st_blksize=4096, st_blocks=8, st_size=13, st_atime=1675185317 /* 2023-01-31T17:15:17.490641902+0000 */, st_atime_nsec=490641902, st_mtime=1675185317 /* 2023-01-31T17:15:17.490641902+0000 */, st_mtime_nsec=490641902, st_ctime=1675188840 /* 2023-01-31T18:14:00.187013990+0000 */, st_ctime_nsec=187013990}, AT_SYMLINK_NOFOLLOW) = 0 <0.000048>
    621   18:24:10.352423 writev(3, [{iov_base="x\0\0\0\0\0\0\0\212\0\0\0\0\0\0\0", iov_len=16}, {iov_base="\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0k\277\204\246Q\1F?\r\0\0\0\0\0\0\0\10\0\0\0\0\0\0\0\245L\331c\0\0\0\0\245L\331c\0\0\0\0hZ\331c\0\0\0\0\356\231>\35\356\231>\35f\233%\v\244\201\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\20\0\0\0\0\0\0", iov_len=104}], 2) = 120 <0.000048>
    
@trapexit
Copy link
Owner

trapexit commented Feb 1, 2023

Hm... not sure why it wouldn't work if you have xattrs enabled in mergerfs. Maybe there is something funny with how FUSE and NFS work together in this regard. I'll setup a NFS share and check it out.

@Tomaszal
Copy link
Author

Tomaszal commented Feb 1, 2023

Yeah I forgot to mention that xattrs work locally in the mergerfs pool with these configs, they only don't work when accessing the pool through nfs.

@trapexit
Copy link
Owner

trapexit commented Feb 3, 2023

My guess is that it is a kernel thing. I'll ask the FUSE authors.

@trapexit
Copy link
Owner

I'm almost positive I tested this and had the issues you mention but I just tested again and it is working fine. Kernel 5.15 on Ubuntu and Mint systems.

Can you double check the setup and instructions to reproduce?

@Tomaszal
Copy link
Author

@trapexit I've tested it again on Arch with kernel 6.1.12 and got the same results. This time I set up a MergerFS pool on the system drive and NFS server and client on the same machine as I don't have the original setup. Seeing how that's enough to reproduce the bug, I've made a script to make it easier to test:

#!/bin/bash
set -euo pipefail

# Set test root folder
TEST_ROOT="/mnt/mergerfs-xattrs-test"

# Create required directories
mkdir -p $TEST_ROOT/{disks/{1,2,3},pool,client}

# Mount MergerFS pool
mergerfs -o defaults,nfsopenhack=all,xattr=passthrough "$TEST_ROOT/disks/*" "$TEST_ROOT/pool"

# Setup NFS exports
NFS_EXPORT_LINE="$TEST_ROOT/pool 127.0.0.1(rw,fsid=0,no_root_squash,no_subtree_check)"
NFS_EXPORT_FILE="/etc/exports"
grep -qF -- "$NFS_EXPORT_LINE" "$NFS_EXPORT_FILE" || echo "$NFS_EXPORT_LINE" >>"$NFS_EXPORT_FILE"

# Start NFS server and refresh exports
systemctl start nfsv4-server.service
exportfs -ar

# Setup NFS client
mount -t nfs -o vers=4 127.0.0.1:/ "$TEST_ROOT/client"

# Perform test
touch "$TEST_ROOT/client/test"
if attr -s foo -V bar "$TEST_ROOT/client/test"; then
  RESULT="PASS"
else
  RESULT="FAIL"
fi

# Cleanup
awk -i inplace -v line="$NFS_EXPORT_LINE" '!index($0,line)' "$NFS_EXPORT_FILE" 
exportfs -ar
sleep 1s # wait for mounts to not be busy
umount "$TEST_ROOT/client"
umount "$TEST_ROOT/pool"
rm -rf "$TEST_ROOT"

# Print result
echo "MergerFS xattrs test: $RESULT"

Here's the output I get on my system (running the script with sudo):

attr_set: Operation not supported
Could not set "foo" for /mnt/mergerfs-xattrs-test/client/test
MergerFS xattrs test: FAIL

@trapexit
Copy link
Owner

Thanks. Will take a look and get back to the kernel folks.

@trapexit
Copy link
Owner

trapexit commented Feb 22, 2023

Have you tried setting fsid and not using the mounting of root path like that? Because besides that I simply can't reproduce this on 5.15 on Ubuntu. It works fine if I change the fsid and mount the full path.

I don't know why that would matter but it appears to and for me if you just make those changes to your script it works as desired.

@Tomaszal
Copy link
Author

You're right, after doing the following changes it works as expected:

 # Setup NFS exports
-NFS_EXPORT_LINE="$TEST_ROOT/pool 127.0.0.1(rw,fsid=0,no_root_squash,no_subtree_check)"
+NFS_EXPORT_LINE="$TEST_ROOT/pool 127.0.0.1(rw,fsid=1,no_root_squash,no_subtree_check)"
 # Setup NFS client
-mount -t nfs -o vers=4 127.0.0.1:/ "$TEST_ROOT/client"
+mount -t nfs -o vers=4 "127.0.0.1:$TEST_ROOT/pool" "$TEST_ROOT/client

It is very odd and I'd still consider it a bug, as I see no reason why it shouldn't work in the first scenario. But I guess the issue is probably with NFS and at least there's this workaround now. Though it still might have something to do with how MergerFS interacts with NFS, as running the first case (with fsid=0) without creating the MergerFS pool works just fine (simply comment out the mergerfs and umount "$TEST_ROOT/pool" lines to try).

@trapexit
Copy link
Owner

Not sure but at most it is a FUSE <-> NFS issue as mergerfs is not behaving any differently between these two situations. I'll do some more investigation and talk to the kernel devs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants