Received: by mail.netbsd.org (Postfix, from userid 605) id E31AC14A222; Thu, 27 Sep 2012 07:47:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mail.netbsd.org (Postfix) with ESMTP id EAD1514A221 for ; Thu, 27 Sep 2012 07:47:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at NetBSD.org Received: from mail.netbsd.org ([127.0.0.1]) by localhost (mail.NetBSD.org [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id j5zDQydH97oU for ; Thu, 27 Sep 2012 07:47:58 +0000 (UTC) Received: from cvs.netbsd.org (cvs.NetBSD.org [IPv6:2001:4f8:3:7:2e0:81ff:fe30:95bd]) by mail.netbsd.org (Postfix) with ESMTP id 3B6B814A1BA for ; Thu, 27 Sep 2012 07:47:58 +0000 (UTC) Received: by cvs.netbsd.org (Postfix, from userid 500) id 0870B175DF; Thu, 27 Sep 2012 07:47:57 +0000 (UTC) MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Date: Thu, 27 Sep 2012 07:47:57 +0000 From: "Manuel Bouyer" Subject: CVS commit: src/sys/ufs/ufs To: source-changes@NetBSD.org X-Mailer: log_accum Message-Id: <20120927074758.0870B175DF@cvs.netbsd.org> Sender: source-changes-owner@NetBSD.org List-Id: source-changes.NetBSD.org Precedence: bulk Reply-To: source-changes-d@NetBSD.org Mail-Reply-To: "Manuel Bouyer" Mail-Followup-To: source-changes-d@NetBSD.org Module Name: src Committed By: bouyer Date: Thu Sep 27 07:47:57 UTC 2012 Modified Files: src/sys/ufs/ufs: ufs_quota2.c Log Message: Fix quota2 list corruption issue when defaultquotas are 0 (deny any file and block allocation). When quota2_check() is called with an uid not yet in the list, getinoquota2() will call quota2_q2ealloc() to allocate a new entry for this uid. quota2_q2ealloc() will remove an entry from the free list and put it at the head of the corresponding hash list, and flush the block containing the header if it's not the one also containing the allocated entry. quota2_q2ealloc() then return the alocated entry and corresponding block to caller (getinoquota2() here), which returns it to quota2_check(). quota2_check() then checks if the allocation can succeed, and returns and error if not and calls brelse() on the buffer (because from his POW no change was made to the entry), effectively discarding changes to the entry that may have been made by quota2_q2ealloc(). Fix by always bwrite()ing the entry in quota2_q2ealloc(), and re-reading the entry in caller. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/ufs/ufs/ufs_quota2.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.