Skip to contentSkip to conversation

fix lazy and force umounts for mount.nfs

PATCH In review Amit Gud 2 participants 3 messages Jul 28, 2006 – Jul 29, 2006

Subsystems (2)
lore
Share & tools
lore

Amit Gud

author
#0 lore raw

PATCH 1/1 fix lazy and force umounts for mount.nfs

AG

Signature · 2 lines
May the source be with you.
http://www.cis.ksu.edu/~gud

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.

---

utils/mount/nfsumount.c +12 -11
@@ -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);
 	}
 

-------------------------------------------------------------------------
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

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

#1 lore raw

On Fri, Jul 28, 2006 at 11:54:06AM -0400, Amit Gud alleged:

utils/mount/nfsumount.c int _nfsumount(const char *spec, const c · line 309

Quoted 1 line
utils/mount/nfsumount.c +1 -0
+	fprintf(stderr, "%s: %s: not found / mounted or server not reachable\n", progname, spec);

Call me dumb, but I don't know what "not found / mounted" means. Is there a comma missing?

Signature · 2 lines
Garrick Staples, Linux/HPCC Administrator
University of Southern California

-------------------------------------------------------------------------
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

_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

author
#2 lore raw
Quoted 6 lines · Garrick Staples

On Fri, Jul 28, 2006 at 11:54:06AM -0400, Amit Gud alleged:

utils/mount/nfsumount.c int _nfsumount(const char *spec, const c · line 309

Quoted 1 line
utils/mount/nfsumount.c +1 -0
+	fprintf(stderr, "%s: %s: not found / mounted or server not reachable\n", progname, spec);

Call me dumb, but I don't know what "not found / mounted" means. Is there a comma missing?

Its "not found or not mounted or server not reachable." Might rephrase it :)

AG

Signature · 12 lines
May the source be with you.
http://www.cis.ksu.edu/~gud


-------------------------------------------------------------------------
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
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs