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)
Wed, May 8, 5:53 AM
Unknown Object (File)
Wed, May 8, 5:52 AM
Unknown Object (File)
Wed, May 8, 5:51 AM
Unknown Object (File)
Wed, May 8, 2:22 AM
Unknown Object (File)
Sat, May 4, 11:21 PM
Unknown Object (File)
Sat, May 4, 6:58 AM
Unknown Object (File)
Apr 27 2024, 2:14 AM
Unknown Object (File)
Apr 26 2024, 8:21 PM
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