Re: [resend PATCH v2 2/2] fuse: ensure that submounts lookup their parent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 10 Oct 2023 at 04:35, Krister Johansen <kjlx@xxxxxxxxxxxxxxxxxx> wrote:

> If I manually traverse the path to the submount via something like cd
> and ls from the initial mount namespace, it'll stay referenced until I
> run a umount for the automounted path.  I'm reasonably sure it's the
> container setup that's causing the detaching.

Okay.  Can you please try the attached test patch.  It's not a proper
solution, but I think it's the right direction.

Thanks,
Miklos
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 2e4eb7cf26fb..d5f47203dfbc 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -1524,6 +1524,18 @@ static int fuse_get_tree_submount(struct fs_context *fsc)
 		return err;
 	}
 
+	spin_lock(&mp_fi->lock);
+	if (mp_fi->nlookup) {
+		struct fuse_inode *fi = get_fuse_inode(d_inode(sb->s_root));
+		mp_fi->nlookup--;
+		spin_unlock(&mp_fi->lock);
+		spin_lock(&fi->lock);
+		fi->nlookup++;
+		spin_unlock(&fi->lock);
+	} else {
+		spin_unlock(&mp_fi->lock);
+	}
+
 	down_write(&fc->killsb);
 	list_add_tail(&fm->fc_entry, &fc->mounts);
 	up_write(&fc->killsb);

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux