From owner-cvs-all@FreeBSD.ORG Fri Jul 16 19:31:00 2004 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1683316A4CE; Fri, 16 Jul 2004 19:31:00 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id EF06B43D1F; Fri, 16 Jul 2004 19:30:59 +0000 (GMT) (envelope-from mr@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i6GJUx6o009401; Fri, 16 Jul 2004 19:30:59 GMT (envelope-from mr@repoman.freebsd.org) Received: (from mr@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i6GJUxuw009400; Fri, 16 Jul 2004 19:30:59 GMT (envelope-from mr) Message-Id: <200407161930.i6GJUxuw009400@repoman.freebsd.org> From: Michael Reifenberger Date: Fri, 16 Jul 2004 19:30:59 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Subject: cvs commit: src/usr.sbin/rpc.lockd lock_proc.c lockd.c lockd_lock.c X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jul 2004 19:31:00 -0000 mr 2004-07-16 19:30:59 UTC FreeBSD src repository Modified files: usr.sbin/rpc.lockd lock_proc.c lockd.c lockd_lock.c Log: Forced commit to actually list the changes of bin/61718, as requested by sam. The attached patch fixes a number of problems present in rpc.lockd. 1) Nfslocklist_head.lf_first is overwritten because of an off-by-one-bug that happens when clnt_cache_next_to_use is incorrectly incremented. 2) 'struct sockaddr *addr' inside 'struct file_lock' is set to point to the result from svc_getrpccaller(). This value is malloc:ed inside the rpc libraries and is free:ed when clnt_destroy() is called. Fix, maintain a copy of the result. 3) The loop inside retry_blockingfilelocklist() that uses 3 pointers ifl, nfl, and pfl thrashes the list pointed to by blockedlocklist_head.lf_first. Fix, use a simpler loop. The new loop does not preserve list order but the order is immaterial anyways. See also revison 1.6-1.7 and kern/61122. 4) struct file_lock char client_name[SM_MAXSTRLEN]; and struct host char name[SM_MAXSTRLEN]; Be careful to not create open (non 0 terminated) C strings and later passing them to e.g syslog. Fix, make sure that the strings are always terminated with 0. When at it, move the strings to the end of the structs and make them variable length. This saves about 1000 bytes for every malloc:ed struct. 5) The newfl = malloc(sizeof(struct file_lock)) memory was never properly bzero:ed. Minor changes: A) Nlmtonlm4(0) made assumptions about struct layouts. B) Don't close stdout and stderr when debugging (-d option). C) Remove unused pid_t locker and int fd in struct file_lock. D) s/printf/debuglog/ E) Remove redundant sleep(1) and call to debuglog(). Cheers, Björn Revision Changes Path 1.16 +0 -0 src/usr.sbin/rpc.lockd/lock_proc.c 1.18 +0 -0 src/usr.sbin/rpc.lockd/lockd.c 1.16 +0 -0 src/usr.sbin/rpc.lockd/lockd_lock.c