Эх сурвалжийг харах

mnt: Clear mnt_expire during pivot_root

When inspecting the pivot_root and the current mount expiry logic I
realized that pivot_root fails to clear like mount move does.

Add the missing line in case someone does the interesting feat of
moving an expirable submount.  This gives a strong guarantee that root
of the filesystem tree will never expire.

Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Eric W. Biederman 10 жил өмнө
parent
commit
4fed655c41
1 өөрчлөгдсөн 2 нэмэгдсэн , 0 устгасан
  1. 2 0
      fs/namespace.c

+ 2 - 0
fs/namespace.c

@@ -2967,6 +2967,8 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
 	/* mount new_root on / */
 	/* mount new_root on / */
 	attach_mnt(new_mnt, real_mount(root_parent.mnt), root_mp);
 	attach_mnt(new_mnt, real_mount(root_parent.mnt), root_mp);
 	touch_mnt_namespace(current->nsproxy->mnt_ns);
 	touch_mnt_namespace(current->nsproxy->mnt_ns);
+	/* A moved mount should not expire automatically */
+	list_del_init(&new_mnt->mnt_expire);
 	unlock_mount_hash();
 	unlock_mount_hash();
 	chroot_fs_refs(&root, &new);
 	chroot_fs_refs(&root, &new);
 	put_mountpoint(root_mp);
 	put_mountpoint(root_mp);