All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix lazy and force umounts for mount.nfs
@ 2006-07-28 15:54 Amit Gud
  2006-07-28 16:20 ` Garrick Staples
  0 siblings, 1 reply; 3+ messages in thread
From: Amit Gud @ 2006-07-28 15:54 UTC (permalink / raw)
  To: Neil Brown; +Cc: nfs, Steve Dickson

[-- Attachment #1: Type: text/plain, Size: 65 bytes --]


AG
-- 
May the source be with you.
http://www.cis.ksu.edu/~gud


[-- Attachment #2: lazy-umount-fix-v1.patch --]
[-- Type: text/plain, Size: 1791 bytes --]

Fixes lazy umount freezing when NFS server is down or unreachable. This
enables lazy and force umounting possible without bothering the server.
This is useful when NFS server is down or unreachable.


Signed-off-by: Amit Gud <agud@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>

---

--- nfs-utils/utils/mount/nfsumount.c	2006-07-25 11:10:45.000000000 -0400
+++ nfs-utils-ag/utils/mount/nfsumount.c	2006-07-25 16:03:32.000000000 -0400
@@ -100,9 +100,9 @@ int nfs_call_umount(clnt_addr_t *mnt_ser
 	}
 	mnt_closeclnt(clnt, msock);
 	if (res == RPC_SUCCESS)
-		return 1;
+		return 0;
  out_bad:
-	return 0;
+	return 1;
 }
 
 u_int get_mntproto(const char *);
@@ -251,9 +251,6 @@ int add_mtab2(const char *spec, const ch
         return 1;
 }
 
-/*
- * Returns 1 if everything went well, else 0.
- */
 int _nfsumount(const char *spec, const char *opts)
 {
 	char *hostname;
@@ -309,8 +306,8 @@ int _nfsumount(const char *spec, const c
 		goto out_bad;
 	return nfs_call_umount(&mnt_server, &dirname);
  out_bad:
-	fprintf(stderr, "%s: %s: not found or not mounted\n", progname, spec);
-	return 0;
+	fprintf(stderr, "%s: %s: not found / mounted or server not reachable\n", progname, spec);
+	return 1;
 }
 
 static struct option umount_longopts[] =
@@ -393,14 +390,18 @@ int nfsumount(int argc, char *argv[])
 			}
 		}
 
-		ret = _nfsumount(mc->m.mnt_fsname, mc->m.mnt_opts);
-		if(ret)
+		ret = 0;
+		if(!force && !lazy)
+			ret = _nfsumount(mc->m.mnt_fsname, mc->m.mnt_opts);
+		if(!ret)
 			ret = add_mtab2(mc->m.mnt_fsname, mc->m.mnt_dir,
 				mc->m.mnt_type, mc->m.mnt_opts, mc);
 	}
 	else {
-		ret = _nfsumount(spec, NULL);
-		if(ret)
+		ret = 0;
+		if(!force && !lazy)
+			ret = _nfsumount(spec, NULL);
+		if(!ret)
 			ret = add_mtab2(spec, spec, spec, spec, NULL);
 	}
 

[-- Attachment #3: Type: text/plain, Size: 348 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #4: Type: text/plain, Size: 140 bytes --]

_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-07-29  7:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-28 15:54 [PATCH] fix lazy and force umounts for mount.nfs Amit Gud
2006-07-28 16:20 ` Garrick Staples
2006-07-29  7:20   ` Amit Gud

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.