Date: Fri, 20 May 2005 21:50:17 +0200 From: Jeremie Le Hen <jeremie@le-hen.org> To: freebsd-current@FreeBSD.org Subject: rpc.umntall timeout Message-ID: <20050520195017.GZ818@obiwan.tataz.chchile.org>
next in thread | raw e-mail | index | archive | help
--CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, I used to connect to multiple networks with my laptop. The problem is that rpc.umntall(8) automatically tries to send a RPCMNT_UMOUNT to all old entries in /var/db/mounttab. I always need to hit ^C because it takes too long to timeout. I watched at the code to see if I couldn't set a timeout on the sending socket to shorten the amount of time it tries to contact the NFS server of each deprecated mount. It looks there is already a hard-coded timeout of three seconds on the call of clnt_call(3), but I added some printf(3)s and this is obviously the preceding clnt_create(3) call which takes so much time. I looked at the code of this function, and this is not much than a simple wrapper to clnt_create_timed(3) function. So I changed rpc.umntall(3) code to use this function and the same timeout as clnt_call(3) instead of using the non-timed version. This is what this small patch does. It may be worth creating an option for this, I don't know if waiting a big amount of time is relevant in specific some cases. Regards, -- Jeremie Le Hen < jeremie at le-hen dot org >< ttz at chchile dot org > --CE+1k2dSO48ffgeK Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="rpc.umntall-timed.patch" Index: rpc.umntall.c =================================================================== RCS file: /nfs/donald/repo/FreeBSD/src/usr.sbin/rpc.umntall/rpc.umntall.c,v retrieving revision 1.12 diff -u -p -r1.12 rpc.umntall.c --- rpc.umntall.c 26 Oct 2003 06:14:10 -0000 1.12 +++ rpc.umntall.c 20 May 2005 17:59:45 -0000 @@ -174,14 +174,15 @@ do_umntall(char *hostname) { struct timeval try; CLIENT *clp; - clp = clnt_create(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp"); + try.tv_sec = 3; + try.tv_usec = 0; + clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp", + &try); if (clp == NULL) { warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); return (0); } clp->cl_auth = authunix_create_default(); - try.tv_sec = 3; - try.tv_usec = 0; clnt_stat = clnt_call(clp, RPCMNT_UMNTALL, (xdrproc_t)xdr_void, (caddr_t)0, (xdrproc_t)xdr_void, (caddr_t)0, try); @@ -201,14 +202,15 @@ do_umount(char *hostname, char *dirp) { struct timeval try; CLIENT *clp; - clp = clnt_create(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp"); + try.tv_sec = 3; + try.tv_usec = 0; + clp = clnt_create_timed(hostname, RPCPROG_MNT, RPCMNT_VER1, "udp", + &try); if (clp == NULL) { warnx("%s: %s", hostname, clnt_spcreateerror("RPCPROG_MNT")); return (0); } clp->cl_auth = authsys_create_default(); - try.tv_sec = 3; - try.tv_usec = 0; clnt_stat = clnt_call(clp, RPCMNT_UMOUNT, (xdrproc_t)xdr_dir, dirp, (xdrproc_t)xdr_void, (caddr_t)0, try); if (clnt_stat != RPC_SUCCESS) --CE+1k2dSO48ffgeK--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050520195017.GZ818>