From ce6dc515e13fad593458dab942712f9068420fd2 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Tue, 15 May 2012 21:24:43 +0530 Subject: fuse: sync with upstream Cherry-picked following commits from git://fuse.git.sourceforge.net/gitroot/fuse/fuse form 555d6b50..acc5c79d interval: commit 1193a39c0869a3608f22472735bcffdcccb6b2a5 Author: Reuben Hawkins cleaning up warnings commit dba9185999dfa35161d4c810735df0ab3fde5104 Author: Laszlo Papp Check the 'mtablock' for negative value commit e63a9d8ee6529c9d15a87745276f45c9bdad3961 Author: Miklos Szeredi fusermount: clean up do_mount() function commit 81fee822a098a3e26969401fc486f136465f96f0 Author: Laszlo Papp Eliminate the unused value commit 60eb44ee5eb2756465610b215968f176f4aaac6e Author: Laszlo Papp Fix resource leaks in fusermount commit d6bec4020fddd4dd67248789a1af600580f2cbda Author: Miklos Szeredi In case of failure to add to /etc/mtab don't umount. commit 1e7607ff89c65b005f69e27aeb1649d624099873 Author: Miklos Szeredi fusermount: chdir to / before performing mount/umount commit 2fcbc2a5a94983813c533c015134c6974f8ee636 Author: Miklos Szeredi fusermount: don't save/restore cwd commit bd99f9cf24e16643752b02fb4fa7b48f2124ab4e Author: Miklos Szeredi 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 Reviewed-on: http://review.gluster.com/3343 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- contrib/fuse-lib/mount-common.c | 22 ++++++++++++++++++++-- contrib/fuse-lib/mount.c | 1 + 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'contrib/fuse-lib') diff --git a/contrib/fuse-lib/mount-common.c b/contrib/fuse-lib/mount-common.c index 7411e56c8..fd6cce44e 100644 --- a/contrib/fuse-lib/mount-common.c +++ b/contrib/fuse-lib/mount-common.c @@ -20,10 +20,11 @@ * - there are some other minor things * * For changes that were made later and syncs with upstream, - * see the commit log. + * see the commit log and per-function comments. */ #ifndef __NetBSD__ +/* FUSE: cherry-picked bd99f9cf */ static int mtab_needs_update (const char *mnt) { @@ -47,11 +48,22 @@ mtab_needs_update (const char *mnt) if (errno == ENOENT) return 0; } else { + uid_t ruid; + int err; + if (S_ISLNK (stbuf.st_mode)) return 0; + ruid = getuid (); + if (ruid != 0) + setreuid (0, -1); + res = access (_PATH_MOUNTED, W_OK); - if (res == -1 && errno == EROFS) + err = (res == -1) ? errno : 0; + if (ruid != 0) + setreuid (ruid, -1); + + if (err == EROFS) return 0; } @@ -61,6 +73,7 @@ mtab_needs_update (const char *mnt) #define mtab_needs_update(x) 1 #endif /* __NetBSD__ */ +/* FUSE: called add_mount_legacy(); R.I.P. as of cbd3a2a8 */ int fuse_mnt_add_mount (const char *progname, const char *fsname, const char *mnt, const char *type, const char *opts) @@ -194,6 +207,11 @@ fuse_mnt_resolve_path (const char *progname, const char *orig) return dst; } +/* FUSE: to support some changes that were reverted since + * then, it was split in two (fuse_mnt_umount() and + * exec_umount()); however the actual code is same as here + * since 0197ce40 + */ int fuse_mnt_umount (const char *progname, const char *abs_mnt, const char *rel_mnt, int lazy) diff --git a/contrib/fuse-lib/mount.c b/contrib/fuse-lib/mount.c index 8787064fc..f02a835b3 100644 --- a/contrib/fuse-lib/mount.c +++ b/contrib/fuse-lib/mount.c @@ -18,6 +18,7 @@ #define FUSE_DEVFD_ENV "_FUSE_DEVFD" +/* FUSE: function is called fuse_kern_unmount() */ void gf_fuse_unmount (const char *mountpoint, int fd) { -- cgit