Kirill Gibelgaus has uploaded this change for review.
FSAL_VFS: use object handles for special-file GETATTR
GETATTR for sockets and device nodes opens a remembered parent handle and
stats the remembered name. Those are unavailable when create_handle()
reconstructs an object from its wire handle, for example after a server
restart or MDCACHE eviction. Subsequent GETATTR can return NFS4ERR_INVAL.
A remembered pathname can also refer to a different inode after a rename
or replacement.
On Linux, open the object's own handle with O_PATH and retrieve metadata
with vfs_stat_by_handle(). This neither opens the device nor depends on
the object's name. Add a backend capability helper to retain the existing
parent/name path for FreeBSD and legacy FSAL_XFS, whose handle APIs cannot
open these special objects with O_PATH. SETATTR is unchanged.
Reproduce by creating a socket or device node, saving its NFS filehandle,
restarting Ganesha, and issuing PUTFH(saved_handle) followed by GETATTR,
without a pathname LOOKUP. Unpatched V15.10 returns NFS4ERR_INVAL for all
three types; the patched build returns their original type and fileid.
Tested on Linux/ext4 with POSIX ACL support enabled:
- Saved-handle GETATTR before and after restart, with root and unprivileged
credentials, including a root-squashed export.
- Socket, character and block nodes with mode 000; regular file, directory,
symlink and FIFO controls; READDIR requesting attributes.
- Hardlink/unlink, renamed parents, pathname replacement, and STALE after
the final unlink.
- Kernel-client metadata cases over NFS 3, 4.0, 4.1 and 4.2.
Built both VFS and legacy XFS modules. Legacy XFS and FreeBSD were not
runtime-tested.
Change-Id: I64755c3b8557168e5b62beabe211ad3a577cf42e
Signed-off-by: Kirill Gibelgaus <kgibelgaus@ozon.ru>
---
M src/FSAL/FSAL_VFS/file.c
M src/FSAL/FSAL_VFS/os/freebsd/handle_syscalls.c
M src/FSAL/FSAL_VFS/os/linux/handle_syscalls.c
M src/FSAL/FSAL_VFS/vfs_methods.h
M src/FSAL/FSAL_VFS/xfs/handle_syscalls.c
5 files changed, 47 insertions(+), 4 deletions(-)
git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/97/1258297/1
To view, visit change 1258297. To unsubscribe, or for help writing mail filters, visit settings.