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 <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2018-03-04 11:47:47 +01:00
parent 4a870c6849
commit 050f349421
1 changed files with 8 additions and 0 deletions

View File

@ -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.