<feed xmlns='http://www.w3.org/2005/Atom'>
<title>glusterfs.git/contrib/fuse-lib, branch v7.4</title>
<subtitle></subtitle>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/'/>
<entry>
<title>libglusterfs: Move devel headers under glusterfs directory</title>
<updated>2018-12-05T21:47:04+00:00</updated>
<author>
<name>ShyamsundarR</name>
<email>srangana@redhat.com</email>
</author>
<published>2018-11-29T19:08:06+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=20ef211cfa5b5fcc437484a879fdc5d4c66bbaf5'/>
<id>20ef211cfa5b5fcc437484a879fdc5d4c66bbaf5</id>
<content type='text'>
libglusterfs devel package headers are referenced in code using
include semantics for a program, this while it works can be better
especially when dealing with out of tree xlator builds or in
general out of tree devel package usage.

Towards this, the following changes are done,
- moved all devel headers under a glusterfs directory
- Included these headers using system header notation &lt;&gt; in all
code outside of libglusterfs
- Included these headers using own program notation "" within
libglusterfs

This change although big, is just moving around the headers and
making it correct when including these headers from other sources.

This helps us correctly include libglusterfs includes without
namespace conflicts.

Change-Id: Id2a98854e671a7ee5d73be44da5ba1a74252423b
Updates: bz#1193929
Signed-off-by: ShyamsundarR &lt;srangana@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
libglusterfs devel package headers are referenced in code using
include semantics for a program, this while it works can be better
especially when dealing with out of tree xlator builds or in
general out of tree devel package usage.

Towards this, the following changes are done,
- moved all devel headers under a glusterfs directory
- Included these headers using system header notation &lt;&gt; in all
code outside of libglusterfs
- Included these headers using own program notation "" within
libglusterfs

This change although big, is just moving around the headers and
making it correct when including these headers from other sources.

This helps us correctly include libglusterfs includes without
namespace conflicts.

Change-Id: Id2a98854e671a7ee5d73be44da5ba1a74252423b
Updates: bz#1193929
Signed-off-by: ShyamsundarR &lt;srangana@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>multiple files: remove unndeeded memset()</title>
<updated>2018-08-29T17:31:11+00:00</updated>
<author>
<name>Yaniv Kaul</name>
<email>ykaul@redhat.com</email>
</author>
<published>2018-08-24T17:59:30+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=cbe133c832fd9907619a1231aa3d9dda1330ae74'/>
<id>cbe133c832fd9907619a1231aa3d9dda1330ae74</id>
<content type='text'>
This is a squash of multiple commits:

contrib/fuse-lib/misc.c: remove unneeded memset()

All flock variables are properly set, no need to memset it.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I8e0512c5a88daadb0e587f545fdb9b32ca8858a2

libglusterfs/src/{client_t|fd|inode|stack}.c: remove some memset()

I don't think there's a need for any of them.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I2be9ccc3a5cb5da51a92af73488cdabd1c527f59

libglusterfs/src/xlator.c: remove unneeded memset()

All xl-&gt;mem_acct members are properly set,
no need to memset it.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I7f264cd47e7a06255a3f3943c583de77ae8e3147

xlators/cluster/afr/src/afr-self-heal-common.c: remove unneeded memset()

Since we are going over the whole array anyway, initialize it
properly, to either 1 or 0.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: Ied4210388976b6a7a2e91cc3de334534d6fef201

xlators/cluster/dht/src/dht-common.c: remove unneeded memset()

Since we are going over the whole array anyway it is initialized
properly.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: Idc436d2bd0563b6582908d7cbebf9dbc66a42c9a

xlators/cluster/ec/src/ec-helpers.c: remove unneeded memset()

Since we are going over the whole array anyway it is initialized
properly.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I81bf971f7fcecb4599e807d37f426f55711978fa

xlators/mgmt/glusterd/src/glusterd-volgen.c: remove some memset()

I don't think there's a need for any of them.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I476ea59ba53546b5153c269692cd5383da81ce2d

xlators/mgmt/glusterd/src/glusterd-geo-rep.c: read() in 4K blocks

The current 1K seems small. 4K is usually better (in Linux).

Also remove a memset() that I don't think is needed between reads.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I5fb7950c92d282948376db14919ad12e589eac2b

xlators/storage/posix/src/posix-{gfid-path|inode-fd-ops}.c: remove memset()
before sys_*xattr() functions.

I don't see a reason to memset the array sent to the functions
sys_llistxattr(), sys_lgetxattr(), sys_lgetxattr(), sys_flistxattr(),
sys_fgetxattr().

(Note: it's unclear to me why we are calling sys_*txattr() functions with
XATTR_VAL_BUF_SIZE-1 size instead of XATTR_VAL_BUF_SIZE ).

Only compile-tested!

Change-Id: Ief2103b56ba6c71e40ed343a93684eef6b771346
updates: bz#1193929
Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is a squash of multiple commits:

contrib/fuse-lib/misc.c: remove unneeded memset()

All flock variables are properly set, no need to memset it.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I8e0512c5a88daadb0e587f545fdb9b32ca8858a2

libglusterfs/src/{client_t|fd|inode|stack}.c: remove some memset()

I don't think there's a need for any of them.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I2be9ccc3a5cb5da51a92af73488cdabd1c527f59

libglusterfs/src/xlator.c: remove unneeded memset()

All xl-&gt;mem_acct members are properly set,
no need to memset it.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I7f264cd47e7a06255a3f3943c583de77ae8e3147

xlators/cluster/afr/src/afr-self-heal-common.c: remove unneeded memset()

Since we are going over the whole array anyway, initialize it
properly, to either 1 or 0.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: Ied4210388976b6a7a2e91cc3de334534d6fef201

xlators/cluster/dht/src/dht-common.c: remove unneeded memset()

Since we are going over the whole array anyway it is initialized
properly.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: Idc436d2bd0563b6582908d7cbebf9dbc66a42c9a

xlators/cluster/ec/src/ec-helpers.c: remove unneeded memset()

Since we are going over the whole array anyway it is initialized
properly.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I81bf971f7fcecb4599e807d37f426f55711978fa

xlators/mgmt/glusterd/src/glusterd-volgen.c: remove some memset()

I don't think there's a need for any of them.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I476ea59ba53546b5153c269692cd5383da81ce2d

xlators/mgmt/glusterd/src/glusterd-geo-rep.c: read() in 4K blocks

The current 1K seems small. 4K is usually better (in Linux).

Also remove a memset() that I don't think is needed between reads.

Only compile-tested!

Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;

Change-Id: I5fb7950c92d282948376db14919ad12e589eac2b

xlators/storage/posix/src/posix-{gfid-path|inode-fd-ops}.c: remove memset()
before sys_*xattr() functions.

I don't see a reason to memset the array sent to the functions
sys_llistxattr(), sys_lgetxattr(), sys_lgetxattr(), sys_flistxattr(),
sys_fgetxattr().

(Note: it's unclear to me why we are calling sys_*txattr() functions with
XATTR_VAL_BUF_SIZE-1 size instead of XATTR_VAL_BUF_SIZE ).

Only compile-tested!

Change-Id: Ief2103b56ba6c71e40ed343a93684eef6b771346
updates: bz#1193929
Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>{mount-common|fusermount|mount_darwin|umountd}.c: strncpy()-&gt;sprintf(), reduce strlen()'s</title>
<updated>2018-08-24T16:26:36+00:00</updated>
<author>
<name>Yaniv Kaul</name>
<email>ykaul@redhat.com</email>
</author>
<published>2018-08-21T15:31:03+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=a2c562eb4046ce88c8c2f2d250b0079942e7f10a'/>
<id>a2c562eb4046ce88c8c2f2d250b0079942e7f10a</id>
<content type='text'>
strncpy may not be very efficient for short strings copied into
a large buffer: If the length of src is less than n,
strncpy() writes additional null bytes to dest to ensure
that a total of n bytes are written.

Instead, use snprintf().

Also:
- save the result of strlen() and re-use it when possible.
- move from strlen to SLEN (sizeof() ) for const strings.

Compile-tested only!

Change-Id: I369209b36d8356c3fe00d32f8bf56e74cf9963db
updates: bz#1193929
Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
strncpy may not be very efficient for short strings copied into
a large buffer: If the length of src is less than n,
strncpy() writes additional null bytes to dest to ensure
that a total of n bytes are written.

Instead, use snprintf().

Also:
- save the result of strlen() and re-use it when possible.
- move from strlen to SLEN (sizeof() ) for const strings.

Compile-tested only!

Change-Id: I369209b36d8356c3fe00d32f8bf56e74cf9963db
updates: bz#1193929
Signed-off-by: Yaniv Kaul &lt;ykaul@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't use hardcoded /sbin, /usr/bin etc. paths. Fixes #1450546</title>
<updated>2018-05-03T11:47:03+00:00</updated>
<author>
<name>Niklas Hambüchen</name>
<email>mail@nh2.me</email>
</author>
<published>2017-05-13T00:45:49+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=cfa4ff1417aba42f0dff3fe9d8e17acdaae4ffb2'/>
<id>cfa4ff1417aba42f0dff3fe9d8e17acdaae4ffb2</id>
<content type='text'>
Instead, rely on programs to be in PATH, as gluster already
does in many places across its code base.

Change-Id: Id21152fe42f5b67205d8f1571b0656c4d5f74246
BUG: 1450546
Signed-off-by: Niklas Hambuechen &lt;mail@nh2.me&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Instead, rely on programs to be in PATH, as gluster already
does in many places across its code base.

Change-Id: Id21152fe42f5b67205d8f1571b0656c4d5f74246
BUG: 1450546
Signed-off-by: Niklas Hambuechen &lt;mail@nh2.me&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse-lib: checked_return coverity fix</title>
<updated>2017-11-16T08:07:19+00:00</updated>
<author>
<name>Kartik_Burmee</name>
<email>kburmee@redhat.com</email>
</author>
<published>2017-11-14T11:20:49+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=3bf2ba3fb4910a4e9ba6ea7850f3737c9c285fe8'/>
<id>3bf2ba3fb4910a4e9ba6ea7850f3737c9c285fe8</id>
<content type='text'>
issue: Calling "chdir" without checking return value

function: gf_fuse_unmount_daemon

fix: typecasted return value of function to void.

Change-Id: I5f06fbe886a35c2d4c9f763eeb01771e9451f232
BUG: 789278
Signed-off-by: Kartik_Burmee &lt;kburmee@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
issue: Calling "chdir" without checking return value

function: gf_fuse_unmount_daemon

fix: typecasted return value of function to void.

Change-Id: I5f06fbe886a35c2d4c9f763eeb01771e9451f232
BUG: 789278
Signed-off-by: Kartik_Burmee &lt;kburmee@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>contrib/fuse-lib: Fix compiler warning within switch case</title>
<updated>2017-08-09T12:58:07+00:00</updated>
<author>
<name>Anoop C S</name>
<email>anoopcs@redhat.com</email>
</author>
<published>2017-07-27T08:45:22+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=071559cb4745669c87198128ab73d7af2017e9bd'/>
<id>071559cb4745669c87198128ab73d7af2017e9bd</id>
<content type='text'>
Following warning is shown when compiled with gcc v7:

mount.c: In function ‘gf_fuse_unmount_daemon’:
mount.c:98:22: warning: statement will never be executed [-Wswitch-unreachable]
		char c = 0;
		     ^
 CCLD fuse.la

We just need to move the relevant declaration statements to that switch
case where it is valid and is being used.

Change-Id: I8e50cc7cfcfc3bc88218cd69abbf516c08ee1648
Updates: #259
Signed-off-by: Anoop C S &lt;anoopcs@redhat.com&gt;
Reviewed-on: https://review.gluster.org/17878
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Jeff Darcy &lt;jeff@pl.atyp.us&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Following warning is shown when compiled with gcc v7:

mount.c: In function ‘gf_fuse_unmount_daemon’:
mount.c:98:22: warning: statement will never be executed [-Wswitch-unreachable]
		char c = 0;
		     ^
 CCLD fuse.la

We just need to move the relevant declaration statements to that switch
case where it is valid and is being used.

Change-Id: I8e50cc7cfcfc3bc88218cd69abbf516c08ee1648
Updates: #259
Signed-off-by: Anoop C S &lt;anoopcs@redhat.com&gt;
Reviewed-on: https://review.gluster.org/17878
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Jeff Darcy &lt;jeff@pl.atyp.us&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: implement "-oauto_unmount"</title>
<updated>2017-05-23T13:21:25+00:00</updated>
<author>
<name>Csaba Henk</name>
<email>csaba@redhat.com</email>
</author>
<published>2017-05-09T17:26:40+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=461888bb63b2409f8245c7766aa799ca22f734e6'/>
<id>461888bb63b2409f8245c7766aa799ca22f734e6</id>
<content type='text'>
libfuse has an auto_unmount option which,
if enabled, ensures that the file system
is unmounted at FUSE server termination
by running a separate monitor process
that performs the unmount when that
occurs. (This feature would probably
better be called "robust auto-unmount",
as FUSE servers usually do try to unmount
their file systems upon termination,
it's just this mechanism is not crash
resilient.)

This change implements that option and
behavior for glusterfs.

Note that "auto unmount" (robust or not) is
a leaky abstraction, as the kernel cannot
guarantee that at the path where the FUSE
fs is mounted is actually the toplevel mount
at the time of the umount(2) call, for
multiple reasons, among others, see:

  fuse-devel: "fuse: feasible to distinguish between umount and abort?"
  http://fuse.996288.n3.nabble.com/fuse-feasible-to-distinguish-between-umount-and-abort-tt14358.html
  https://github.com/libfuse/libfuse/issues/122

Updates #153

Change-Id: Ia4432580c9fd2c156d9c73c3a44f4bfd42437599
Signed-off-by: Csaba Henk &lt;csaba@redhat.com&gt;
Reviewed-on: https://review.gluster.org/17230
Tested-by: Amar Tumballi &lt;amarts@redhat.com&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Amar Tumballi &lt;amarts@redhat.com&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
libfuse has an auto_unmount option which,
if enabled, ensures that the file system
is unmounted at FUSE server termination
by running a separate monitor process
that performs the unmount when that
occurs. (This feature would probably
better be called "robust auto-unmount",
as FUSE servers usually do try to unmount
their file systems upon termination,
it's just this mechanism is not crash
resilient.)

This change implements that option and
behavior for glusterfs.

Note that "auto unmount" (robust or not) is
a leaky abstraction, as the kernel cannot
guarantee that at the path where the FUSE
fs is mounted is actually the toplevel mount
at the time of the umount(2) call, for
multiple reasons, among others, see:

  fuse-devel: "fuse: feasible to distinguish between umount and abort?"
  http://fuse.996288.n3.nabble.com/fuse-feasible-to-distinguish-between-umount-and-abort-tt14358.html
  https://github.com/libfuse/libfuse/issues/122

Updates #153

Change-Id: Ia4432580c9fd2c156d9c73c3a44f4bfd42437599
Signed-off-by: Csaba Henk &lt;csaba@redhat.com&gt;
Reviewed-on: https://review.gluster.org/17230
Tested-by: Amar Tumballi &lt;amarts@redhat.com&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Amar Tumballi &lt;amarts@redhat.com&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>libglusterfs: extract some functionality to functions</title>
<updated>2017-05-23T13:21:20+00:00</updated>
<author>
<name>Csaba Henk</name>
<email>csaba@redhat.com</email>
</author>
<published>2017-05-09T17:23:18+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=98db583e9b2e7aa8e095a75a6bb5f42b0d65ae79'/>
<id>98db583e9b2e7aa8e095a75a6bb5f42b0d65ae79</id>
<content type='text'>
- code in run.c to close all file descriptors,
  except for specified ones is extracted to

    int close_fds_except (int *fdv, size_t count);

- tokenizing and editing a string that consists
  of comma-separated tokens (as done eg. in
  mount_param_to_flag() of contrib/fuse/mount.c
  is abstacted into the following API:

    char *token_iter_init (char *str, char sep, token_iter_t *tit);
    gf_boolean_t next_token (char **tokenp, token_iter_t *tit);
    void drop_token (char *token, token_iter_t *tit);

Updates #153

Change-Id: I7cb5bda38f680f08882e2a7ef84f9142ffaa54eb
Signed-off-by: Csaba Henk &lt;csaba@redhat.com&gt;
Reviewed-on: https://review.gluster.org/17229
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Amar Tumballi &lt;amarts@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
- code in run.c to close all file descriptors,
  except for specified ones is extracted to

    int close_fds_except (int *fdv, size_t count);

- tokenizing and editing a string that consists
  of comma-separated tokens (as done eg. in
  mount_param_to_flag() of contrib/fuse/mount.c
  is abstacted into the following API:

    char *token_iter_init (char *str, char sep, token_iter_t *tit);
    gf_boolean_t next_token (char **tokenp, token_iter_t *tit);
    void drop_token (char *token, token_iter_t *tit);

Updates #153

Change-Id: I7cb5bda38f680f08882e2a7ef84f9142ffaa54eb
Signed-off-by: Csaba Henk &lt;csaba@redhat.com&gt;
Reviewed-on: https://review.gluster.org/17229
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Amar Tumballi &lt;amarts@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: clean up mount flag processing</title>
<updated>2017-04-27T17:38:48+00:00</updated>
<author>
<name>Csaba Henk</name>
<email>csaba@redhat.com</email>
</author>
<published>2017-01-03T14:26:30+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=e624e7fe38a784363c57108c73487d83a7bda562'/>
<id>e624e7fe38a784363c57108c73487d83a7bda562</id>
<content type='text'>
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.&lt;fs-type&gt; 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 &lt;csaba@redhat.com&gt;
Reviewed-on: https://review.gluster.org/16313
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Amar Tumballi &lt;amarts@redhat.com&gt;
Tested-by: Amar Tumballi &lt;amarts@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
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.&lt;fs-type&gt; 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 &lt;csaba@redhat.com&gt;
Reviewed-on: https://review.gluster.org/16313
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
Reviewed-by: Amar Tumballi &lt;amarts@redhat.com&gt;
Tested-by: Amar Tumballi &lt;amarts@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>fuse: limit fusermount fallback to EPERM cases</title>
<updated>2017-01-18T07:19:58+00:00</updated>
<author>
<name>Csaba Henk</name>
<email>csaba@redhat.com</email>
</author>
<published>2016-11-02T06:22:39+00:00</published>
<link rel='alternate' type='text/html' href='http://dev.gluster.org/cgit/glusterfs.git/commit/?id=90cb8c49787d41a46e5b86d73bdc515f54aff4c0'/>
<id>90cb8c49787d41a46e5b86d73bdc515f54aff4c0</id>
<content type='text'>
There are two mount mechanims for fuse:
1) Call mount(2) syscall directly -- implemented by fuse_mount_sys
2) Call out to fusermount(1) helper utilty to do the mount --
   implemented by fuse_mount_fusermount
   [Note: both libfuse and glusterfs ships a variant of this helper
   utility; named, respectively, fusermount and fusermount-glusterfs.
   The two has diverged, and are not compatible at the moment.]

The intended use of 1) is privileged mounting, ie. when root
is invoking the glusterfs client. (It cannot work for non-privileged
users as the kernel enforces privilege for mount(2), more precisely,
caller context needs CAP_SYS_ADMIN, see capabilities(7).)

The intended use of 2) is unprivileged mountig, ie. when
the glusterfs client is invoked by an unprivileged user.
The helper utility is a setuid binary, so it can perform
mount(2) on behalf of the user.

The main mount routine, gf_fuse_mount, calls fuse_mount_sys first,
and if that fails, tries also with fuse_mount_fusermount. This
is what we call "fusermount fallback". However, in the light of
the above remarks about intended use, this logic should apply if
the fuse_mount_fusermount fails because of a privilege shortage,
ie. with error "Operation not permitted" (errno EPERM).

So far the fallback was unconditional (masking bugs of
fuser_mount_sys, as it happens in referred BUG). Now we
add the "errno == EPERM" condition.

BUG: 1297182
Change-Id: Ia89d975d1e27fcfa5ab2036ba546aa8fa0d2d1b0
Signed-off-by: Csaba Henk &lt;csaba@redhat.com&gt;
Reviewed-on: http://review.gluster.org/15766
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
There are two mount mechanims for fuse:
1) Call mount(2) syscall directly -- implemented by fuse_mount_sys
2) Call out to fusermount(1) helper utilty to do the mount --
   implemented by fuse_mount_fusermount
   [Note: both libfuse and glusterfs ships a variant of this helper
   utility; named, respectively, fusermount and fusermount-glusterfs.
   The two has diverged, and are not compatible at the moment.]

The intended use of 1) is privileged mounting, ie. when root
is invoking the glusterfs client. (It cannot work for non-privileged
users as the kernel enforces privilege for mount(2), more precisely,
caller context needs CAP_SYS_ADMIN, see capabilities(7).)

The intended use of 2) is unprivileged mountig, ie. when
the glusterfs client is invoked by an unprivileged user.
The helper utility is a setuid binary, so it can perform
mount(2) on behalf of the user.

The main mount routine, gf_fuse_mount, calls fuse_mount_sys first,
and if that fails, tries also with fuse_mount_fusermount. This
is what we call "fusermount fallback". However, in the light of
the above remarks about intended use, this logic should apply if
the fuse_mount_fusermount fails because of a privilege shortage,
ie. with error "Operation not permitted" (errno EPERM).

So far the fallback was unconditional (masking bugs of
fuser_mount_sys, as it happens in referred BUG). Now we
add the "errno == EPERM" condition.

BUG: 1297182
Change-Id: Ia89d975d1e27fcfa5ab2036ba546aa8fa0d2d1b0
Signed-off-by: Csaba Henk &lt;csaba@redhat.com&gt;
Reviewed-on: http://review.gluster.org/15766
Smoke: Gluster Build System &lt;jenkins@build.gluster.org&gt;
NetBSD-regression: NetBSD Build System &lt;jenkins@build.gluster.org&gt;
CentOS-regression: Gluster Build System &lt;jenkins@build.gluster.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
