Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp18774042ybl; Fri, 3 Jan 2020 08:47:40 -0800 (PST) X-Google-Smtp-Source: APXvYqyOfNHBo9nKQH0OVobl9R56C3kYVPAuXz10yUxSjG/nc0uWoAgnLcCTqghg5PoERkafK3DU X-Received: by 2002:a05:6830:1e16:: with SMTP id s22mr87659578otr.340.1578070060774; Fri, 03 Jan 2020 08:47:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578070060; cv=none; d=google.com; s=arc-20160816; b=nQkkW6MX2prPl37jccxQnSSxLv3b5/FpBR2BmzrYtSA89/7cNbMqnX4lK2isglTO9w J+4OFNKo9ZQg+GNMyqDTzWSX2Ga7scuWVwrdSzI9v631HpecSGWPFhhS7ZGIkFzOqTUu EEmiHSejbBf+28u/9sObZWZSX4eACOPLxeGdrUCcj9YELD48LJ7mosv5ILEXJCmsJ86a PPs79hWh2UIciyO+0JtFY3jsO//PTNWLZDg/D+BalT0qcto631CMtzizwli9SrD7yDZ6 hAUl6HHZTotodwijsPPUZZYlboztVjGBLBN0XXA810AJMWim6qoJpz3/Rq7oIj8dRYYx YECQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BNMP3qhFUAGhW9yXverTFMIlRuw4GkwF6c4TzWE5qec=; b=HCqu8wT+S5hOpoTkYEp4UUN5dlXznrhMByrZouTOowCRNIEMYU9RkeuCVccuT71KU7 iVr8jtFukKAemZ0w4gcSZL2Vgm4BPzgPzbuvn0GLl0tzEHlqrYRnnxpZx9HN40DG9Q8g 3SWQa76ZLszlWaEq5rTl3HU0CRYqsSPEFqCBsrU31bcXHpLrbZzg+xnyHhFlUTqEHvvq /u1yt5U61kugrJPx212ZSKv9u07CjqGkdtduVdb1PLYaWaJSiUlq3l5lT0QeDGFs9hcB N62wwLljJgWTdEpg5UpC/2C2fH4+QbXI9Pi61kSYB1EGRJX3dFsy2bx3exRmMAA8L0eM RSug== 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 v3si12360103oth.104.2020.01.03.08.47.25; Fri, 03 Jan 2020 08:47:40 -0800 (PST) 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 S1727974AbgACQrM (ORCPT + 99 others); Fri, 3 Jan 2020 11:47:12 -0500 Received: from fieldses.org ([173.255.197.46]:50554 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727912AbgACQrM (ORCPT ); Fri, 3 Jan 2020 11:47:12 -0500 Received: by fieldses.org (Postfix, from userid 2815) id B7D8D1CB4; Fri, 3 Jan 2020 11:47:11 -0500 (EST) Date: Fri, 3 Jan 2020 11:47:11 -0500 From: Bruce Fields To: Chuck Lever Cc: Trond Myklebust , Jeff Layton , Linux NFS Mailing List Subject: Re: CPU lockup in or near new filecache code Message-ID: <20200103164711.GB24306@fieldses.org> References: <9977648B-7D14-42EB-BD4A-CBD041A0C21A@oracle.com> <3af633a4016a183a930a44e3287f9da230711629.camel@hammerspace.com> <980CB8E4-0E7F-4F1D-B223-81176BE15A39@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <980CB8E4-0E7F-4F1D-B223-81176BE15A39@oracle.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Wed, Dec 18, 2019 at 06:20:56PM -0500, Chuck Lever wrote: > > On Dec 13, 2019, at 3:12 PM, Trond Myklebust wrote: > > Does something like the following help? > > > > 8<--------------------------------------------------- > > From caf515c82ed572e4f92ac8293e5da4818da0c6ce Mon Sep 17 00:00:00 2001 > > From: Trond Myklebust > > Date: Fri, 13 Dec 2019 15:07:33 -0500 > > Subject: [PATCH] nfsd: Fix a soft lockup race in > > nfsd_file_mark_find_or_create() > > > > If nfsd_file_mark_find_or_create() keeps winning the race for the > > nfsd_file_fsnotify_group->mark_mutex against nfsd_file_mark_put() > > then it can soft lock up, since fsnotify_add_inode_mark() ends > > up always finding an existing entry. > > > > Signed-off-by: Trond Myklebust > > --- > > fs/nfsd/filecache.c | 8 ++++++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/fs/nfsd/filecache.c b/fs/nfsd/filecache.c > > index 9c2b29e07975..f275c11c4e28 100644 > > --- a/fs/nfsd/filecache.c > > +++ b/fs/nfsd/filecache.c > > @@ -132,9 +132,13 @@ nfsd_file_mark_find_or_create(struct nfsd_file *nf) > > struct nfsd_file_mark, > > nfm_mark)); > > mutex_unlock(&nfsd_file_fsnotify_group->mark_mutex); > > - fsnotify_put_mark(mark); > > - if (likely(nfm)) > > + if (nfm) { > > + fsnotify_put_mark(mark); > > break; > > + } > > + /* Avoid soft lockup race with nfsd_file_mark_put() */ > > + fsnotify_destroy_mark(mark, nfsd_file_fsnotify_group); > > + fsnotify_put_mark(mark); > > } else > > mutex_unlock(&nfsd_file_fsnotify_group->mark_mutex); > > > > I've tried to reproduce the lockup for three days with this patch > applied to my server. No lockup. > > Tested-by: Chuck Lever I'm applying this for 5.5 with Chuck's tested-by and: Fixes: 65294c1f2c5e "nfsd: add a new struct file caching facility to nfsd" --b.