Page MenuHomeFreeBSD

Make nfs_rename flush possibly dirty mmap'd pages
AcceptedPublic

Authored by rmacklem on Jan 3 2024, 1:06 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 29, 11:02 AM
Unknown Object (File)
Nov 6 2025, 6:19 PM
Unknown Object (File)
Oct 31 2025, 2:06 PM
Unknown Object (File)
Oct 27 2025, 2:03 AM
Unknown Object (File)
Oct 24 2025, 12:58 AM
Unknown Object (File)
Oct 24 2025, 12:58 AM
Unknown Object (File)
Oct 23 2025, 4:27 PM
Unknown Object (File)
Oct 9 2025, 11:10 AM
Subscribers

Details

Reviewers
asomers
kib
Summary

The nfs_rename() NFS client method flushes the buffer
cache for the from (and optionally to) files, so that any
writes are done before the rename.

This patch adds flushing of any dirty pages caused by
mmap'd writing.

To be honest, for most NFS servers, this is not necessary,
since most NFS servers do not change the file handle because
of a rename. (Whether or not this is the case can be detected
for NFSv4.1/4.2 and the client should be patched to check this
someday.)

Test Plan

Ran a small program that did mmap'd writing to
a file and then renamed the file.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

So this is probably relevant for msdosfs exports.

This revision is now accepted and ready to land.Jan 4 2024, 3:39 AM

Yes, I think a FreeBSD NFS server exporting msdosfs
file systems will change file handles when a rename
occurs.

There were also some old NFS file servers that used
the file name to generate the file handle and those always
changed file handles when a rename occurred.