Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp19205333rwd; Wed, 28 Jun 2023 06:31:01 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6Ijxkz3frcYLxVhO81t2o23G4rpUqHge0F9OmVSVsXQ+5YnUjosT1AQ5/6c7au0/f3yuKa X-Received: by 2002:a17:90a:38a1:b0:25e:886b:c6b with SMTP id x30-20020a17090a38a100b0025e886b0c6bmr29974232pjb.48.1687959061274; Wed, 28 Jun 2023 06:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687959061; cv=none; d=google.com; s=arc-20160816; b=AhQwDtdLreCwJFuxj2kw7pLtAhiC9cUABxfuwuS/deeO73/lhkfR96em64TccrCbdn nbUVVduvIAtJN5MEhogjqjGVK8QO739xh8kWfgD57kev1IX3xRhlVY3tzd4x4PsYZfrF SCiSUx0I6mVru8wsvfkT0WAsMitOBL+ddrnYGqJ5OqYDYwWIRWAMm3tUt0EZ0tgfc5qC uu2Azr3WVNWXFbvqeyuigrQ1r0yq8k8KvEPB5Xlp4dSmhYN8AgUgG4I5T82GezrmYYmn IBprSFjYbjrD6sWmZS3hbNc/3AcatV4P884cbrliJbmWmEA6XTKap/sYei4Kgmg774ow UxRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=Xgu8RNF5A4QI5uXKBTjI9KVHcyiCm3h0r4tyl2zs5EQ=; fh=X9Qm3szuvGIKmdNvUP+uKHoKmrQFdbkaZmN48NjfAnc=; b=Y1SV3vN0kBnnv21cW900GIniknaQvs+HLESIsPvpjiXcm2bbb/VolZRul4vMZ2th9B uaKd7aQdhvzmng1D0LtYkNlV2yVTFtWr+UM0Xcs35duXttMa373YJxsyAzQWcghErFJc 9RtSw15Q3ltw7uLTxtUokEMC3+9iB53kwqYp4Nkm1VKu2EIM5KFWdZhk4a92cGL4Yaxi XPm5HPq10Fd9iNULju09OFbfyDoaSVObMX/9QBblpJEkuIxTjKddEhSAlKMvP1Kf1uBC 1l0mCa9xYiTC+ztU1qhvvMJ6dnmTiXdGKDkvC0x6joPmpVxN22XjM4lMrS8xVy30tSKm qBJg== 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 pw11-20020a17090b278b00b0024b9e5aa258si3663027pjb.0.2023.06.28.06.30.43; Wed, 28 Jun 2023 06:31:01 -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 S231856AbjF1NYU (ORCPT + 99 others); Wed, 28 Jun 2023 09:24:20 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:21997 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbjF1NYU (ORCPT ); Wed, 28 Jun 2023 09:24:20 -0400 Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Qrj0D1KzvzlVmr; Wed, 28 Jun 2023 21:21:32 +0800 (CST) Received: from huawei.com (10.175.127.227) by dggpeml500021.china.huawei.com (7.185.36.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 28 Jun 2023 21:24:16 +0800 From: Baokun Li To: CC: , , , , , , , Subject: [PATCH v2 0/7] quota: fix race condition between dqput() and dquot_mark_dquot_dirty() Date: Wed, 28 Jun 2023 21:21:48 +0800 Message-ID: <20230628132155.1560425-1-libaokun1@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpeml500021.china.huawei.com (7.185.36.21) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org Hello Honza, This is a solution that uses dquot_srcu to avoid race condition between dqput() and dquot_mark_dquot_dirty(). I performed a 24+h fault injection stress test (6 VMs, 4 test threads per VM) and have not found any problems. And I tested the performance based on the latest mainline (6aeadf7896bf), the patch set did not lead to performance degradation, and even a little bit of improvement. V1->V2: Modify the solution to use dquot_srcu. Baokun Li (7): quota: factor out dquot_write_dquot() quota: add new global dquot list releasing_dquots quota: rename dquot_active() to inode_dquot_active() quota: add new helper dquot_active() quota: fix dqput() to follow the guarantees dquot_srcu should provide quota: simplify drop_dquot_ref() quota: remove unused function put_dquot_list() fs/quota/dquot.c | 237 +++++++++++++++++++++++++++-------------------- 1 file changed, 134 insertions(+), 103 deletions(-) -- 2.31.1