Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
Please login to access the resource
openSUSE:Evergreen:11.2:Test
fuse
fuse-mount-umount-race-fix.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fuse-mount-umount-race-fix.patch of Package fuse
--- lib/mount_util.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- lib/mount_util.h | 1 + util/fusermount.c | 9 ++++++++- 3 files changed, 60 insertions(+), 3 deletions(-) Index: fuse-2.7.2/lib/mount_util.c =================================================================== --- fuse-2.7.2.orig/lib/mount_util.c 2010-11-16 16:03:13.000000000 +0100 +++ fuse-2.7.2/lib/mount_util.c 2010-11-16 16:03:14.000000000 +0100 @@ -71,8 +71,8 @@ int fuse_mnt_add_mount(const char *progn exit(1); } rmdir(tmp); - execl("/bin/mount", "/bin/mount", "-i", "-f", "-t", type, - "-o", opts, fsname, mnt, NULL); + execl("/bin/mount", "/bin/mount", "--no-canonicalize", "-i", + "-f", "-t", type, "-o", opts, fsname, mnt, NULL); fprintf(stderr, "%s: failed to execute /bin/mount: %s\n", progname, strerror(errno)); exit(1); @@ -126,6 +126,55 @@ int fuse_mnt_umount(const char *progname return 0; } +static int remove_mount(const char *progname, const char *mnt) +{ + int res; + int status; + sigset_t blockmask; + sigset_t oldmask; + + sigemptyset(&blockmask); + sigaddset(&blockmask, SIGCHLD); + res = sigprocmask(SIG_BLOCK, &blockmask, &oldmask); + if (res == -1) { + fprintf(stderr, "%s: sigprocmask: %s\n", progname, strerror(errno)); + return -1; + } + + res = fork(); + if (res == -1) { + fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno)); + goto out_restore; + } + if (res == 0) { + sigprocmask(SIG_SETMASK, &oldmask, NULL); + setuid(geteuid()); + execl("/bin/umount", "/bin/umount", "--no-canonicalize", "-i", + "--fake", mnt, NULL); + fprintf(stderr, "%s: failed to execute /bin/umount: %s\n", + progname, strerror(errno)); + exit(1); + } + res = waitpid(res, &status, 0); + if (res == -1) + fprintf(stderr, "%s: waitpid: %s\n", progname, strerror(errno)); + + if (status != 0) + res = -1; + + out_restore: + sigprocmask(SIG_SETMASK, &oldmask, NULL); + return res; +} + +int fuse_mnt_remove_mount(const char *progname, const char *mnt) +{ + if (!mtab_needs_update(mnt)) + return 0; + + return remove_mount(progname, mnt); +} + char *fuse_mnt_resolve_path(const char *progname, const char *orig) { char buf[PATH_MAX]; Index: fuse-2.7.2/lib/mount_util.h =================================================================== --- fuse-2.7.2.orig/lib/mount_util.h 2010-11-16 16:03:13.000000000 +0100 +++ fuse-2.7.2/lib/mount_util.h 2010-11-16 16:03:14.000000000 +0100 @@ -10,6 +10,7 @@ int fuse_mnt_add_mount(const char *progname, const char *fsname, const char *mnt, const char *type, const char *opts); +int fuse_mnt_remove_mount(const char *progname, const char *mnt); int fuse_mnt_umount(const char *progname, const char *abs_mnt, const char *rel_mnt, int lazy); char *fuse_mnt_resolve_path(const char *progname, const char *orig); Index: fuse-2.7.2/util/fusermount.c =================================================================== --- fuse-2.7.2.orig/util/fusermount.c 2010-11-16 16:03:13.000000000 +0100 +++ fuse-2.7.2/util/fusermount.c 2010-11-16 16:03:14.000000000 +0100 @@ -408,8 +408,15 @@ static int unmount_fuse_locked(const cha if (res == -1) goto out; - res = fuse_mnt_umount(progname, mnt, last, lazy); + res = umount2(last, lazy ? 2 : 0); + if (res == -1 && !quiet) { + fprintf(stderr, + "%s: failed to unmount %s: %s\n", + progname, mnt, strerror(errno)); + } + if (res == 0) + res = fuse_mnt_remove_mount(progname, mnt); out: free(copy); if (currdir_fd != -1) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor