diff options
| author | Rick Macklem <rmacklem@FreeBSD.org> | 2026-06-18 15:45:27 +0000 |
|---|---|---|
| committer | Rick Macklem <rmacklem@FreeBSD.org> | 2026-06-18 15:45:27 +0000 |
| commit | b1af05406b5117d76f567056fba0a023a6374465 (patch) | |
| tree | 6de0818af32d43c84450c84ed60014c542a1fb05 | |
| parent | cbef29bde7ce8f2bac4bff831a21e9e54ae51d20 (diff) | |
nfs_nfsdserv.c: Fix setting of birthtime for some ZFS pools
Some ZFS pools do not support va_birthtime and will return
EINVAL when a VOP_SETATTR() of it is attempted. The MacOS
NFSv4 client sets va_birthtime (TimeCreate) in the same
Setattr with ctime/mtime and other attributes after a new
file is created. The EINVAL failure leaves these new files
messed up (mode == 0).
This patch pretends the setting of TimeCreate succeeded if
ctime/mtime were also set in the same Setattr RPC, which
resolves the problem for the MacOS client.
If this fix is not sufficient, a new pathconf name to detect
if a file system supports birthtime may be needed.
PR: 296066
Tested by: Will <freebsd.geography231@slmails.com>
MFC after: 2 weeks
| -rw-r--r-- | sys/fs/nfsserver/nfs_nfsdserv.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdserv.c b/sys/fs/nfsserver/nfs_nfsdserv.c index 9e5235f95ed1..fe7f0e217a74 100644 --- a/sys/fs/nfsserver/nfs_nfsdserv.c +++ b/sys/fs/nfsserver/nfs_nfsdserv.c @@ -579,6 +579,16 @@ nfsrvd_setattr(struct nfsrv_descript *nd, __unused int isdgram, NFSVNO_SETATTRVAL(&nva2, btime, nva.na_btime); nd->nd_repstat = nfsvno_setattr(vp, &nva2, nd->nd_cred, p, exp); + /* + * ZFS stores with early versions do not support va_birthtime + * and will reply EINVAL when setting is attempted. This + * breaks the MacOS NFSv4 client, so pretend it succeeded if + * ctime and/or mtime were set as well. + */ + if (nd->nd_repstat == EINVAL && + (NFSISSET_ATTRBIT(&retbits, NFSATTRBIT_TIMEACCESSSET) || + NFSISSET_ATTRBIT(&retbits, NFSATTRBIT_TIMEMODIFYSET))) + nd->nd_repstat = 0; if (!nd->nd_repstat) NFSSETBIT_ATTRBIT(&retbits, NFSATTRBIT_TIMECREATE); } |
