Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3468163ybt; Sat, 4 Jul 2020 18:55:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYaJXSGQN4xRFHgGXyHT9QLMcOJ3+dYuju42Z0NZIaPllRN+JNqUIf2z1Nw72Xxq/HTLW3 X-Received: by 2002:aa7:cf02:: with SMTP id a2mr48798429edy.263.1593914157207; Sat, 04 Jul 2020 18:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593914157; cv=none; d=google.com; s=arc-20160816; b=rTmvGR4hqvwZUih+VWoncLCRIccGiywZYxF683B49wCV3O6KzPK3blVAS8BobucXfU MnyK3Gq3eXoYY7iFd06uj1/WQCU7RhAcVgeo4JE7R1er/VjbAlUbI841pCmHO9ILW2tS AegQ/rLOv7i0LyAECz2ZOmjXclVNmaJk2/AJxIhZGEwSSuY1hYwsNAfo5gKbzCwk0Pzl zFUZQDtaR+HJ0021fSq4ds3iIbREXZvDVehhvL/hdZbQYtFt9ZLx2h+atndAih+Ag4rD PaPV5oOBFiq/aAT4WePmWysuWyvn+QFDlAJtwFyzxQFLUaK/gSwtj8aKEFsJMU78OU0L /Shw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=6iSTK2WupYjVu21PmxTXt2YmgujtTgv3yHEIzWAXVSU=; b=tYIcZJlfrMQytLOzvHFsFNyL4EWY5G8vEYZyePop6DqRVzum9BbJrBu5ceSwbOpkMw 2iealqUb6mAJ6uG6iPnlVSOUuEgVZUVQQx/S/1Rsr5RVDoTC9YPw8ndKgjeW4LGIgYVB 9QVKZtP+sNQZDkFKy1yQPKfRcjtzJ7aoBygTmOFWsHVawg8SFpqnbAWpRQnwC85AaiLM EfKvBDkFf5yfBSbsDtdkRJESMwYIgL+QLnpl98v/KOUiSCw3Wqi+sAZZneSaNLxxz8Mh YD26+O10AX1sVVJLIbsVaviIAC62jkedEbXtO8hx1FOdn2NsazoDf5kuS2k6R9gmZMyU TUUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=o6aIveU6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i16si10606452ejk.407.2020.07.04.18.55.33; Sat, 04 Jul 2020 18:55:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=o6aIveU6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728134AbgGEBzX (ORCPT + 99 others); Sat, 4 Jul 2020 21:55:23 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:48136 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728004AbgGEBzX (ORCPT ); Sat, 4 Jul 2020 21:55:23 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0651nemV141060; Sun, 5 Jul 2020 01:49:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=6iSTK2WupYjVu21PmxTXt2YmgujtTgv3yHEIzWAXVSU=; b=o6aIveU6v/Ra+yti/BMt6UbM+7+2odQVrGwH2MwayKvVqkpaOFWPUEV+XEO+JcfHadAM Cwg2ansCCqbq3xjiWx3dYoT1GhlL4HVTUHqIXyNxBO4kk0jHmvyT7hnnDe34jelknc7K xDE6aJu5nAGtEsEM6RXb/1ciRianAllNWfvc/706S1VZJ11Uc+cJWwDE2xbo5MkkPbZm BwyFiK1Egcl9s3LwXdRrXvPh7rXRQN0TKiNmtMZWvZsEQPmnDE/GXFcHmNF6aE857/Os QxdeqdzKOJovnk4z08G9W+nNY7CHhEE7aipcvj+ugM/TsKOu7NYBBerBmw4LwIL3d/Cd qQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 322h6r1vk0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Sun, 05 Jul 2020 01:49:40 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 0651mxVb174347; Sun, 5 Jul 2020 01:49:39 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 3233bjkcg9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 05 Jul 2020 01:49:39 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 0651nVgl011889; Sun, 5 Jul 2020 01:49:31 GMT Received: from Junxiaos-MacBook-Pro.local (/73.231.9.254) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 04 Jul 2020 18:49:31 -0700 Subject: Re: [PATCH 4.19 114/131] ocfs2: avoid inode removal while nfsd is accessing it To: Linus Torvalds , Pavel Machek Cc: Sasha Levin , Linux Kernel Mailing List , stable , Joseph Qi , Changwei Ge , Gang He , Joel Becker , Jun Piao , Mark Fasheh , Andrew Morton , Greg Kroah-Hartman References: <20200629153502.2494656-1-sashal@kernel.org> <20200629153502.2494656-115-sashal@kernel.org> <20200702211717.GC5787@amd> From: Junxiao Bi Message-ID: Date: Sat, 4 Jul 2020 18:49:20 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9672 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 adultscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2007050011 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9672 signatures=668680 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 lowpriorityscore=0 suspectscore=0 adultscore=0 mlxscore=0 spamscore=0 impostorscore=0 cotscore=-2147483648 malwarescore=0 mlxlogscore=999 clxscore=1011 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2007050011 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/2/20 3:24 PM, Linus Torvalds wrote: > On Thu, Jul 2, 2020 at 2:17 PM Pavel Machek wrote: >> >>> commit 4cd9973f9ff69e37dd0ba2bd6e6423f8179c329a upstream. >>> >>> Patch series "ocfs2: fix nfsd over ocfs2 issues", v2. >> This causes locking imbalance: > This sems to be true upstream too. > >> When ocfs2_nfs_sync_lock() returns error, caller can not know if the >> lock was taken or not. > Right you are. > > And your patch looks sane: > >> diff --git a/fs/ocfs2/dlmglue.c b/fs/ocfs2/dlmglue.c >> index c141b06811a6..8149fb6f1f0d 100644 >> --- a/fs/ocfs2/dlmglue.c >> +++ b/fs/ocfs2/dlmglue.c >> @@ -2867,9 +2867,15 @@ int ocfs2_nfs_sync_lock(struct ocfs2_super *osb, int ex) >> >> status = ocfs2_cluster_lock(osb, lockres, ex ? LKM_EXMODE : LKM_PRMODE, >> 0, 0); >> - if (status < 0) >> + if (status < 0) { >> mlog(ML_ERROR, "lock on nfs sync lock failed %d\n", status); >> >> + if (ex) >> + up_write(&osb->nfs_sync_rwlock); >> + else >> + up_read(&osb->nfs_sync_rwlock); >> + } >> + >> return status; >> } > although the whole thing looks messy. > > If the issue is a lifetime thing (like that commit says), the proper > model isn't a lock, but a refcount. > > Oh well. Junxiao? There is a block number embedded in nfs file handle, to verify it's an inode, need acquire this nfs_sync_lock global lock to avoid any inode removed from local node and other nodes in the cluster, before this verify done, seemed no way to use a refcount. Thanks, Junxiao. > > Linus