Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137331444
D8503.id22179.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8503.id22179.diff
View Options
Index: sbin/umount/umount.c
===================================================================
--- sbin/umount/umount.c
+++ sbin/umount/umount.c
@@ -49,6 +49,7 @@
#include <netdb.h>
#include <rpc/rpc.h>
#include <rpcsvc/mount.h>
+#include <nfs/nfssvc.h>
#include <ctype.h>
#include <err.h>
@@ -323,6 +324,9 @@
CLIENT *clp;
char *nfsdirname, *orignfsdirname;
char *hostp, *delimp;
+ char buf[1024];
+ struct nfscl_dumpmntopts dumpmntopts;
+ const char *proto_ptr = NULL;
ai = NULL;
do_rpc = 0;
@@ -361,8 +365,24 @@
* mount from mntfromname that is still mounted.
*/
if (getmntentry(sfs->f_mntfromname, NULL, NULL,
- CHECKUNIQUE) != NULL)
+ CHECKUNIQUE) != NULL) {
do_rpc = 1;
+ proto_ptr = "udp";
+ /*
+ * Try and find out whether this NFS mount is NFSv4 and
+ * what protocol is being used. If this fails, the
+ * default is NFSv2,3 and use UDP for the Unmount RPC.
+ */
+ dumpmntopts.ndmnt_fname = sfs->f_mntonname;
+ dumpmntopts.ndmnt_buf = buf;
+ dumpmntopts.ndmnt_blen = sizeof(buf);
+ if (nfssvc(NFSSVC_DUMPMNTOPTS, &dumpmntopts) >= 0) {
+ if (strstr(buf, "nfsv4,") != NULL)
+ do_rpc = 0;
+ else if (strstr(buf, ",tcp,") != NULL)
+ proto_ptr = "tcp";
+ }
+ }
}
if (!namematch(ai)) {
@@ -400,7 +420,7 @@
* has been unmounted.
*/
if (ai != NULL && !(fflag & MNT_FORCE) && do_rpc) {
- clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS3, "udp");
+ clp = clnt_create(hostp, MOUNTPROG, MOUNTVERS3, proto_ptr);
if (clp == NULL) {
warnx("%s: %s", hostp,
clnt_spcreateerror("MOUNTPROG"));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 23, 1:30 PM (16 h, 58 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26015268
Default Alt Text
D8503.id22179.diff (1 KB)
Attached To
Mode
D8503: fix umount so that it correctly handles the Unmount RPC for TCP or NFSv4 mounts
Attached
Detach File
Event Timeline
Log In to Comment