Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp758265rwb; Thu, 22 Sep 2022 06:10:30 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5YGaMt/5Epaf09UXD41Vcdu0CYzgG2d+oBIjRS562IGWFsv1cWXErriBF+e/XvHktp3CNr X-Received: by 2002:a17:906:fd8b:b0:770:7d4c:3486 with SMTP id xa11-20020a170906fd8b00b007707d4c3486mr2717330ejb.518.1663852230341; Thu, 22 Sep 2022 06:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663852230; cv=none; d=google.com; s=arc-20160816; b=P6k0L4BXNI8TcsJXGgGH4Gbkfij0xM5FIRxKmOgKFcxA7AIS0blp4V+iqxk7jt3D06 Nl4+NQNV2aQYkxUxhTwHrfUEYzXMIuJimUiSPM1rdCRPCaYSXdhVt5/lwQKD7Y9coN5q 2NToXL7GkYalqzwfq6BbgnqNrVTLWaRHGzzBZy38/rqtHo5gyPz/6H3WSAjoqkDJyW0L OBVVXO9k/AKAD/6zJV2snQNiqEnAB+6aXjw6jMs4c+4C3H+Qlk1Koy7mEFxZGyA9GAvU A4T3v+kH49egEwYM71qdNL+PgGLkxmjkwBnXfamHBWjrmmNihSRB4QdJKLf2BlK7cV82 Z3gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=rWZc/M4eLjMDUim1l1k6wGPQdbAks8dnegOlWm/fjlg=; b=XL7fG0eHGg0fcoQl8e2uLktvZMZXUR6JBf9B0X88NbbhpR1JhjU2BCAMXlvUkIlfJE qlHEF/hHmdfnJDLYsMWub/lRYPzURw3cgbFKJbFKrmDBbgpnBU8F7dv/6gT6DOtbhnt9 t2vUJ+WDcAPZacFtIJQShnGqc3EIdZlZuT+A0t0tAz7iVvV0JzRYMfxcDBbCROzP5LXc Q/Ink00VNJfQFAUTPd99zazdUAoWlimdOOa31u04d0TzHRIYWM8bbdxcsie2DlCYJNYX cYLsl9PwmfTFHmKNbveoF159dkSIg737bB4lZSEO3Mde8eYOB1taN/rOSYSWqbe2dYCN X6zA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd7-20020a1709076e0700b0077b2e822b8fsi5802484ejc.76.2022.09.22.06.09.59; Thu, 22 Sep 2022 06:10:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231689AbiIVM7H (ORCPT + 99 others); Thu, 22 Sep 2022 08:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230165AbiIVM7G (ORCPT ); Thu, 22 Sep 2022 08:59:06 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 178393D5B0; Thu, 22 Sep 2022 05:59:05 -0700 (PDT) Received: from dggemv711-chm.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MYFfX1rvlzHp3N; Thu, 22 Sep 2022 20:56:52 +0800 (CST) Received: from kwepemm600013.china.huawei.com (7.193.23.68) by dggemv711-chm.china.huawei.com (10.1.198.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 20:59:02 +0800 Received: from [10.174.178.46] (10.174.178.46) by kwepemm600013.china.huawei.com (7.193.23.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Thu, 22 Sep 2022 20:59:02 +0800 Subject: Re: [PATCH 1/3] quota: Check next/prev free block number after reading from quota file To: Jan Kara CC: , , , , , , References: <20220820110514.881373-1-chengzhihao1@huawei.com> <20220820110514.881373-2-chengzhihao1@huawei.com> <20220921133715.7tesk3qylombwmyk@quack3> <41578612-d582-79ea-bb8e-89fa19d4406e@huawei.com> <20220922113902.rhoxfgdzcvdzo3wc@quack3> From: Zhihao Cheng Message-ID: Date: Thu, 22 Sep 2022 20:58:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20220922113902.rhoxfgdzcvdzo3wc@quack3> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.178.46] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600013.china.huawei.com (7.193.23.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org 在 2022/9/22 19:39, Jan Kara 写道: > On Thu 22-09-22 16:13:59, Zhihao Cheng wrote: [...] >>> >>> The free block should actually be > QT_TREEOFF so I'd add the check to >>> do_check_range(). >> >> 'dh->dqdh_next_free' may be updated when quota entry removed, >> 'dh->dqdh_next_free' can be used for next new quota entris. >> Before sending v2, I found 'dh->dqdh_next_free' and 'dh->dqdh_prev_free' can >> easily be zero in newly allocated blocks when continually creating files >> onwed by different users: >> find_free_dqentry >> get_free_dqblk >> write_blk(info, info->dqi_blocks, buf) // zero'd qt_disk_dqdbheader >> blk = info->dqi_blocks++ // allocate new one block >> info->dqi_free_entry = blk // will be used for new quota entries >> >> find_free_dqentry >> if (info->dqi_free_entry) >> blk = info->dqi_free_entry >> read_blk(info, blk, buf) // dh->dqdh_next_free = dh->dqdh_prev_free = >> 0 >> >> I think it's normal when 'dh->dqdh_next_free' or 'dh->dqdh_prev_free' equals >> to 0. > > Good point! 0 means "not present". So any block number (either in free list > or pointed from the quota tree) should be either 0 or > QT_TREEOFF. > > Honza > In case my emails being filtered agagin, this is notification of v2: https://lore.kernel.org/linux-ext4/20220922130401.1792256-1-chengzhihao1@huawei.com/T/#m9676d64e8f7cdd7b7decdd0d6b725ec658110b3e