Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5052431ybp; Mon, 7 Oct 2019 19:01:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqwWqQNPqLP5Eu5tNuKdB3RM7jCdVCyZEiJa0vsBdxrcAZrYFCpDfJgVCmt3lZp0O+0gAxJK X-Received: by 2002:a05:6402:a50:: with SMTP id bt16mr31321227edb.114.1570500095490; Mon, 07 Oct 2019 19:01:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570500095; cv=none; d=google.com; s=arc-20160816; b=G0mdWpHo2/+nfPFQr5BEukl4fQJe7EzurdeJxph6HHKl4zb9lMHv28KjeyMoP/NeQI IDuySr7qynI3e2hQC+6EYyo0i+V9dstNvPIoFFugsaqY8oJrwBd3e1PVBnQC9YoHARPe nnlWC3PrRKXh1FATBjrVRdOUB3PyON7U+CKeLGbsRowY15RxudxGUM4K3WOabz4WRZK8 /w/Uh4LZyEOs0m8sKf/PrTNQBP3b5wPItPE2h6kZuMbKScu1+tfA0zk1WJlKYT/HFo5S gwBCmSKD82JKfLziTpeVmmEIRLAhE0Rci1dK7R0B4MAiIZFNe8jUjhcPSOP6SJgusoG8 9tKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:to:subject; bh=WacQvJYR/ywwtGo3e0pOEjVo201TOeouTXAN4AurDLM=; b=flFIP1UsSKNpIS2SsEBscVb41fAYDq3tGgt1SMGN1U0CM8x/ag9/r3MnUFRKvWT8et E95r9iBdb8uVZzM+HUXHwe7kOwYT8Gzbeynn4vDfQOBh77ppar/y3z5hDVE6662IUhi7 CWKr4aVvLNMYl1krS6leEWIuJS2CiL/KRzS7LLwJI4rZflSlKTV+xizFj/OrrA9y4MWs bjx9mEjiHD/+Q3tCWy3wxAe9u9fcdIazrQXLzHDXwVNtAtVHqx57LoI2LBuzSC/6TKg6 XBiGlvIhKavwqFhomzznR0Op8OQYSmu5iE6tbhIkMx4JcLaT4No5q6zqWKuLO7prZcwB 35lA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 34si10441757edk.26.2019.10.07.19.00.52; Mon, 07 Oct 2019 19:01:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729725AbfJHCAK (ORCPT + 99 others); Mon, 7 Oct 2019 22:00:10 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:38938 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726917AbfJHCAK (ORCPT ); Mon, 7 Oct 2019 22:00:10 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E37F853114F9BFF904DF; Tue, 8 Oct 2019 10:00:08 +0800 (CST) Received: from [127.0.0.1] (10.173.220.145) by DGGEMS401-HUB.china.huawei.com (10.3.19.201) with Microsoft SMTP Server id 14.3.439.0; Tue, 8 Oct 2019 10:00:08 +0800 Subject: Re: [PATCH] nfs: Fix nfsi->nrequests count error on nfs_inode_remove_request To: Trond Myklebust , "linux-nfs@vger.kernel.org" , "anna.schumaker@netapp.com" References: <1569479378-128669-1-git-send-email-zhangxiaoxu5@huawei.com> <08ce0101-e8df-509a-f3e5-07063aa5492e@huawei.com> <5c50a4be3562877a5d96523e943b9976a3792e23.camel@hammerspace.com> From: "zhangxiaoxu (A)" Message-ID: <4096d9e4-f6a2-b1e1-4f52-81cf44fc4a1f@huawei.com> Date: Tue, 8 Oct 2019 10:00:07 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.173.220.145] X-CFilter-Loop: Reflected Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Thanks for your review. I think PG_REMOVE and PG_INODE_REF can't be both setted except in 'nfs_inode_remove_request' function. nfs_inode_remove_request // maybe set PG_REMOVE here. nfs_page_group_sync_on_bit(req, PG_REMOVE) nfs_page_group_lock(req); nfs_page_group_sync_on_bit_locked WARN_ON_ONCE(test_and_set_bit(bit, &req->wb_flags)); nfs_page_group_unlock(req); // But also clear the PG_INODE_REF flag. test_and_clear_bit(PG_INODE_REF, &req->wb_flags) 'nfs_lock_and_join_requests' also need the PG_HEADLOCK flag: nfs_lock_and_join_requests nfs_page_group_lock(head); test_and_clear_bit(PG_REMOVE, &head->wb_flags) nfs_page_group_unlock(head); 在 2019/10/5 22:35, Trond Myklebust 写道: > However nfs_lock_and_join_requests() looks like it does need to change > to something like the following: > > /* Postpone destruction of this request */ > - if (test_and_clear_bit(PG_REMOVE, &head->wb_flags)) { > - set_bit(PG_INODE_REF, &head->wb_flags); > + if (test_and_clear_bit(PG_REMOVE, &head->wb_flags) && > + !test_and_set_bit(PG_INODE_REF, &head->wb_flags)) { > kref_get(&head->wb_kref); > atomic_long_inc(&NFS_I(inode)->nrequests); > } > > > Do you agree?