summaryrefslogtreecommitdiffstats
path: root/upstream/fedora-rawhide/man2/umount.2
diff options
context:
space:
mode:
Diffstat (limited to 'upstream/fedora-rawhide/man2/umount.2')
-rw-r--r--upstream/fedora-rawhide/man2/umount.2214
1 files changed, 214 insertions, 0 deletions
diff --git a/upstream/fedora-rawhide/man2/umount.2 b/upstream/fedora-rawhide/man2/umount.2
new file mode 100644
index 00000000..85a37b7d
--- /dev/null
+++ b/upstream/fedora-rawhide/man2/umount.2
@@ -0,0 +1,214 @@
+.\" Copyright (C) 1993 Rickard E. Faith <faith@cs.unc.edu>
+.\" and Copyright (C) 1994 Andries E. Brouwer <aeb@cwi.nl>
+.\" and Copyright (C) 2002, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
+.\"
+.\" SPDX-License-Identifier: Linux-man-pages-copyleft
+.\"
+.\" 2008-10-06, mtk: Created this as a new page by splitting
+.\" umount/umount2 material out of mount.2
+.\"
+.TH umount 2 2023-10-31 "Linux man-pages 6.06"
+.SH NAME
+umount, umount2 \- unmount filesystem
+.SH LIBRARY
+Standard C library
+.RI ( libc ", " \-lc )
+.SH SYNOPSIS
+.nf
+.B "#include <sys/mount.h>"
+.P
+.BI "int umount(const char *" target );
+.BI "int umount2(const char *" target ", int " flags );
+.fi
+.SH DESCRIPTION
+.BR umount ()
+and
+.BR umount2 ()
+remove the attachment of the (topmost) filesystem mounted on
+.IR target .
+.\" Note: the kernel naming differs from the glibc naming
+.\" umount2 is the glibc name for what the kernel now calls umount
+.\" and umount is the glibc name for oldumount
+.P
+Appropriate privilege (Linux: the
+.B CAP_SYS_ADMIN
+capability) is required to unmount filesystems.
+.P
+Linux 2.1.116 added the
+.BR umount2 ()
+system call, which, like
+.BR umount (),
+unmounts a target, but allows additional
+.I flags
+controlling the behavior of the operation:
+.TP
+.BR MNT_FORCE " (since Linux 2.1.116)"
+Ask the filesystem to abort pending requests before attempting the
+unmount.
+This may allow the unmount to complete without waiting
+for an inaccessible server, but could cause data loss.
+If, after aborting requests,
+some processes still have active references to the filesystem,
+the unmount will still fail.
+As at Linux 4.12,
+.B MNT_FORCE
+is supported only on the following filesystems:
+9p (since Linux 2.6.16),
+ceph (since Linux 2.6.34),
+cifs (since Linux 2.6.12),
+fuse (since Linux 2.6.16),
+lustre (since Linux 3.11),
+and NFS (since Linux 2.1.116).
+.TP
+.BR MNT_DETACH " (since Linux 2.4.11)"
+Perform a lazy unmount: make the mount unavailable for new
+accesses, immediately disconnect the filesystem and all filesystems
+mounted below it from each other and from the mount table, and
+actually perform the unmount when the mount ceases to be busy.
+.TP
+.BR MNT_EXPIRE " (since Linux 2.6.8)"
+Mark the mount as expired.
+If a mount is not currently in use, then an initial call to
+.BR umount2 ()
+with this flag fails with the error
+.BR EAGAIN ,
+but marks the mount as expired.
+The mount remains expired as long as it isn't accessed
+by any process.
+A second
+.BR umount2 ()
+call specifying
+.B MNT_EXPIRE
+unmounts an expired mount.
+This flag cannot be specified with either
+.B MNT_FORCE
+or
+.BR MNT_DETACH .
+.TP
+.BR UMOUNT_NOFOLLOW " (since Linux 2.6.34)"
+.\" Later added to Linux 2.6.33-stable
+Don't dereference
+.I target
+if it is a symbolic link.
+This flag allows security problems to be avoided in set-user-ID-\fIroot\fP
+programs that allow unprivileged users to unmount filesystems.
+.SH RETURN VALUE
+On success, zero is returned.
+On error, \-1 is returned, and
+.I errno
+is set to indicate the error.
+.SH ERRORS
+The error values given below result from filesystem type independent
+errors.
+Each filesystem type may have its own special errors and its
+own special behavior.
+See the Linux kernel source code for details.
+.TP
+.B EAGAIN
+A call to
+.BR umount2 ()
+specifying
+.B MNT_EXPIRE
+successfully marked an unbusy filesystem as expired.
+.TP
+.B EBUSY
+.I target
+could not be unmounted because it is busy.
+.TP
+.B EFAULT
+.I target
+points outside the user address space.
+.TP
+.B EINVAL
+.I target
+is not a mount point.
+.TP
+.B EINVAL
+.I target
+is locked; see
+.BR mount_namespaces (7).
+.TP
+.B EINVAL
+.BR umount2 ()
+was called with
+.B MNT_EXPIRE
+and either
+.B MNT_DETACH
+or
+.BR MNT_FORCE .
+.TP
+.BR EINVAL " (since Linux 2.6.34)"
+.BR umount2 ()
+was called with an invalid flag value in
+.IR flags .
+.TP
+.B ENAMETOOLONG
+A pathname was longer than
+.BR MAXPATHLEN .
+.TP
+.B ENOENT
+A pathname was empty or had a nonexistent component.
+.TP
+.B ENOMEM
+The kernel could not allocate a free page to copy filenames or data into.
+.TP
+.B EPERM
+The caller does not have the required privileges.
+.SH STANDARDS
+Linux.
+.SH HISTORY
+.B MNT_DETACH
+and
+.B MNT_EXPIRE
+.\" http://sourceware.org/bugzilla/show_bug.cgi?id=10092
+are available since glibc 2.11.
+.P
+The original
+.BR umount ()
+function was called as \fIumount(device)\fP and would return
+.B ENOTBLK
+when called with something other than a block device.
+In Linux 0.98p4, a call \fIumount(dir)\fP was added, in order to
+support anonymous devices.
+In Linux 2.3.99-pre7, the call \fIumount(device)\fP was removed,
+leaving only \fIumount(dir)\fP (since now devices can be mounted
+in more than one place, so specifying the device does not suffice).
+.SH NOTES
+.SS umount() and shared mounts
+Shared mounts cause any mount activity on a mount, including
+.BR umount ()
+operations, to be forwarded to every shared mount in the
+peer group and every slave mount of that peer group.
+This means that
+.BR umount ()
+of any peer in a set of shared mounts will cause all of its
+peers to be unmounted and all of their slaves to be unmounted as well.
+.P
+This propagation of unmount activity can be particularly surprising
+on systems where every mount is shared by default.
+On such systems,
+recursively bind mounting the root directory of the filesystem
+onto a subdirectory and then later unmounting that subdirectory with
+.B MNT_DETACH
+will cause every mount in the mount namespace to be lazily unmounted.
+.P
+To ensure
+.BR umount ()
+does not propagate in this fashion,
+the mount may be remounted using a
+.BR mount (2)
+call with a
+.I mount_flags
+argument that includes both
+.B MS_REC
+and
+.B MS_PRIVATE
+prior to
+.BR umount ()
+being called.
+.SH SEE ALSO
+.BR mount (2),
+.BR mount_namespaces (7),
+.BR path_resolution (7),
+.BR mount (8),
+.BR umount (8)