From patchwork Sun May 11 04:32:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Theodore Ts'o X-Patchwork-Id: 347754 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2155C14008A for ; Sun, 11 May 2014 14:33:16 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754644AbaEKEdN (ORCPT ); Sun, 11 May 2014 00:33:13 -0400 Received: from imap.thunk.org ([74.207.234.97]:60799 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754302AbaEKEdJ (ORCPT ); Sun, 11 May 2014 00:33:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=thunk.org; s=ef5046eb; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=fvLsLwrbfRx3/wAa0X5q8rBq8Zm4ZEIBGJrspUPS4Ds=; b=fQJ98iThz8smjzoFxYKw3mjVLS0S1iYRFh68GmrZX/FJkXBsie8i/rieZ6Q2EJoF1r6mD+tEoJCicc2mW3rqo/iqihkr9KIURfLGiAjKE+Cdqh/SkwVNbNv1YgwCuzFDjGLaeRYNoPF4Y6dnFtJIWFB8EesAmuOrnEV99T7yRlo=; Received: from root (helo=closure.thunk.org) by imap.thunk.org with local-esmtp (Exim 4.80) (envelope-from ) id 1WjLRf-0001a9-Sh; Sun, 11 May 2014 04:33:03 +0000 Received: by closure.thunk.org (Postfix, from userid 15806) id 2EC8A58073E; Sun, 11 May 2014 00:33:03 -0400 (EDT) From: Theodore Ts'o To: Ext4 Developers List Cc: adityakali@google.com, Theodore Ts'o Subject: [PATCH 2/9] quota: fix e2fsck so we update the quota file correctly Date: Sun, 11 May 2014 00:32:46 -0400 Message-Id: <1399782773-20029-3-git-send-email-tytso@mit.edu> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1399782773-20029-1-git-send-email-tytso@mit.edu> References: <1399782773-20029-1-git-send-email-tytso@mit.edu> X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org In scan_dquota_callback() we were copying dqb_off from the on-disk dquot structure to the dqot structure that we have constructed in memory. This is a bad idea, because if we detect that the quota inode is corrupted and needs to be replaced, when we later write out the inode, the fact that we have a non-zero dqb_off value means that quota routines will not bother updating the quota tree index, since presumably the quota tree index already has an entry for this dqot. The problem is that e2fsck, the only user of these functions, has zapped the quota inode so it can be written from scratch. So this means the index for the quota records are not written out, so the kernel can not find any of the records in the quota inodes. Oops. The fix is simple; there is no reason to copy the dqb_off field into the quota_dict copy of struct dquot. Signed-off-by: "Theodore Ts'o" Cc: adityakali@google.com Reviewed-by: Aditya Kali --- lib/quota/mkquota.c | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/quota/mkquota.c b/lib/quota/mkquota.c index 3849ae1..f77e072 100644 --- a/lib/quota/mkquota.c +++ b/lib/quota/mkquota.c @@ -458,7 +458,6 @@ static int scan_dquots_callback(struct dquot *dquot, void *cb_data) dq = get_dq(quota_dict, dquot->dq_id); dq->dq_id = dquot->dq_id; - dq->dq_dqb.u.v2_mdqb.dqb_off = dquot->dq_dqb.u.v2_mdqb.dqb_off; print_dquot("mem", dq); print_dquot("dsk", dquot);