From: Miklos Szeredi Date: Tue, 30 Mar 2004 07:24:29 +0000 (+0000) Subject: fusermount fix X-Git-Tag: fuse_1_9~75 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=98667e21f5657c7f4031523dc675c352825855d1;p=qemu-gpiodev%2Flibfuse.git fusermount fix --- diff --git a/ChangeLog b/ChangeLog index 32a32ae..6d0b2b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2004-03-30 Miklos Szeredi + + * new fusermount flag '-z': lazy unmount, default is not lazy + 2004-03-25 Miklos Szeredi * If filesystem doesn't define a statfs operation, then an diff --git a/Filesystems b/Filesystems index 763c6a5..eecf82e 100644 --- a/Filesystems +++ b/Filesystems @@ -158,3 +158,16 @@ Description: improved in the future. ============================================================================== +Name: Fusedav + +Author: Lennart Poettering + +Homepage: http://0pointer.de/lennart/projects/fusedav/ + +Description: + + fusedav is a Linux userspace file system driver for mounting WebDAV + shares. It makes use of FUSE as userspace file system API and neon + as WebDAV API. + +============================================================================== diff --git a/lib/mount.c b/lib/mount.c index 7b67203..53162a5 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -71,7 +71,7 @@ void fuse_unmount(const char *mountpoint) const char *mountprog = FUSERMOUNT_PROG; char umount_cmd[1024]; - snprintf(umount_cmd, sizeof(umount_cmd) - 1, "%s -u -q %s", mountprog, + snprintf(umount_cmd, sizeof(umount_cmd) - 1, "%s -u -q -z %s", mountprog, mountpoint); umount_cmd[sizeof(umount_cmd) - 1] = '\0'; diff --git a/util/fusermount.c b/util/fusermount.c index 6d27372..9af24d1 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -126,7 +126,7 @@ static int add_mount(const char *fsname, const char *mnt, const char *type) return 0; } -static int remove_mount(const char *mnt, int quiet) +static int remove_mount(const char *mnt, int quiet, int lazy) { int res; const char *mtab = _PATH_MOUNTED; @@ -186,7 +186,7 @@ static int remove_mount(const char *mnt, int quiet) endmntent(newfp); if(found) { - res = umount2(mnt, 2); /* Lazy umount */ + res = umount2(mnt, lazy ? 2 : 0); if(res == -1) { fprintf(stderr, "%s: failed to unmount %s: %s\n", progname, mnt, strerror(errno)); @@ -398,7 +398,7 @@ static int mount_fuse(const char *mnt, int flags, const char *fsname) res = add_mount(fsname, mnt, type); unlock_mtab(mtablock); if(res == -1) { - umount(mnt); + umount2(mnt, 2); /* lazy umount */ return -1; } } @@ -481,7 +481,8 @@ static void usage() " -x allow other users to access the files (only for root)\n" " -n name add 'name' as the filesystem name to mtab\n" " -l issue large reads\n" - " -q quiet: don't complain if unmount fails\n", + " -q quiet: don't complain if unmount fails\n" + " -z lazy unmount\n", progname); exit(1); } @@ -494,6 +495,7 @@ int main(int argc, char *argv[]) char *origmnt; char *mnt; int unmount = 0; + int lazy = 0; char *commfd; const char *fsname = NULL; int flags = 0; @@ -518,6 +520,10 @@ int main(int argc, char *argv[]) case 'u': unmount = 1; break; + + case 'z': + lazy = 1; + break; case 'p': flags |= FUSE_DEFAULT_PERMISSIONS; @@ -576,10 +582,10 @@ int main(int argc, char *argv[]) if(unmount) { if(geteuid() == 0) { int mtablock = lock_mtab(); - res = remove_mount(mnt, quiet); + res = remove_mount(mnt, quiet, lazy); unlock_mtab(mtablock); } else { - res = umount2(mnt, 2); + res = umount2(mnt, lazy ? 2 : 0); if(res == -1) { fprintf(stderr, "%s: failed to unmount %s: %s\n", progname, mnt, strerror(errno));