Page MenuHomeFreeBSD

fusefs: update atime on reads when using cached attributes
ClosedPublic

Authored by asomers on Nov 28 2021, 3:50 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 9 2024, 11:42 AM
Unknown Object (File)
Feb 10 2024, 12:50 PM
Unknown Object (File)
Jan 18 2024, 4:31 PM
Unknown Object (File)
Dec 20 2023, 6:10 AM
Unknown Object (File)
Dec 12 2023, 2:32 PM
Unknown Object (File)
Oct 28 2023, 6:11 AM
Unknown Object (File)
Oct 18 2023, 6:57 AM
Unknown Object (File)
Oct 9 2023, 7:15 AM
Subscribers

Details

Summary

When using cached attributes, whether or not the data cache is enabled,
fusefs must update a file's atime whenever it reads from it, so long as
it wasn't mounted with -o noatime. Update it in-kernel, and flush it to
the server on close or during the next setattr operation.

The downside is that close() will now frequently trigger a FUSE_SETATTR
upcall. But if you care about performance, you should be using
-o noatime anyway.

MFC after: 2 weeks

Test Plan

test cases added

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I will admit I don't like this. Does linux do the same?

In D33145#749045, @pfg wrote:

I will admit I don't like this. Does linux do the same?

It seems like Linux does something worse. On any read, it invalidates the atime field, so the next stat(2) call has to retrieve the file's status from the server rather than from cached attributes. For mtime and ctime, though, Linux updates those fields in-kernel just like FreeBSD already does.

This revision is now accepted and ready to land.Nov 29 2021, 12:24 AM