From patchwork Wed May 18 18:57:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 9121851 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E4E77BF29F for ; Wed, 18 May 2016 18:57:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C64462034A for ; Wed, 18 May 2016 18:57:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6A4A720328 for ; Wed, 18 May 2016 18:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753421AbcERS5o (ORCPT ); Wed, 18 May 2016 14:57:44 -0400 Received: from mail-pa0-f48.google.com ([209.85.220.48]:34800 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752371AbcERS5n (ORCPT ); Wed, 18 May 2016 14:57:43 -0400 Received: by mail-pa0-f48.google.com with SMTP id qo8so20709392pab.1 for ; Wed, 18 May 2016 11:57:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=osandov-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ddOz+1Y0ZT0xWKQfMKcE8u+IQYYRrWywjyWS8ia6BsM=; b=zmoF35oG/NhVdjLu87jItee2n9F2jdvxN6ooY9uJYWwt465k9FgnhIqmxLtqgOp3L0 w45erCYMJlHjenFVSy/B06sSHTwGbWwvbL7fbnP09lLdCw8QuqyCiPlJFJLmAK+iKy0R w8VguH/NyFioxMVmBRPfUoFKl0hjUG8Qwdvq1VHdJTawO+y1S9M0IxJ5EpobpU8zrkum YIW5BD6u5/PT0b14aUYdxoSJbH/ijmHVBOF9r8RQlAVv6aZYhYUIrK0i4HqKLtD1+lgC SZiQw7cLtPXgeJjRPQqJK3wEPanGAOuIbgp5N4Okg4TKcAAJqaR/NNKLxCAzVn634yhn lp5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ddOz+1Y0ZT0xWKQfMKcE8u+IQYYRrWywjyWS8ia6BsM=; b=bzuPfbykSdLYl8Q4XFjT/kfSHpFh9qpsjWbyPGLGzrhObLklLaYpFhWaXsgz6qTgZ9 Y1lw/5ajJnS33tYKYNj+2uTl/oomVnPIEKGYdE01j1dkqJeskL8vow4xji3ebjczNKXw 83TyF0SaSVtgVM+/3Sx6JP0xlhTVSggLZo85up2dr2jogu2YdKKKeSAmycxbmogVCo9o Q6T/kvkf+Pw1uXyXziYfFrdMbavDFvU+XSermev6GvIw3jVJMznbp2g3rRzQ6qnkcdc7 XI166kjSBBk8IA/f1bXpVdOcfsB9v8LaBf7kofOR9XjQ/yrbFfvuPDH6GAPg80t4gM7L 9VEg== X-Gm-Message-State: AOPr4FWTbifbwpthFWO/g4s9NReai5eS6DiOcgS8cKPBFJeHUdmvIgY4jXKpemJIJ2Ax6DrX X-Received: by 10.66.194.45 with SMTP id ht13mr13175023pac.41.1463597862164; Wed, 18 May 2016 11:57:42 -0700 (PDT) Received: from vader.thefacebook.com ([2620:10d:c090:200::9:535e]) by smtp.gmail.com with ESMTPSA id p1sm14051166paz.8.2016.05.18.11.57.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 May 2016 11:57:41 -0700 (PDT) From: Omar Sandoval X-Google-Original-From: Omar Sandoval To: Michael Kerrisk Cc: linux-man@vger.kernel.org, linux-fsdevel@vger.kernel.org, Omar Sandoval Subject: [PATCH v2 1/2] mount.2: document MS_REC and shared subtree flags Date: Wed, 18 May 2016 11:57:29 -0700 Message-Id: X-Mailer: git-send-email 2.8.2 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Omar Sandoval This stuff is all documented in the kernel source tree under Documentation/filesystems/sharedsubtree.txt, so let's document it properly for users. Signed-off-by: Omar Sandoval --- man2/mount.2 | 133 +++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 88 insertions(+), 45 deletions(-) diff --git a/man2/mount.2 b/man2/mount.2 index aa6558a87cd9..419e22da800f 100644 --- a/man2/mount.2 +++ b/man2/mount.2 @@ -83,44 +83,6 @@ and various mount flags .\" (as defined in \fI\fP for libc4 and libc5 .\" and in \fI\fP for glibc2) in the low order 16 bits: -.\" FIXME 2.6.15 added flags for "shared subtree" functionality: -.\" -.\" MS_PRIVATE -.\" All mounts are private by default. Previously shared mounts -.\" can be re-marked PRIVATE. -.\" MS_SHARED -.\" Mount points that are marked SHARED propagate mount events -.\" to one another after being cloned. -.\" mount --make-rshared ==> MS_SHARED | MS_REC -.\" MS_SLAVE -.\" A previously shared mount point can be marked SLAVE, meaning -.\" it receives propagated events, but does not propagate events. -.\" MS_UNBINDABLE -.\" mounts cannot be bound into other places, and will not be -.\" propagated into new subtrees -.\" -.\" These settings are visible in /proc/$$/mountinfo -.\" -.\" These need to be documented on this page. -.\" See: -.\" -.\" * Documentation/filesystems/sharedsubtree.txt -.\" -.\" * http://lwn.net/Articles/159077/ -.\" -.\" * https://www.kernel.org/doc/ols/2006/ols2006v2-pages-209-222.pdf -.\" Shared-Subtree Concept, Implementation, and Applications in Linux -.\" Al Viro viro@ftp.linux.org.uk -.\" Ram Pai linuxram@us.ibm.com -.\" -.\" * http://www.ibm.com/developerworks/linux/library/l-mount-namespaces/index.html -.\" Applying mount namespaces -.\" -.\" Uncover practical applications for advanced Linux mounts features -.\" Serge E. Hallyn (sergeh@us.ibm.com), Software Engineer, IBM -.\" Ram Pai (linuxram@us.ibm.com), Software Engineer, IBM -.\" Date: 17 Sep 2007 -.\" .\" FIXME 2.6.25 Added MS_I_VERSION, which needs to be documented. .\" .TP @@ -240,12 +202,34 @@ programs from this filesystem. .\" (This is a security feature to prevent users executing set-user-ID and .\" set-group-ID programs from removable disk devices.) .TP +.BR MS_PRIVATE " (since Linux 2.6.15)" +Set the mount propagation on this mountpoint to private. Mounts will not +propagate to or from replicated subtrees. +This flag can only be combined with +.B MS_REC +and +.BR MS_SILENT . +The +.IR source , +.IR filesystemtype , +and +.IR data +arguments are ignored. +.TP .B MS_RDONLY Mount filesystem read-only. -.\" -.\" FIXME Document MS_REC, available since 2.4.11. -.\" This flag has meaning in conjunction with MS_BIND and -.\" also with the shared subtree flags. +.TP +.BR MS_REC " (since Linux 2.4.11)" +When passed together with +.BR MS_BIND , +recursively bind mount all mountpoints underneath the source subtree. +When passed together with a shared subtree flag (one of +.BR MS_PRIVATE , +.BR MS_SHARED , +.BR MS_SLAVE ", or" +.BR MS_UNBINDABLE ), +recursively apply the shared subtree setting to all mountpoints +underneath the target subtree. .TP .BR MS_RELATIME " (since Linux 2.6.20)" When a file on this filesystem is accessed, @@ -306,6 +290,21 @@ and, additionally, before kernel 2.4.10, the following could also be changed: .BR MS_NODEV , .BR MS_NOEXEC . .TP +.BR MS_SHARED " (since Linux 2.6.15)" +Set the mount propagation on this mountpoint to shared. +Mounts will be propagated to and from replicated subtrees +(i.e., all replicas will continue to be the same). +This flag can only be combined with +.B MS_REC +and +.BR MS_SILENT . +The +.IR source , +.IR filesystemtype , +and +.IR data +arguments are ignored. +.TP .BR MS_SILENT " (since Linux 2.6.17)" Suppress the display of certain .RI ( printk ()) @@ -314,6 +313,28 @@ This flag supersedes the misnamed and obsolete .BR MS_VERBOSE flag (available since Linux 2.4.12), which has the same meaning. .TP +.BR MS_SLAVE " (since Linux 2.6.15)" +Make this mountpoint a slave of its source mountpoint, referred to as +its master. +Mounts made underneath the master subtree will be propagated to this +subtree, but mounts made underneath this subtree will not be propagated +back to the master. +Note that a slave mountpoint can still have either private propagation +(see +.BR MS_PRIVATE ) +or shared propagation (see +.BR MS_SHARED ). +This flag can only be combined with +.B MS_REC +and +.BR MS_SILENT . +The +.IR source , +.IR filesystemtype , +and +.IR data +arguments are ignored. +.TP .BR MS_STRICTATIME " (since Linux 2.6.30)" Always update the last access time (atime) when files on this filesystem are accessed. @@ -331,6 +352,21 @@ the flag to .BR open (2) was specified for all file opens to this filesystem). +.TP +.BR MS_UNBINDABLE " (since Linux 2.6.15)" +Set the mount propagation on this mountpoint to private (see +.BR MS_PRIVATE ) +and disallow bind mounts with this mountpoint as the source. +This flag can only be combined with +.B MS_REC +and +.BR MS_SILENT . +The +.IR source , +.IR filesystemtype , +and +.IR data +arguments are ignored. .PP From Linux 2.4 onward, the .BR MS_NODEV ", " MS_NOEXEC ", and " MS_NOSUID @@ -408,6 +444,11 @@ Or, a move was attempted, but .I source was not a mount point, or was \(aq/\(aq. +Or, more than one shared subtree flag was given. +Or, a shared subtree flag was combined with a flag other than +.B MS_REC +or +.BR MS_SILENT . .TP .B ELOOP Too many links encountered during pathname resolution. @@ -457,11 +498,13 @@ The definitions of .BR MS_MOVE , .BR MS_REC , .BR MS_RELATIME , +.BR MS_STRICTATIME , +.BR MS_PRIVATE , +.BR MS_SHARED , +.BR MS_SLAVE , and -.BR MS_STRICTATIME +.BR MS_UNBINDABLE were added to glibc headers in version 2.12. -.\" FIXME . Definitions of the so-far-undocumented MS_UNBINDABLE, MS_PRIVATE, -.\" MS_SHARED, and MS_SLAVE were (also) only added to glibc headers in 2.12. .SH CONFORMING TO This function is Linux-specific and should not be used in programs intended to be portable.