Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp22114443rwd; Fri, 30 Jun 2023 04:11:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlE1J2HA11zLGCz0MEKJMhLy4H5r3vvQ9GFyM55fw8fok3jJ4KjyFyPe0wSvD5YiG9ARad+S X-Received: by 2002:a05:6870:4d08:b0:1ac:e6a8:9d5e with SMTP id pn8-20020a0568704d0800b001ace6a89d5emr2815888oab.20.1688123503184; Fri, 30 Jun 2023 04:11:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688123503; cv=none; d=google.com; s=arc-20160816; b=P/WtqooeZaY6ebs1l90hbsd1hkKo6gQEiuX26wkDl/PpFXJER7h3/hDV0nRTJdOu/J MVz9wh2x9OOkjtnr3zYroEkLJ2EYbL3S+9rO+5oKM8+89gl+moPuLX1JsHm/SV337jCB 5cDrwbWPHndjt4im7BTgZ2nuC02WFd/KkREwb6hQ/y4OJLdc1H9MPmiZaB2GLfIcRySV a6Ld8RdfgfN1UD97qOPD+yH8b9OVJXVrFw0c18DBVQrH1dKdQbY5qCYTZdDtuqLarpi0 nj4mgWwhm4ivTOCExdCDpFuzZGci/m6MPdNBexLkR2OtUL371qG0TuTO6bZY+4LRl1gp hk7g== 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=5SwNfBUOBohxD9Ojz0jzWRV0TOJNkp6x0bq5kaOdna4=; fh=fHzCyx2lgDg5rzxkd+fn4L1zIOfYfCj3lN8BN24cVWY=; b=jcQXmdQCF/0KVbQ2QZsFEtBdhGvISc5u9Kr25UmLUwCfwrCvV/9/KqIGLKCVhBgjqt f0/tdX6YGtmFZtfOoCK5nbW6UkRD2H0X1+RHvCxsYc2N9yS/I7ro+QiC4HlbJzMM1Og8 ZBcnvXxSjIbnEAI2gjnKySWs9wyaDSzIgiRU8mER8NMugg38ZbEvxecQwLxdeontQRI3 U5PSMn9QR9yRN1Oh225vfIRkkNOU5qtSlYgX6DbYvCJiaArLUnR3eGBe5ZcqQk+4QnpJ gOthdnBk53UIUUWlNbooYi+AAOyA2oYTed2l7K/Uuwg8YF9wqKm2q8Var/IXtETeaOJ5 Iu3A== 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 z4-20020a17090ad78400b0026383536294si736842pju.175.2023.06.30.04.11.05; Fri, 30 Jun 2023 04:11:43 -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 S232528AbjF3LKw (ORCPT + 99 others); Fri, 30 Jun 2023 07:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231854AbjF3LKu (ORCPT ); Fri, 30 Jun 2023 07:10:50 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98A93170F; Fri, 30 Jun 2023 04:10:49 -0700 (PDT) Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QssxC5SfczpWLF; Fri, 30 Jun 2023 19:07:59 +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; Fri, 30 Jun 2023 19:10:45 +0800 From: Baokun Li To: CC: , , , , , , , Subject: [PATCH v3 0/5] quota: fix race condition between dqput() and dquot_mark_dquot_dirty() Date: Fri, 30 Jun 2023 19:08:17 +0800 Message-ID: <20230630110822.3881712-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: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500021.china.huawei.com (7.185.36.21) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 Hello Honza, This is a solution that uses dquot_srcu to avoid race condition between dqput() and dquot_mark_dquot_dirty(). I performed a 12+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 next branch (5c875096d590), this patch set didn't degrade performance, but rather had a ~5% improvement. V1->V2: Modify the solution to use dquot_srcu. V2->V3: Merge some patches, optimize descriptions. Simplify solutions, and fix some spelling errors. Baokun Li (5): quota: factor out dquot_write_dquot() quota: rename dquot_active() to inode_quota_active() quota: add new helper dquot_active() quota: fix dqput() to follow the guarantees dquot_srcu should provide quota: simplify drop_dquot_ref() fs/quota/dquot.c | 244 ++++++++++++++++++++++++----------------------- 1 file changed, 125 insertions(+), 119 deletions(-) -- 2.31.1