How to check if an NFS mount point supports xattr
This document (000021619) is provided subject to the disclaimer at the end of this document.
Environment
Situation
An administrator might desire to verify whether the NFS v4.2 file system (FS) mounted from the external server/storage supports user extended attributes (xattrs) as specified in RFC 8276.
For example, the following file system is shared from SLES 15 SP5:
sles15-server:~ # exportfs -v
/NFS_EXPORT/RW_SHARE
<world>(rw,sync,wdelay,hide,no_subtree_check,sec=sys,secure,root_squash,no_all_squash)
The NFS share is mounted on SLES 15 SP6:
sles15-client:~ # mount|grep -w "/mountpoint"
sles15-server:/NFS_EXPORT/RW_SHARE/SUB_SHARE on /mountpoint type nfs4 (rw,relatime,vers=4.2,rsize=1048576,wsize=1048576,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=10.156.61.14,local_lock=none,addr=10.156.61.19)
Where "/mountpoint" should be replaced with the actual path of the NFS mountpoint (still in quotes).
Resolution
To determine if the NFS v4.2 file system supports user extended attributes (xattrs), the following code can be executed:
awk '$5 == "/mountpoint",/nfsv4:/' /proc/self/mountstats | tail -1 | awk -F, '{print $3}' | \
awk -F= '{ printf("xattr_support: %s\n", ((and(strtonum($2), lshift(1,18))) == lshift(1,18) ) ? "Y" : "N"); }'
Where "/mountpoint" should be replaced with the actual path of the NFS mountpoint (still in quotes).
The output will either Y or N:
xattr_support: Y
Additional Information
Starting with SLES 15 SP4 (Linux Kernel 5.9) the NFS 4.2 client has been able to access user extended attributes (xattrs).
The client only checks with the server/storage if xattrs are supported at mount time. If the server suddenly stops supporting them, requests will fail but the status won't change until a remount.
NOTE: Above script was tested on SLE 15 SP6, it is being used only for debugging purposes.
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000021619
- Creation Date: 13-Nov-2024
- Modified Date:14-Nov-2024
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com