Skip to content

nfs4: apply time_create as birth time in SETATTR - #175

Merged
kofemann merged 1 commit into
dCache:masterfrom
iterate-ch:nfs4-setattr-time-create
Aug 28, 2026
Merged

kofemann merged 1 commit into
dCache:masterfrom
iterate-ch:nfs4-setattr-time-create

Conversation

@ylangisc

Copy link
Copy Markdown
Contributor

Motivation:
The macOS NFS client sends a SETATTR with time_create after an exclusive create. OperationSETATTR maps FATTR4_TIME_CREATE to Stat.CTIME, although rfc7530/rfc8881 define time_create as the creation (birth) time, explicitly unrelated to the POSIX change time, and OperationGETATTR already serves time_create from Stat.BTIME. LocalFileSystem then tries to set the non-settable "unix:ctime" attribute, which throws IllegalArgumentException and turns the compound into NFS4ERR_SERVERFAULT. macOS maps SERVERFAULT to EBADRPC, so open(O_CREAT|O_EXCL) fails with errno 72 while the file is created on the server.

Modification:
map FATTR4_TIME_CREATE to Stat.BTIME in OperationSETATTR, matching the GETATTR side. In LocalFileSystem apply BTIME via "basic:creationTime", drop the "unix:ctime" branch, and fix the ATIME branch that used getCTime().

Result:
exclusive create from macOS clients works over NFS 4.0 and 4.1.

Fixes: #174
Target: master

Motivation:
The macOS NFS client sends a SETATTR with time_create after an exclusive
create. OperationSETATTR maps FATTR4_TIME_CREATE to Stat.CTIME, although
rfc7530/rfc8881 define time_create as the creation (birth) time, explicitly
unrelated to the POSIX change time, and OperationGETATTR already serves
time_create from Stat.BTIME. LocalFileSystem then tries to set the
non-settable "unix:ctime" attribute, which throws IllegalArgumentException
and turns the compound into NFS4ERR_SERVERFAULT. macOS maps SERVERFAULT to
EBADRPC, so open(O_CREAT|O_EXCL) fails with errno 72 while the file is
created on the server.

Modification:
map FATTR4_TIME_CREATE to Stat.BTIME in OperationSETATTR, matching the
GETATTR side. In LocalFileSystem apply BTIME via "basic:creationTime", drop
the "unix:ctime" branch, and fix the ATIME branch that used getCTime().

Result:
exclusive create from macOS clients works over NFS 4.0 and 4.1.

Fixes: dCache#174
Target: master
Signed-off-by: Yves Langisch <yla@iterate.ch>
@kofemann
kofemann merged commit ab43a26 into dCache:master Aug 28, 2026
1 check passed
@kofemann

Copy link
Copy Markdown
Member

@ylangisc thanks for your contribution

ylangisc added a commit to iterate-ch/nfs4j that referenced this pull request Aug 28, 2026
The time_create fix was merged upstream as c637deb (PR dCache#175)
without this comment. Remove it so the file matches upstream and the
merge stays conflict free.
ylangisc added a commit to iterate-ch/nfs4j that referenced this pull request Aug 28, 2026
…0.28.5

Brings in the upstreamed time_create fix (c637deb, PR dCache#175)
so the local variant is superseded, plus the post-0.28.5 development up to
ab43a26.

Conflict resolution (all in pom.xml, fork identity kept):
- version bumped to 0.29.0-SNAPSHOT, following upstream
- kept ch.iterate groupId, iterate-ch SCM URLs, S3 distributionManagement,
  aws-maven extension and the trimmed module list
- adopted upstream's removal of the download.dcache.org repositories;
  oncrpc4j 3.4.3 and sleepycat je 18.3.12 are on Maven Central
- kept the local maven-release-plugin config (no useReleaseProfile)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exclusive create from macOS clients fails with EBADRPC: SETATTR maps time_create to change time and crashes with SERVERFAULT

2 participants