diff options
author | Miklos Szeredi <miklos@szeredi.hu> | 2004-03-30 07:24:29 +0000 |
---|---|---|
committer | Miklos Szeredi <miklos@szeredi.hu> | 2004-03-30 07:24:29 +0000 |
commit | 98667e21f5657c7f4031523dc675c352825855d1 (patch) | |
tree | 051dbd52f8dd76a2680ae3fee7428a339380aeae /util | |
parent | 77f39949dc5174bc42be9ecf2dda6119e1dd506b (diff) |
fusermount fix
Diffstat (limited to 'util')
-rw-r--r-- | util/fusermount.c | 18 |
1 files changed, 12 insertions, 6 deletions
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)); |