Skip to content

RFC virtiofs submounts forgotten after client memory pressure

Krister Johansen linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fuse: revalidate: move lookup into a separate functionfs/fuse/dir.c+60 -270 replies
2/2fuse: ensure that submounts lookup their rootfs/fuse/dir.c fs/fuse/fuse_i.h fs/fuse/inode.c+39 -92 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/2] virtiofs submounts forgotten after client memory pressure

Hi,
I recently ran into a situation where a virtiofs client began encountering EBADF after the client system had an OOM. After reproducing the issue and debugging, it appears that the problem is caused by a virtiofsd submount being forgotten once the dentry referencing that submount is killed by the shrinker. In this particular case, the submount had been bind mounted into a container's mount namespace. The reference count on the original dentry was 0, making it eligible for eviction. However, because this dentry was also the last reference the client knew it had, it sent a forget message to the server. This caused all future references to the FUSE node-id from virtiofsd perspective to become invalid. Subsequent attempts to used the node-id received an EBADF from the server.

This pair of patches modifies the virtiofs submount code to perform a lookup on the nodeid that forms the root of the submount. The patch before this pulls the revalidate lookup code into a helper function that can be used both in revalidate and submount superblock fill.

I'm not enamored with this approach, but was hard pressed to think of a more clever idea.

In the meantime, it's been tested via:

- fstests for virtiofs
- fstests for fuse (against passthrough_ll)
- manual testing to watch how refcounts change between client and server in response to filesytem access, umount, and eviction by the shrinker.

Thanks,

-K

Krister Johansen (2):
fuse: revalidate: move lookup into a separate function
fuse: ensure that submounts lookup their root

 fs/fuse/dir.c    | 87 +++++++++++++++++++++++++++++++++---------------
 fs/fuse/fuse_i.h |  6 ++++
 fs/fuse/inode.c  | 32 +++++++++++++++---
 3 files changed, 94 insertions(+), 31 deletions(-)
Signature · 1 line
2.25.1