mount: (new) be more pedantic about --make-*
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
5d451abbbf
commit
d789077846
|
@ -398,6 +398,15 @@ command (then mount(8) does not read /etc/mtab), then you have to use bind flag
|
||||||
.B mount -o remount,ro,bind
|
.B mount -o remount,ro,bind
|
||||||
.I olddir newdir
|
.I olddir newdir
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
|
Note that
|
||||||
|
.I remount,ro,bind
|
||||||
|
will create a read-only mountpoint (VFS entry), but the original filesystem suberblock
|
||||||
|
will be still writable, it means that the
|
||||||
|
.I olddir
|
||||||
|
will be writable, but the
|
||||||
|
.I newdir
|
||||||
|
will be read-only.
|
||||||
.RE
|
.RE
|
||||||
|
|
||||||
.B The move operation.
|
.B The move operation.
|
||||||
|
@ -434,6 +443,11 @@ unbindable mount is a private mount which cannot be cloned through a bind
|
||||||
operation. Detailed semantics is documented in Documentation/filesystems/sharedsubtree.txt
|
operation. Detailed semantics is documented in Documentation/filesystems/sharedsubtree.txt
|
||||||
file in the kernel source tree.
|
file in the kernel source tree.
|
||||||
|
|
||||||
|
Note that Linux kernel does not allow to change more propagation flags by one
|
||||||
|
.B mount (2)
|
||||||
|
syscall and the flags cannot be mixed with another mount options. It means that
|
||||||
|
more --make-* options cannot be used together or with another mount options.
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
.nf
|
.nf
|
||||||
.BI "mount --make-shared " mountpoint
|
.BI "mount --make-shared " mountpoint
|
||||||
|
|
|
@ -789,37 +789,37 @@ int main(int argc, char **argv)
|
||||||
mnt_context_enable_sloppy(cxt, TRUE);
|
mnt_context_enable_sloppy(cxt, TRUE);
|
||||||
break;
|
break;
|
||||||
case 'B':
|
case 'B':
|
||||||
oper = MS_BIND;
|
oper |= MS_BIND;
|
||||||
break;
|
break;
|
||||||
case 'M':
|
case 'M':
|
||||||
oper = MS_MOVE;
|
oper |= MS_MOVE;
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
oper = (MS_BIND | MS_REC);
|
oper |= (MS_BIND | MS_REC);
|
||||||
break;
|
break;
|
||||||
case MOUNT_OPT_SHARED:
|
case MOUNT_OPT_SHARED:
|
||||||
oper = MS_SHARED;
|
oper |= MS_SHARED;
|
||||||
break;
|
break;
|
||||||
case MOUNT_OPT_SLAVE:
|
case MOUNT_OPT_SLAVE:
|
||||||
oper = MS_SLAVE;
|
oper |= MS_SLAVE;
|
||||||
break;
|
break;
|
||||||
case MOUNT_OPT_PRIVATE:
|
case MOUNT_OPT_PRIVATE:
|
||||||
oper = MS_PRIVATE;
|
oper |= MS_PRIVATE;
|
||||||
break;
|
break;
|
||||||
case MOUNT_OPT_UNBINDABLE:
|
case MOUNT_OPT_UNBINDABLE:
|
||||||
oper = MS_UNBINDABLE;
|
oper |= MS_UNBINDABLE;
|
||||||
break;
|
break;
|
||||||
case MOUNT_OPT_RSHARED:
|
case MOUNT_OPT_RSHARED:
|
||||||
oper = (MS_SHARED | MS_REC);
|
oper |= (MS_SHARED | MS_REC);
|
||||||
break;
|
break;
|
||||||
case MOUNT_OPT_RSLAVE:
|
case MOUNT_OPT_RSLAVE:
|
||||||
oper = (MS_SLAVE | MS_REC);
|
oper |= (MS_SLAVE | MS_REC);
|
||||||
break;
|
break;
|
||||||
case MOUNT_OPT_RPRIVATE:
|
case MOUNT_OPT_RPRIVATE:
|
||||||
oper = (MS_PRIVATE | MS_REC);
|
oper |= (MS_PRIVATE | MS_REC);
|
||||||
break;
|
break;
|
||||||
case MOUNT_OPT_RUNBINDABLE:
|
case MOUNT_OPT_RUNBINDABLE:
|
||||||
oper = (MS_UNBINDABLE | MS_REC);
|
oper |= (MS_UNBINDABLE | MS_REC);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage(stderr);
|
usage(stderr);
|
||||||
|
@ -885,6 +885,12 @@ int main(int argc, char **argv)
|
||||||
usage(stderr);
|
usage(stderr);
|
||||||
|
|
||||||
if (oper) {
|
if (oper) {
|
||||||
|
if (!is_power_of_2(oper))
|
||||||
|
errx(MOUNT_EX_USAGE, _("propagation flags (--make-* or --bind options) are mutually exclusive"));
|
||||||
|
|
||||||
|
if (oper != MS_BIND && mnt_context_get_options(cxt))
|
||||||
|
errx(MOUNT_EX_USAGE, _("propagation flags (--make-* options) cannot be mixed with another mount options"));
|
||||||
|
|
||||||
/* MS_PROPAGATION operations, let's set the mount flags */
|
/* MS_PROPAGATION operations, let's set the mount flags */
|
||||||
mnt_context_set_mflags(cxt, oper);
|
mnt_context_set_mflags(cxt, oper);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue