Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp20826325rwd; Thu, 29 Jun 2023 07:29:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlFjslD3DE1CSrldVQ2kBfyPdlNlEERKiNIvsx3yo0PmicITeZLIx8dgBH9GFbCke+Fy6H6I X-Received: by 2002:a17:903:41c3:b0:1a1:d54b:71df with SMTP id u3-20020a17090341c300b001a1d54b71dfmr224726ple.0.1688048991930; Thu, 29 Jun 2023 07:29:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688048991; cv=none; d=google.com; s=arc-20160816; b=dKPoCrm748SBr0qR8RczlsGSttkoaKfbJYFtlZYoWrv571G4NEfvXb/0SqA5tDJafr cwiAUBpaRD/WovaXwpUG9qUiuBbn3zqA25lRJV0BqvImv3A94t92B7QKm2xaNdoy7U6G fP6xGylBjZUOVKGfmsJwFJNpJFjOFhpxZgSp0ZXnVt7FTXzGzSd1TgFAKHX4JV/tf7uI utxTOiiZxYVO2f3DlP3uMmIInWM6Fu1dqGkfJpteThNaaVEt2RI27wBTvONCyz+r7E6y WH2ljM9z1sblpgMM9Qfu9CftCQAVlv5mRV8/E9k0hvsoxyusSqJJjdfe7sxZq9Hkxnn5 +5Xg== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=T5UX9rSTvW5UpYjKaGjtnJGuhs8Bvv7kmb33yyqLXl0=; fh=9x1LrL2QrIZog3VQ/5V9jBOQgfRcp9bYZChBiKY7RGM=; b=cxaoQFRujHlDwa9iL/lPn9NefW1d6zuzbne90Clig4LsXwo4vllUFxuXyl4FZMpobF VH0j1Iv4zfTD/5007wvb4PLz3EIzH1AEuMowAoxUDGnBL8NTtJy0KCYS+7FxsCgP9eZ2 rjYPDDkeuS61RHgxkEjF83/cS03+oQu5CDsRgOsO9g9T47Hhu/j9K4C3zkcdEd/Ql09W EbAZmMoG30wd3LoZCHz/5uB2djmXQLO777tzfYN3xoemnXlgtR6fZGLNq4+sULZGrGC1 mGBL0He5sjHYKltFgFMSwxbj+SLgFbgOze2e8ldf8ZHpCSlhsvDizBHNLs3bra9f0tB6 wLEw== 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 p18-20020a170902ebd200b001b66f1fcf0csi10556093plg.174.2023.06.29.07.29.36; Thu, 29 Jun 2023 07:29:51 -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 S232428AbjF2ORB (ORCPT + 99 others); Thu, 29 Jun 2023 10:17:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232452AbjF2OQR (ORCPT ); Thu, 29 Jun 2023 10:16:17 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E002A3C00; Thu, 29 Jun 2023 07:16:11 -0700 (PDT) Received: from dggpeml500021.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4QsL6L5TppzLn5P; Thu, 29 Jun 2023 22:14:02 +0800 (CST) Received: from [10.174.177.174] (10.174.177.174) 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; Thu, 29 Jun 2023 22:16:08 +0800 Message-ID: <939155cb-33bd-debd-02b8-d50c540ccc97@huawei.com> Date: Thu, 29 Jun 2023 22:16:08 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 Subject: Re: [PATCH v2 6/7] quota: simplify drop_dquot_ref() Content-Language: en-US To: Jan Kara CC: , , , , , , , Baokun Li References: <20230628132155.1560425-1-libaokun1@huawei.com> <20230628132155.1560425-7-libaokun1@huawei.com> <20230629110813.kfaja4bdomilmns6@quack3> <20230629140922.dp74owntkbm5avop@quack3> From: Baokun Li In-Reply-To: <20230629140922.dp74owntkbm5avop@quack3> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.174] 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.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,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 On 2023/6/29 22:09, Jan Kara wrote: > On Thu 29-06-23 20:13:05, Baokun Li wrote: >> On 2023/6/29 19:08, Jan Kara wrote: >>> On Wed 28-06-23 21:21:54, Baokun Li wrote: >>>> Now when dqput() drops the last reference count, it will call >>>> synchronize_srcu(&dquot_srcu) in quota_release_workfn() to ensure that >>>> no other user will use the dquot after the last reference count is dropped, >>>> so we don't need to call synchronize_srcu(&dquot_srcu) in drop_dquot_ref() >>>> and remove the corresponding logic directly to simplify the code. >>> Nice simplification! It is also important that dqput() now cannot sleep >>> which was another reason for the logic with tofree_head in >>> remove_inode_dquot_ref(). >> I don't understand this sentence very well, so I would appreciate it >> >> if you could explain it in detail. ???? > OK, let me phrase it in a "changelog" way :): > > remove_inode_dquot_ref() currently does not release the last dquot > reference but instead adds the dquot to tofree_head list. This is because > dqput() can sleep while dropping of the last dquot reference (writing back > the dquot and calling ->release_dquot()) and that must not happen under > dq_list_lock. Now that dqput() queues the final dquot cleanup into a > workqueue, remove_inode_dquot_ref() can call dqput() unconditionally > and we can significantly simplify it. > > Honza I suddenly understand what you mean, you mean that now dqput() doesn't have any possible sleep operation. So it can be called in spin_lock at will. I was confused because I understood that dqput() cannot be called in the context of possible sleep. Thank you very much for the detailed explanation! Now there is only the problem in patch 5. Thanks! -- With Best Regards, Baokun Li .