Bug 293691 - NFSv4.1 client trying to set |FATTR4_ARCHIVE| gets EPERM for file/dir creation attempts
Summary: NFSv4.1 client trying to set |FATTR4_ARCHIVE| gets EPERM for file/dir creatio...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 16.0-CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Rick Macklem
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-03-09 16:38 UTC by Roland Mainz
Modified: 2026-10-01 08:47 UTC (History)
4 users (show)

See Also:
rmacklem: mfc-stable15?


Attachments
nfs_nfsdserv.c: Fix handling of archive flag for mkdir, mknod, symlink (2.25 KB, patch)
2026-03-09 23:31 UTC, Rick Macklem
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roland Mainz 2026-03-09 16:38:15 UTC
FreeBSD installed from FreeBSD-16.0-CURRENT-amd64-20260302-5d9b185c33ae-284268-disc1.iso

NFSv4.1 client trying to set |FATTR4_ARCHIVE| gets EPERM for file/dir creation attempts.

This looks like a variation of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=292283 ("Bug 292283 - (JAVA) NFSv4.1 client trying to set FATTR4_SYSTEM or FATTR4_HIDDEN gets EPERM for file and dir creation attemps"), since the same workaround in the Windows ms-nfs41-client NFSv4.1 client works if extended to |FATTR4_ARCHIVE| - see https://github.com/kofemann/ms-nfs41-client/commit/7156d9f9deb25843e57fd455d8ec67951b82c737
Comment 1 Ed Maste freebsd_committer freebsd_triage 2026-03-09 19:21:39 UTC
Rick do you have any suggestions?
Comment 2 Rick Macklem freebsd_committer freebsd_triage 2026-03-09 23:31:20 UTC
Created attachment 268667 [details]
nfs_nfsdserv.c: Fix handling of archive flag for mkdir, mknod, symlink

This patch should fix the problem.
I think you'll find Open/Create already
works for "archive" if you have a FreeBSD
server based on main (FreeBSD16).
(I don't think archive support made it in
FreeBSD-15.0.)

If the reporter can test this fix, that
would be nice.

I will be committing this patch to main soon
and MFC'ng it in time for FreeBSD-15.1.
Comment 3 commit-hook freebsd_committer freebsd_triage 2026-03-17 00:25:06 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=6580d040861dfbf6c630a93cbf41f2a2c7e7b327

commit 6580d040861dfbf6c630a93cbf41f2a2c7e7b327
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2026-03-16 23:22:37 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-03-16 23:22:37 +0000

    nfs_nfsdserv.c: Fix handling of archive flag for mkdir

    An NFSv4.1/4.2 client can set/clear the archive, hidden
    and system flags when creating non-regular files, such
    as directories.

    Without this patch, the setting of va_flags causes an
    EPERM failure, since they are specified for VOP_MKDIR(),
    VOP_MKNOD() and VOP_SYMLINK().

    This patch sets va_flags == VNOVAL for the above VOP_xxx()
    calls and then sets/clears the flags after creation,
    which fixes the problem.

    This bug only affects the Windows NFSv4.1/4.2 client.

    PR:     293691
    Tested by:      Dan Shelton <dan.f.shelton@gmail.com>
    MFC after:      2 weeks

 sys/fs/nfsserver/nfs_nfsdserv.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Comment 4 Rick Macklem freebsd_committer freebsd_triage 2026-03-17 00:30:46 UTC
The patch has been committed to main and
will be MFC'd in time for the FreeBSD-15.1
release.
Comment 5 commit-hook freebsd_committer freebsd_triage 2026-03-31 01:08:47 UTC
A commit in branch stable/15 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=cea122acd9beeae5a815733614a77acd60a87899

commit cea122acd9beeae5a815733614a77acd60a87899
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2026-03-16 23:22:37 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-03-31 01:05:42 +0000

    nfs_nfsdserv.c: Fix handling of archive flag for mkdir

    An NFSv4.1/4.2 client can set/clear the archive, hidden
    and system flags when creating non-regular files, such
    as directories.

    Without this patch, the setting of va_flags causes an
    EPERM failure, since they are specified for VOP_MKDIR(),
    VOP_MKNOD() and VOP_SYMLINK().

    This patch sets va_flags == VNOVAL for the above VOP_xxx()
    calls and then sets/clears the flags after creation,
    which fixes the problem.

    This bug only affects the Windows NFSv4.1/4.2 client.

    PR:     293691

    (cherry picked from commit 6580d040861dfbf6c630a93cbf41f2a2c7e7b327)

 sys/fs/nfsserver/nfs_nfsdserv.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
Comment 6 Aurélien Couderc 2026-10-01 08:43:25 UTC
(In reply to commit-hook from comment #5)
In which FreeBSD 15.x release is this fixed ?
Comment 7 Aurélien Couderc 2026-10-01 08:47:41 UTC
(In reply to commit-hook from comment #3)
@rick: Thank you for fixing this!