From owner-freebsd-hackers Fri May 14 2:12:45 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from sabre-wulf.nvg.ntnu.no (sabre-wulf.nvg.ntnu.no [129.241.210.67]) by hub.freebsd.org (Postfix) with ESMTP id 0FF4315431 for ; Fri, 14 May 1999 02:12:41 -0700 (PDT) (envelope-from roart@nvg.ntnu.no) Received: from phoenix.nvg.ntnu.no ([IPv6:::ffff:129.241.210.108]:60573 "EHLO phoenix.nvg.ntnu.no" ident: "roart") by sabre-wulf.nvg.ntnu.no with ESMTP id <49258-3942>; Fri, 14 May 1999 11:12:22 +0200 Date: Fri, 14 May 1999 11:12:18 +0200 (MET DST) From: =?iso-8859-1?Q?Roar_Thron=E6s?= To: freebsd-hackers@FreeBSD.org Subject: large master.passwd In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1 Content-Transfer-Encoding: 8BIT Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi On a site with 20k users in the master.passwd, and where NIS is not trusted, the master.passwd is distributed to each workstation. The pwd.db and spwd.db are sized around 10Mb. Sometimes, those .db files get corrupt. I suspect it has something to do with the machines being reset etc before the sync is finished. (The machines are dual-boot, and there are a lot of users around.) I did some patching, and have not seen corrupted .db-files since. So how usable is this patch? Worth intregrating? Regards, Roar Thronęs --- ../../3.1-RELEASE/src/usr.sbin/pwd_mkdb/pwd_mkdb.c Tue Apr 20 09:52:58 1999 +++ pwd_mkdb.c Tue Apr 20 11:07:53 1999 @@ -71,7 +71,7 @@ 4096, /* bsize */ 32, /* ffactor */ 256, /* nelem */ - 2048 * 1024, /* cachesize */ + 8192 * 1024, /* cachesize */ NULL, /* hash() */ 0 /* lorder */ }; @@ -457,6 +457,10 @@ /* Set master.passwd permissions, in case caller forgot. */ (void)fchmod(fileno(fp), S_IRUSR|S_IWUSR); + /* sync may be wise + -roart */ + sync(); + /* Install as the real password files. */ (void)snprintf(buf, sizeof(buf), "%s/%s.tmp", prefix, _MP_DB); (void)snprintf(buf2, sizeof(buf2), "%s/%s", prefix, _MP_DB); @@ -477,6 +481,10 @@ */ (void)snprintf(buf, sizeof(buf), "%s/%s", prefix, _MASTERPASSWD); mv(pname, buf); + + /* sync may be wise + -roart */ + sync(); /* * Close locked password file after rename() To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message