Page MenuHomeFreeBSD

fusefs: update atime on reads when using cached attributes

Authored by asomers on Nov 28 2021, 3:50 AM.



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

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; 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