From 7c714099c7a70ba36bc634e3f0d0dfa0227f4ebe Mon Sep 17 00:00:00 2001 From: rmacklem Date: Sun, 29 May 2011 21:13:53 +0000 Subject: Modify the umount(8) command so that it doesn't do a sync(2) syscall before unmount(2) for the "-f" case. This avoids a forced dismount from getting stuck for an NFS mountpoint in sync() when the server is not responsive. With this commit, forced dismounts should normally work for the NFS clients, but can take up to about 1minute to complete. PR: kern/157365 Reviewed by: kib MFC after: 2 weeks --- sbin/umount/umount.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'sbin/umount') diff --git a/sbin/umount/umount.c b/sbin/umount/umount.c index 911666f..9b75449 100644 --- a/sbin/umount/umount.c +++ b/sbin/umount/umount.c @@ -90,9 +90,6 @@ main(int argc, char *argv[]) struct statfs *mntbuf, *sfs; struct addrinfo hints; - /* Start disks transferring immediately. */ - sync(); - all = errs = 0; while ((ch = getopt(argc, argv, "AaF:fh:t:v")) != -1) switch (ch) { @@ -127,6 +124,10 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; + /* Start disks transferring immediately. */ + if ((fflag & MNT_FORCE) == 0) + sync(); + if ((argc == 0 && !all) || (argc != 0 && all)) usage(); -- cgit v1.1