Skip to contentSkip to conversation

remove pointless mount check

RFC In review Christoph Hellwig 2 participants 2 messages May 13, 2002 VFS

lore
Share & tools
lore
#0 lore raw

RFC 1/1 remove pointless mount check

I have no idea why but during 2.4 someone put a stupid check in the mount code to check whether device and mount point are the same and refuse to overmount if true.

There is no valid reason to keep this, especially as it breaks usefull setups (all user-writeable filesystems mounted -o noexec, overmount of /tmp in private namespace for Debian postinst scripts)

Al, is it okay to send the patch to Linux & Marcelo?

fs/namespace.c renamed from fs/namespace.c~ +0 -5
@@ -631,11 +631,6 @@
 	if (!check_mnt(nd->mnt))
 		goto unlock;
 
-	/* Refuse the same filesystem on the same mount point */
-	err = -EBUSY;
-	if (nd->mnt->mnt_sb == mnt->mnt_sb && nd->mnt->mnt_root == nd->dentry)
-		goto unlock;
-
 	mnt->mnt_flags = mnt_flags;
 	err = graft_tree(mnt, nd);
 unlock:
#1 lore raw
Quoted 7 lines · Christoph Hellwig

I have no idea why but during 2.4 someone put a stupid check in the mount code to check whether device and mount point are the same and refuse to overmount if true.

There is no valid reason to keep this, especially as it breaks usefull setups (all user-writeable filesystems mounted -o noexec, overmount of /tmp in private namespace for Debian postinst scripts)

There is, unfortunately - ask Alan and aeb for details.

However, I really wonder why would you want it. There is nothing that could be achieved by removal of that check - you can trivially get the same operation by

	mount --bind <mountpoint> <mountpoint>
	mount -o remount,<...> <mountpoint>