Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-95334

NFSv4: Unable to mount an exported path which is a symlink under fsid=root

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Normal Normal
    • None
    • rhel-9.6, rhel-10.0
    • nfs-utils
    • None
    • rhel-fs
    • 3
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • Automated
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      What were you trying to do that didn't work?

      The behaviors are different when trying to mount an exported path which is a symlink under dir with fsid=root:

      • Success if the linked path are relative
      • Failed if the linked path are full
      # Exporting /export_test as root
      [root@rhel-10-upk ~]# exportfs -v
      /export_test    <world>(sync,wdelay,hide,no_subtree_check,fsid=0,sec=sys,rw,secure,root_squash,no_all_squash)
                                                               ^^^^^^^
      [root@rhel-10-upk ~]# ll /export_test/
      total 0
      drwxr-xr-x. 2 root root 17 Jun  5 06:03 sub
      lrwxrwxrwx. 1 root root  5 Jun  5 06:03 symlink1 -> ./sub
      lrwxrwxrwx. 1 root root 16 Jun  5 06:03 symlink2 -> /export_test/sub      <<<<<<
      [root@rhel-10-upk ~]#
      [root@rhel-10-upk ~]# mount localhost:/symlink1 /mnt
      [root@rhel-10-upk ~]# umount /mnt
      [root@rhel-10-upk ~]# mount localhost:/symlink2 /mnt
      mount.nfs: access denied by server while mounting localhost:/symlink2     <<<<<<
      [root@rhel-10-upk ~]#

      What is the impact of this issue to you?

      Please provide the package NVR for which the bug is seen:

      How reproducible is this bug?:

      Always

      Steps to reproduce

      [root@rhel-10-upk ~]# cat test.sh
      mkdir -p /export_test/sub /mnt_test
      pushd /export_test
      ln -s ./sub ./symlink1
      popd
      ln -s /export_test/sub /export_test/symlink2
      ls -l /export_test/
      echo '/export_test *(rw,fsid=0)' > /etc/exports
      systemctl restart nfs-server
      
      echo "mount localhost:/symlink1 /mnt_test"
      mount localhost:/symlink1 /mnt_test
      [ $? -eq 0 ] && grep mnt_test /proc/mounts && umount /mnt_test
      
      echo "mount localhost:/symlink2 /mnt_test"
      mount localhost:/symlink2 /mnt_test
      [ $? -eq 0 ] && grep mnt_test /proc/mounts && umount /mnt_test
      

      Expected results

      Success to mount

      Actual results

              rh-ee-okorniev Olga Kornievskaia
              rhn-support-yoyang Yongcheng Yang
              NFS Team NFS Team
              Yongcheng Yang Yongcheng Yang
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: