summaryrefslogtreecommitdiffstats
path: root/contrib/fuse-lib/mount.c
Commit message (Collapse)AuthorAgeFilesLines
* fuse: pass the mountflags to older (< 2.6.21) kernelsNiels de Vos2013-07-031-1/+1
| | | | | | | | | | | | | | | | | The change for Bug 853895 fixed mounting volumes read-only for recent kernels. Older kernels fail the first mount() syscall, and the second mount() did not add the 'mountflags'. Full analysis and a description for reproducing is in the bugreport. The test included in http://review.gluster.org/4163 would have caught this problem when the tests are executed on RHEL-5 or similar systems. Change-Id: I440591344a6a5af7b2018e37a2a1fda9de8b5ab2 Bug: 980770 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/5278 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* fuse: log options passed to fuse when mount failsLubomir Rintel2013-02-071-1/+2
| | | | | | | | | | | This is done to ease debugging. Change-Id: I50cfca297e03f41cc47819d0700752e3d24a07d6 BUG: 852754 Signed-off-by: Lubomir Rintel <lubo.rintel@gooddata.com> Reviewed-on: http://review.gluster.org/3877 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* fuse: handle mountflags properlyNiels de Vos2012-11-191-9/+23
| | | | | | | | | | | | | | | | | | | | | | The internal mount API had no access to the generic mountflags used by mount(2). Thus the "ro" mount option that needs to be passed down to mount(2) as as a mountflag was incorrectly mangled into the fuse-specific mount parameter string (cf. http://review.gluster.com/655). This commit fixes the internal API and the "ro" issue. It also adds a check for the "rw" and "ro" mount options in tests/basic/mount.t. Thanks to Csaba Henk (csaba@) for suggestions and proposing an updated patch. Change-Id: I7f7bf49ae44d148f5c16f10736a0e412fb8f5e67 BUG: 853895 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/4163 Reviewed-by: Csaba Henk <csaba@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* fuse: sync with upstreamCsaba Henk2012-05-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cherry-picked following commits from git://fuse.git.sourceforge.net/gitroot/fuse/fuse form 555d6b50..acc5c79d interval: commit 1193a39c0869a3608f22472735bcffdcccb6b2a5 Author: Reuben Hawkins <reubenhwk@gmail.com> cleaning up warnings commit dba9185999dfa35161d4c810735df0ab3fde5104 Author: Laszlo Papp <ext-laszlo.papp@nokia.com> Check the 'mtablock' for negative value commit e63a9d8ee6529c9d15a87745276f45c9bdad3961 Author: Miklos Szeredi <miklos@szeredi.hu> fusermount: clean up do_mount() function commit 81fee822a098a3e26969401fc486f136465f96f0 Author: Laszlo Papp <ext-laszlo.papp@nokia.com> Eliminate the unused value commit 60eb44ee5eb2756465610b215968f176f4aaac6e Author: Laszlo Papp <ext-laszlo.papp@nokia.com> Fix resource leaks in fusermount commit d6bec4020fddd4dd67248789a1af600580f2cbda Author: Miklos Szeredi <mszeredi@suse.cz> In case of failure to add to /etc/mtab don't umount. commit 1e7607ff89c65b005f69e27aeb1649d624099873 Author: Miklos Szeredi <mszeredi@suse.cz> fusermount: chdir to / before performing mount/umount commit 2fcbc2a5a94983813c533c015134c6974f8ee636 Author: Miklos Szeredi <miklos@szeredi.hu> fusermount: don't save/restore cwd commit bd99f9cf24e16643752b02fb4fa7b48f2124ab4e Author: Miklos Szeredi <miklos@szeredi.hu> Fix check for read-only fs in mtab update Nb.: - not picked changes that implement and enforce mount/umount mechanisms based on newer util-linux features (umount --fake and --no-canonicalize) - not picked fusermount "auto-unmount" feature Change-Id: Ib9498516184336e77ec047e5414125332d0a4292 BUG: 762389 Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3343 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* fuse: reorganize mounting codeCsaba Henk2012-05-211-386/+39
| | | | | | | | | | | | | | | | | | | | Macro-driven conditional compilation was a chaos. New scheme is: contrib/fuse-lib/mount-common.c: libfuse routines used both by glusterfs and fusermount contrib/fuse-lib/mount.c: libfuse-derived but customized mounting code for glusterfs contrib/fuse-util/mount_util.c: libfuse routines used only by fusermount Change-Id: I3e0ba7f74e36556b78244cd7676eb4d379939602 BUG: 762389 Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3342 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* fuse, glusterfsd: mount logic fixesCsaba Henk2012-05-211-205/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 7d0397c2 introduced two issues: i) broke the libfuse derived mount logic (details below) ii) in case of a daemonized glusterfs client is ran as daemon, parent process can return earlier than the mount is in place, which breaks agents that programmatically do a gluster mount via a direct call to glusterfs (ie. not via mount(8)). This patch fixes these issues by a refactor that merges the approaches sported by commits 7d0397c2 fuse: allow requests during mount (needed for SELinux labels) c5d781e0 upon daemonizing, wait on mtab update to terminate in parent Original daemonized libfuse event flow is as follows: try: fd = open("/dev/fuse") mount("-oopts,fd=%s" % fd ...) mount(8) -f # manipulate mtab except: sp = socketpair() env _FUSE_COMMFD=sp fusermount -oopts fd = receive_fd(sp) where fusermount(1) does: fd = open("/dev/fuse") mount("-oopts,fd=%d" % fd ...) sp = atoi(getenv("_FUSE_COMMFD")) send_fd(sp, fd) daemonize( # in child fuse_loop(fd) ) # in parent exit() As of 013850c9 (instead of adopting FUSE's 47e61004¹), we went for async mtab manipulation, and as of c5d781e0, still wanted keep that in sync with termination of daemon parent, so we changed it to: try: fd = open("/dev/fuse") mount("-oopts,fd=%s" % fd ...) pid = fork( # in child mount(8) -f ) except: sp = socketpair() env _FUSE_COMMFD=sp fusermount -oopts fd = receive_fd(sp) daemonize( fuse_loop(fd) ) waitpid(pid) exit() (Note the new approch came only to direct [privileged] mount, so fusermount based mounting was already partially broken.) As of 7d0397c2, with the purpose of facilitating async mount, the event flow was practically reduced to: fd = open("/dev/fuse") fork( mount("-oopts,fd=%s" % fd ...) fork( mount(8) -n ) ) daemonize( fuse_loop(fd) ) exit() Thus fusermount based mounting become defunct; however, the dead code was still kept around. So, we should either drop it or fix it. Also, the mtab manipulator is forked into yet another child with no purpose, while syncing with it in daemon parent is broken. mount(2) is neither synced with parent. Now we are coming to the following scheme: fd = open("/dev/fuse") pid = fork( try: mount("-oopts,fd=%s" % fd ...) mount(8) -n except: env _FUSE_DEVFD=fd fusermount -oopts ) where fusermount(1) does: fd = getenv("_FUSE_DEVFD") mount("-oopts,fd=%s" % fd ...) daemonize( fuse_loop(fd) ) waitpid(pid) exit() Nb.: - We can't help losing compatibility with upstream fusermount, as it sends back the fd only when mount(2) is completed, thus defeating the async mount approach. The 'getenv("_FUSE_DEVFD")' mechanism is specfic to glusterfs' fusermount (at the moment -- sure we can talk about it with upstream) - fusermount opens /dev/fuse at same privilege level as of original process², so we can bravely go on with doing the open unconditionally in original process - Original mounting code actually tries to mount through fusermount _twice_: if first attempt fails, then, assuming subtype support is missing in kernel, it tries again subtype stripped. However, this is redundant, as fusermount internally also performs the subtype check³. Therefore we simplified the logic to have just a single fusermount call. - we revert the changes to mount.glusterfs as of 7d0397c2, as now there is no issue with glusterfs to work around in that scope ¹ http://fuse.git.sourceforge.net/git/gitweb.cgi?p=fuse/fuse;a=blobdiff;f=ChangeLog;h=47e61004;hb=4c3d9b19;hpb=e61b775a ² http://fuse.git.sourceforge.net/git/gitweb.cgi?p=fuse/fuse;a=blob;f=util/fusermount.c;h=b2e87d95#l1023 ³ http://fuse.git.sourceforge.net/git/gitweb.cgi?p=fuse/fuse;a=blob;f=util/fusermount.c;h=b2e87d95#l839 Change-Id: I0c4ab70e0c5ad7b27337228749b266bcd0ba941d BUG: 811217 Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3341 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* NetBSD build fixesEmmanuel Dreyfus2012-05-111-0/+2
| | | | | | | | | | | Change-Id: Ib8183d4b585465d05a7adf3a4ceae93ae1bded15 BUG: 764655 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.com/3238 Reviewed-by: Amar Tumballi <amarts@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* fuse: allow requests during mount (needed for SELinux labels)Jeff Darcy2012-04-231-10/+50
| | | | | | | | | Change-Id: Ia1af402897e6a7290acf79617c34fdc804751729 BUG: 811217 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.com/3199 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* We must #include <signal.h> for sigprocmask(2). Failure to do so will breakEmmanuel Dreyfus2011-11-231-0/+1
| | | | | | | | | | | on NetBSD kernel without COMPAT_13 option. Change-Id: Ia710bbe31ed48e4df4cd47f99e335d7226b99173 BUG: 2923 Reviewed-on: http://review.gluster.com/594 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@gluster.com>
* Use /bin/mount on Linux, /sbin/mount on other systemsEmmanuel Dreyfus2011-11-231-3/+9
| | | | | | | | | Change-Id: I8d2e518d29cedb1fbfa77d0189a2d4a24957e662 BUG: 2923 Reviewed-on: http://review.gluster.com/752 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
* fuse: NetBSD portability fixesAnand Avati2011-05-301-0/+11
| | | | | | | | | | | | On NetBSD use libperfuse(3), rename umount2(2) as unmount(2), and skip inexistant /etc/mtab management. Thanks to: Emmanuel Dreyfus <manu@netbsd.org> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2923 (NetBSD port) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2923
* upon daemonizing, wait on mtab update to terminate in parentCsaba Henk2011-05-191-22/+30
| | | | | | | | | | | | | | This fixes the race in between the mtab update attempts of mount and umount when we do a lazy umount right after mounting, in order to hide the given fs instance; yet this way we still avoid the deadlock of the fs and mount which we can hit if we wait unconditionally for the mtab update to terminate (cf. bz #511). Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2690 (race between mtab updates of mount and umount) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2690
* build fixesVenky Shankar2011-04-111-2/+8
| | | | | | | | Signed-off-by: Venky Shankar <venky@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2550 (build warnings) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2550
* removed reference to GF_LOG_NORMALAmar Tumballi2011-04-071-1/+1
| | | | | | | | | | instead used GF_LOG_INFO, which is more standard log level. Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@gluster.com> BUG: 2669 (RuntimeError: cannot recognize log level "normal") URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2669
* Copyright changesVijay Bellur2010-10-111-1/+1
| | | | | | | | Signed-off-by: Vijay Bellur <vijay@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
* contrib/fuse: update from upstream [555d6b50 in ↵Csaba Henk2010-10-011-2/+38
| | | | | | | | | | | | | | | | | | | | | | | | git://fuse.git.sourceforge.net/fuse/fuse] """ commit 555d6b504308eac6b976321ce938ee4bec62c354 Author: Miklos Szeredi <mszeredi@suse.cz> Date: Tue Sep 28 10:13:24 2010 +0200 Fix option escaping for fusermount. If the "fsname=" option contained a comma then the option parser in fusermount was confused (Novell bugzilla #641480). Fix by escaping commas when passing them over to fusermount. Reported by Jan Engelhardt """ Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1752 (sync with upstream for "Fix option escaping for fusermount.") URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1752
* fuse: bring over recent mounting code changes from libfuse upstreamCsaba Henk2010-02-211-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following commits were ported (commit ids as of http://git.gluster.com/?p=users/csaba/fuse.git repo): commit 06fe3eb9c864b69bea98600c0a7eab7b63834735 Author: mszeredi <mszeredi> Date: Thu Feb 18 11:05:12 2010 +0000 * Fix stack alignment for clone() ChangeLog | 4 ++++ include/fuse_lowlevel.h | 1 + util/fusermount.c | 9 ++++----- 3 files changed, 9 insertions(+), 5 deletions(-) commit dfe1aab6520d70d72d36edf0508fef9a865daa5f Author: mszeredi <mszeredi> Date: Tue Jan 26 18:20:12 2010 +0000 * Fix race if two "fusermount -u" instances are run in parallel. Reported by Dan Rosenberg * Make sure that the path to be unmounted doesn't refer to a symlink ChangeLog | 8 + lib/mount.c | 2 +- lib/mount_util.c | 31 +++-- lib/mount_util.h | 3 +- util/fusermount.c | 380 +++++++++++++++++++++++++++++++++++++++++++++-------- 5 files changed, 351 insertions(+), 73 deletions(-) Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 657 (Metabug for tracking fuse upstream) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=657
* fuse: add mtab entry asynchronouslyCsaba Henk2009-12-281-0/+15
| | | | | | | | | | | | | | Instead of taking libfuse's approach to the bug referred -- making use of an ad-hoc mount option --, we get over the issue by not waiting for mtab manipulation to complete. If mtab manipulation happens to fail for some reason, just log an error message (instead of aborting the mount). Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 511 (mount hangs with some audit configurations) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=511
* Changed occurrences of Z Research to Gluster.Vijay Bellur2009-10-071-1/+1
| | | | Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
* bring in fusermountCsaba Henk2009-08-121-3/+91
|
* fuse: add proper mounting support, based on libfuse routinesCsaba Henk2009-08-121-0/+528