Skip to contentSkip to conversation

vfs cachefiles updates

GIT PULL Merged Christian Brauner 2 participants 2 messages Jan 5, 2024 – Jan 8, 2024 VFS

lore
Share & tools
lore

Christian Brauner

author maintainer
#0 lore raw

Hey Linus,

/* Summary */
This contains improvements for on-demand cachefiles. If the daemon crashes and the on-demand cachefiles fd is unexpectedly closed in-flight requests and subsequent read operations associated with the fd will fail with EIO. This causes issues in various scenarios as this failure is currently unrecoverable.

The work contained in this pull request introduces a failover mode and enables the daemon to recover in-flight requested-related objects. A restarted daemon will be able to process requests as usual.

This requires that in-flight requests are stored during daemon crash or while the daemon is offline. In addition, a handle to /dev/cachefiles needs to be stored. This can be done by e.g., systemd's fdstore (cf. [1]) which enables the restarted daemon to recover state.

Three new states are introduced in this patchset:

(1) CLOSE
Object is closed by the daemon.
(2) OPEN
Object is open and ready for processing. IOW, the open request has been handled successfully.
(3) REOPENING
Object has been previously closed and is now reopened due to a read request.

A restarted daemon can recover the /dev/cachefiles fd from systemd's fdstore and writes "restore" to the device. This causes the object state to be reset from CLOSE to REOPENING and reinitializes the object. The daemon may now handle the open request. Any in-flight operations are restored and handled avoiding interruptions for users.

[1]: https://systemd.io/FILE_DESCRIPTOR_STORE

/* Testing */
clang: Debian clang version 16.0.6 (19)
gcc: (Debian 13.2.0-7) 13.2.0

All patches are based on v6.7-rc1 and have been sitting in linux-next. No build failures or warnings were observed.

/* Conflicts */
At the time of creating this PR no merge conflicts were reported from linux-next and no merge conflicts showed up doing a test-merge with current mainline.

The following changes since commit b85ea95d086471afb4ad062012a4d73cd328fa86:

Linux 6.7-rc1 (2023-11-12 16:19:07 -0800)

are available in the Git repository at:

[email protected]:pub/scm/linux/kernel/git/vfs/vfs tags/vfs-6.8.cachefiles

for you to fetch changes up to e73fa11a356ca0905c3cc648eaacc6f0f2d2c8b3:

cachefiles: add restore command to recover inflight ondemand read requests (2023-11-25 16:03:57 +0100)

Please consider pulling these changes from the signed vfs-6.8.cachefiles tag.

Happy New Year!
Christian

----------------------------------------------------------------
vfs-6.8.cachefiles

----------------------------------------------------------------
Jia Zhu (5):
cachefiles: introduce object ondemand state
cachefiles: extract ondemand info field from cachefiles_object
cachefiles: resend an open request if the read request's object is closed
cachefiles: narrow the scope of triggering EPOLLIN events in ondemand mode
cachefiles: add restore command to recover inflight ondemand read requests

 fs/cachefiles/daemon.c    |  15 ++++-
 fs/cachefiles/interface.c |   7 +-
 fs/cachefiles/internal.h  |  59 +++++++++++++++-
 fs/cachefiles/ondemand.c  | 166 ++++++++++++++++++++++++++++++++++------------
 4 files changed, 201 insertions(+), 46 deletions(-)