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)
Tue, Apr 30, 1:18 PM
Unknown Object (File)
Apr 11 2024, 7:42 PM
Unknown Object (File)
Feb 10 2024, 9:42 PM
Unknown Object (File)
Feb 9 2024, 1:42 PM
Unknown Object (File)
Feb 3 2024, 8:23 AM
Unknown Object (File)
Jan 18 2024, 3:23 PM
Unknown Object (File)
Jan 17 2024, 8:40 PM
Unknown Object (File)
Jan 7 2024, 6:06 PM
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.