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)
Fri, Nov 22, 7:19 PM
Unknown Object (File)
Sun, Nov 17, 5:50 AM
Unknown Object (File)
Fri, Nov 8, 3:45 PM
Unknown Object (File)
Fri, Nov 8, 12:47 PM
Unknown Object (File)
Wed, Oct 30, 1:00 PM
Unknown Object (File)
Oct 16 2024, 4:10 AM
Unknown Object (File)
Sep 23 2024, 7:55 PM
Unknown Object (File)
Sep 23 2024, 7:10 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