Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1835954ybt; Thu, 2 Jul 2020 15:25:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsn3Ha6O3DytkjGIKyBCk1CQhH7tsfoUQm/FJRHgrEJZlR8QWd33JTU8uXXJPkCgR2kkRb X-Received: by 2002:a50:bb48:: with SMTP id y66mr33483966ede.147.1593728737255; Thu, 02 Jul 2020 15:25:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593728737; cv=none; d=google.com; s=arc-20160816; b=OpUoaomvaQwFZE2OOC5o6UvVqfJSRLZ8bCGiYn77SNCamdKuTLFjU5PofLKkGfKVyu bVTDc5+ZPlJZjp3RV+IAiWLrzZ36LVrNm3N0q/itPc3unTjSB90zalfm2Ut+bKrL70pC Q+C3rpYu3pMglVmoHZUymuElvrDjWdyH/ruhZ/wwf/hj8KofPQEMV7tm+Czj67HYnFBJ IBlT/zx6pXjXX3LfCQwiT1SzsIY3EZydAZrCUzbSOmlNDEJ0hF4W4GaioLaFbHdsYEH5 Kem7Jzbdeaub+l6hPYRXYbZaHrtwDTaq/jmI4aoTGnG1dy4bTugYi9y2R8trr3Q6I2eU 9q+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=rmRp1ZZXJd6eN5hNQwPnS8csHi2t2UcvvKpaxxW8OSo=; b=TFtGIt/OZ5P8NbTuj0iXfoKeXiRHuq/7XMoe3qyh+KOI2danEGC8bfoR/cgkavZX6z 7aGN84PeD5MZERcr+jqub4Pn00PNzMYh8mz5W6s/WbvdRatJBgWQ1ZeWdFzUqBl65rRO NMoDNxVpuAZZoGjgyd2VbCpIlmnzZ6JKPWYPTLzpt9O+9Tw8Xb18hu7HW+fKen0LmnCS pIHY+hJ+3cMdD3PuyiDYZJVQgw3U2KL74Q6/QXKy5O2fFuju2lWjXH7tC/Yip3X6Dowc 0Y4qQVDVJIG65h0TYzZnB5dshfnAzuE0k3mP+kYkphOmVku1XylFUsjd5AJXByzZOGy9 sQfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=dg7C3tlr; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n20si6623360ejs.158.2020.07.02.15.25.13; Thu, 02 Jul 2020 15:25:37 -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=@linux-foundation.org header.s=google header.b=dg7C3tlr; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726304AbgGBWYu (ORCPT + 99 others); Thu, 2 Jul 2020 18:24:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726074AbgGBWYt (ORCPT ); Thu, 2 Jul 2020 18:24:49 -0400 Received: from mail-lj1-x242.google.com (mail-lj1-x242.google.com [IPv6:2a00:1450:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D694C08C5DD for ; Thu, 2 Jul 2020 15:24:49 -0700 (PDT) Received: by mail-lj1-x242.google.com with SMTP id q7so21019140ljm.1 for ; Thu, 02 Jul 2020 15:24:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rmRp1ZZXJd6eN5hNQwPnS8csHi2t2UcvvKpaxxW8OSo=; b=dg7C3tlrqxSyRBVh8XrZt1yUXgkta1ByzkZ3tEGx48lZx2vqiLJJ0X8MQO93IB5GAQ Afndo7zFedxvT5SxiIQiNfEnN2/vLTqdvDaY5UO/gaf+QPNh3aahvZem6AJDkhfqDzs3 0m3eDL9N5MmJgDJCsgtKgN4of3aNVBFTy72w4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=rmRp1ZZXJd6eN5hNQwPnS8csHi2t2UcvvKpaxxW8OSo=; b=lPzQ6HcgUV+VCepIZISTs8Cw77E5R4fzAl+d7+Gm3zE0koRFM5guhDnUEJu1V0u2qr gA44Qp9v9yv54OyhinKlPiX3U1GzfXvLYPOUTvktMEJ2SPy2YTWyxBmQQAwmPhAmgXKx c8/TJtjPH90SGlfyOBEgYUgFKJ0Bvhr/GeUlxjRtnzm3XhGBypziNs3tQj+fuS0aH+zY 5Zknd9D3MlpVx4UsM6wokQtPQc84l8HwldjvuwS0xnhZ4DbEx6JfxhBYITiU4YllkOws unoJ9ny7+wDWlZ5QkJW+1Jm+vKZEiRgUBdR/0Oconu8uGYrMl1VVGdJW9jkrNQNc8pJj o1hQ== X-Gm-Message-State: AOAM531HcZN1/IKHPr2y64CWnZSBV4uT3aRShPucLIINPRDmtJ8SXvLd HQSmNZh/KQqa+Hp4K/srrCm+MQpi/QY= X-Received: by 2002:a2e:b5c8:: with SMTP id g8mr2592366ljn.38.1593728687079; Thu, 02 Jul 2020 15:24:47 -0700 (PDT) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id r25sm3809822ljg.9.2020.07.02.15.24.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 02 Jul 2020 15:24:45 -0700 (PDT) Received: by mail-lf1-f54.google.com with SMTP id k17so4396996lfg.3 for ; Thu, 02 Jul 2020 15:24:45 -0700 (PDT) X-Received: by 2002:a19:8a07:: with SMTP id m7mr19715939lfd.31.1593728685003; Thu, 02 Jul 2020 15:24:45 -0700 (PDT) MIME-Version: 1.0 References: <20200629153502.2494656-1-sashal@kernel.org> <20200629153502.2494656-115-sashal@kernel.org> <20200702211717.GC5787@amd> In-Reply-To: <20200702211717.GC5787@amd> From: Linus Torvalds Date: Thu, 2 Jul 2020 15:24:29 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 4.19 114/131] ocfs2: avoid inode removal while nfsd is accessing it To: Pavel Machek Cc: Sasha Levin , Linux Kernel Mailing List , stable , Junxiao Bi , Joseph Qi , Changwei Ge , Gang He , Joel Becker , Jun Piao , Mark Fasheh , Andrew Morton , Greg Kroah-Hartman Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? Linus