From 050f349421bf52a5b3d1c359e2685bc30fff3ab2 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Sun, 4 Mar 2018 11:47:47 +0100 Subject: [PATCH] mount.2: ERRORS: add EBUSY for the case of trying to stack same mount twice It is not possible to consecutively stack mounts of the same source+target inside the same mount namespace. For example, if procfs was already mounted against /proc in this mount namespace: $ sudo mount -t proc none /proc mount: /proc: none already mounted or mount point busy. See the following code in fs/namespace.c: /* Refuse the same filesystem on the same mount point */ err = -EBUSY; if (path->mnt->mnt_sb == newmnt->mnt.mnt_sb && path->mnt->mnt_root == path->dentry) goto unlock; Signed-off-by: Michael Kerrisk --- man2/mount.2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/man2/mount.2 b/man2/mount.2 index db45306da..4fb6097ec 100644 --- a/man2/mount.2 +++ b/man2/mount.2 @@ -590,6 +590,14 @@ option. is already mounted. .TP .B EBUSY +An attempt was made to stack a new mount directly on +top of an existing mount point that was created in this +mount namespace with the same +.I source +and +.IR target . +.TP +.B EBUSY .I source cannot be remounted read-only, because it still holds files open for writing.