Skip to contentSkip to conversation

FAILED: patch "[PATCH] fuse: share lookup state between submount and its parent" failed to apply to 5.10-stable tree

PATCH [email protected] 1 participant 1 message Dec 17, 2023

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x c4d361f66ac91db8fc65061a9671682f61f4ca9d
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023121710-lifting-customer-7805@gregkh' --subject-prefix 'PATCH 5.10.y' HEAD^..

Possible dependencies:

c4d361f66ac9 ("fuse: share lookup state between submount and its parent")
972f4c46d0a1 ("fuse: cache btime")
d3045530bdd2 ("fuse: implement statx")
9dc10a54abe5 ("fuse: add ATTR_TIMEOUT macro")
8d8f9c4b8df6 ("fuse: handle empty request_mask in statx")
e78662e818f9 ("fuse: add a new fuse init flag to relax restrictions in no cache mode") 5cadfbd5a11e ("fuse: add feature flag for expire-only")
d40b2f4c94f2 ("Merge tag 'fuse-update-6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/fuse")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From c4d361f66ac91db8fc65061a9671682f61f4ca9d Mon Sep 17 00:00:00 2001
From: Krister Johansen <[email protected]>
Date: Fri, 3 Nov 2023 10:39:47 -0700
Subject: [PATCH] fuse: share lookup state between submount and its parent

Fuse submounts do not perform a lookup for the nodeid that they inherit from their parent. Instead, the code decrements the nlookup on the submount's fuse_inode when it is instantiated, and no forget is performed when a submount root is evicted.

Trouble arises when the submount's parent is evicted despite the submount itself being in use. In this author's case, the submount was in a container and deatched from the initial mount namespace via a MNT_DEATCH operation. When memory pressure triggered the shrinker, the inode from the parent was evicted, which triggered enough forgets to render the submount's nodeid invalid.

Since submounts should still function, even if their parent goes away, solve this problem by sharing refcounted state between the parent and its submount. When all of the references on this shared state reach zero, it's safe to forget the final lookup of the fuse nodeid.

Fixes 1866d779d5d2 ("fuse: Allow fuse_fill_super_common() for submounts")
fs/fuse/fuse_i.h +15 -0
index 69bcffaf4832..1df83eebda92 100644
@@ -63,6 +63,19 @@ struct fuse_forget_link {
 	struct fuse_forget_link *next;
 };
 
+/* Submount lookup tracking */
+struct fuse_submount_lookup {
+	/** Refcount */
+	refcount_t count;
+
+	/** Unique ID, which identifies the inode between userspace
+	 * and kernel */
+	u64 nodeid;
+
+	/** The request used for sending the FORGET message */
+	struct fuse_forget_link *forget;
+};
+
 /** FUSE inode */
 struct fuse_inode {
 	/** Inode data */
@@ -158,6 +171,8 @@ struct fuse_inode {
 	 */
 	struct fuse_inode_dax *dax;
 #endif
+	/** Submount specific lookup tracking */
+	struct fuse_submount_lookup *submount_lookup;
 };
 
 /** FUSE inode state bits */
fs/fuse/inode.c +72 -3

143 lines not on this page · raw message