diff options
author | Csaba Henk <csaba@redhat.com> | 2017-01-03 15:26:30 +0100 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2017-04-27 17:38:48 +0000 |
commit | e624e7fe38a784363c57108c73487d83a7bda562 (patch) | |
tree | 65013ea9801d44f89095f69c519b997214ae5f67 /contrib/macfuse | |
parent | ec7a0c7eefacc68532bdc909f05a01eca8b3139d (diff) |
fuse: clean up mount flag processing
In general, when one invokes a mount helper program -- basically
anything that mounts something based on its command line, so thinking of
mount(8), mount.<fs-type> or fusermount, but also of FUSE servers in
general, including glusterfs -- the command line arguments that are to
affect mount(2) are mapped to a bitmask called the mount flags, which is
passed to mount(2), so that the kernel can interpret the flag bits and
adjusts properties of the mount accordingly.
There is a traditional syntax for this mechanism as implemented in
mount(8): one passes "-ocomma,separated,mount,options" and the
individual option name strings are mapped to flag bits in mount(8).
FUSE further explores this idea and typically the FUSE server command
lines allow further option names to be used in the "-ooption,name,list"
which are then separated from the kernel sanctioned option names (to
which we'll refer as "system mount options") and are passed to a
platform specific lower level fuse mount helper interface.
The separation of system mount option names and FUSE specific option
names is also platform specific, so the general mount interface
function, which in case of glusterfs is gf_fuse_mount(), should abstract
this away.
Therefore we change the signature of this function from
int gf_fuse_mount (const char *mountpoint, char *fsname,
unsigned long mountflags, char *mnt_param,
pid_t *mtab_pid, int status_fd);
to
int gf_fuse_mount (const char *mountpoint, char *fsname,
char *mnt_param, pid_t *mtab_pid,
int status_fd);
and deal with flag extraction in platform specific mount code. Note that
the sole purpose of the mountflags argument was to indicate read-only
mounting. The other system mount option names were expected to reside in
the comma-separated mnt_param string, but they were not properly
processed (see the referred BUG). With the new gf_fuse_mount signature
read-only mounting is to be indicated as a "ro" component in mnt_param.
- For Darwin, which has a dedicated, separate gf_fuse_mount
implementation, gf_fuse_mount was ignoring mountflags, so only the
signature had to to be adjusted. However, as bonus, we gain read-only
support for Darwin, which was missing so far, given that it was
indicated via the ignored mountflags. Darwin's low level mount helper
relies on the "ro" component of the option string, which agrees with
the new calling convention of gf_fuse_mount.
- On Linux, system mount option name handling (apart from the
distinguished read-only option) used to have the inadvertent side
effect of adding "nosuid,nodev" as indicated in BUG; since
Ia89d975d1e27fcfa5ab2036ba546aa8fa0d2d1b0 this side effect is removed,
but system mount option name handling was left broken (passing system
mount options other than "ro" fails to mount).
- On other platforms, system mount option name handling is broken
(expect for the distinguished read-only option).
As of this change, in the general (non-Darwin) implementation of
gf_fuse_mount we take care of proper separation of system mount names
and their conversion to mount flags. For Linux, we adopt the conversion
table from FUSE upstream. For other systems we just provide a best
effort to support those system mount options which are understood across
all Unices (nosuid,nodev,noatime,noexec,ro). (This can be improved later
to provide proper plaform support.)
BUG: 1297182
Change-Id: I5d10b5df46feba7a02bf5bf1018db69e6b52260a
Signed-off-by: Csaba Henk <csaba@redhat.com>
Reviewed-on: https://review.gluster.org/16313
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'contrib/macfuse')
-rw-r--r-- | contrib/macfuse/mount_darwin.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/contrib/macfuse/mount_darwin.c b/contrib/macfuse/mount_darwin.c index 10eff204bc6..f4ecacad86a 100644 --- a/contrib/macfuse/mount_darwin.c +++ b/contrib/macfuse/mount_darwin.c @@ -42,8 +42,7 @@ gf_log ("glusterfs-fuse", GF_LOG_ERROR, ## __VA_ARGS__) int -gf_fuse_mount (const char *mountpoint, char *fsname, - unsigned long mountflags, char *mnt_param, +gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param, pid_t *mnt_pid, int status_fd) /* Not used on OS X */ { int fd = 0; |