Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp3511123ybg; Mon, 28 Oct 2019 14:06:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCbNqDlpM5KYakPyJisMnAJA2d8E5qw/IkuNv00yO6dRXsvg2FtDcKcVx13NAQDr2FtU1a X-Received: by 2002:a05:6402:60d:: with SMTP id n13mr20592985edv.218.1572296807381; Mon, 28 Oct 2019 14:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572296807; cv=none; d=google.com; s=arc-20160816; b=lab7FYQ1an2ZEec15Cg00vyCw0FH1tbdvyzCmJllcKymuREhulnh+6GZLTYNCNMpzC hrnc1tlHmdpoSAhwXA1MEooM6B/Sp9G5StWZFh8uLYL6pq1WMPOsh0bqYU+5OYhHigMu z0fkkIVAxs2WumrsLxN/nMR1gUnq6MhNz/mm2sh20Y/Vr7Ui9R4UR+E8+fXGFDQMYf8C heSYvs4iu32txWRy73EkYEQE3nZOL1mS9koIPx7Q5M2nh7VDrzJ2E45bZX8z1k/RYBQ3 Di26uw6nW+T2ly5prbEiSFymoJmPuR3pdeJ5V7zSlmqaQe5EUBCdjY7JeN6VXutA9XD4 lGgw== 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=yWsFFCs8EwoIWT5dDH50WWYMdtjzDT9mu7PPbbRsUeY=; b=dymadApZ5mAvy1fM/rP28SELJvL5il4AlTlJLSAhcV2LJ9gqJEHXiee78aSEaeEqZ7 9VCQ8jv5h369DgVQA4qWCbnD3SSu5go1366iA2PsMhh3JdjK8Z64D/RVEGLmkuV6dVte SpPx332juzTPfx1eR8QW4DyijdRFTflF/4rc/7kaI0rMQKcc644HAheR962KFEifWuwd lGGThTxyMkHtkGiEBlPdxvLVDo5YK1lBZyK1wjVbHOJzzMIj4BJ8qMwPPST5dhFKNoHb 21f6VHT0DGSXIw0++Q45fJiwqCDc0kMcfTCp08+U+78hvMW0G4WUqf6anSEN1iSnXtwA Rjfg== 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 m7si9737438eda.192.2019.10.28.14.06.11; Mon, 28 Oct 2019 14:06:47 -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 S1730831AbfJ1OwI (ORCPT + 99 others); Mon, 28 Oct 2019 10:52:08 -0400 Received: from fieldses.org ([173.255.197.46]:34536 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730792AbfJ1OwI (ORCPT ); Mon, 28 Oct 2019 10:52:08 -0400 Received: by fieldses.org (Postfix, from userid 2815) id 8B1571511; Mon, 28 Oct 2019 10:52:07 -0400 (EDT) Date: Mon, 28 Oct 2019 10:52:07 -0400 From: "J. Bruce Fields" To: NeilBrown Cc: "J. Bruce Fields" , linux-nfs@vger.kernel.org Subject: Re: uncollected nfsd open owners Message-ID: <20191028145207.GA4607@fieldses.org> References: <87mudpfwkj.fsf@notabene.neil.brown.name> <20191025152047.GB16053@pick.fieldses.org> <20191026213606.GA11394@fieldses.org> <87h83tg35l.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h83tg35l.fsf@notabene.neil.brown.name> 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 Mon, Oct 28, 2019 at 10:49:26AM +1100, NeilBrown wrote: > On Sat, Oct 26 2019, J. Bruce Fields wrote: > > > On Fri, Oct 25, 2019 at 11:20:47AM -0400, J. Bruce Fields wrote: > >> On Fri, Oct 25, 2019 at 12:22:36PM +1100, NeilBrown wrote: > >> > I have a coredump from a machine that was running as an NFS server. > >> > nfs4_laundromat was trying to expire a client, and in particular was > >> > cleaning up the ->cl_openowners. > >> > As there were 6.5 million of these, it took rather longer than the > >> > softlockup timer thought was acceptable, and hence the core dump. > >> > > >> > Those open owners that I looked at had empty so_stateids lists, so I > >> > would normally expect them to be on the close_lru and to be removed > >> > fairly soon. But they weren't (only 32 openowners on close_lru). > >> > > >> > The only explanation I can think of for this is that maybe an OPEN > >> > request successfully got through nfs4_process_open1(), thus creating an > >> > open owner, but failed to get to or through nfs4_process_open2(), and > >> > so didn't add a stateid. I *think* this can leave an openowner that is > >> > unused but will never be cleaned up (until the client is expired, which > >> > might be too late). > >> > > >> > Is this possible? If so, how should we handle those openowners which > >> > never had a stateid? > >> > In 3.0 (which it the kernel were I saw this) I could probably just put > >> > the openowner on the close_lru when it is created. > >> > In more recent kernels, it seems to be assumed that openowners are only > >> > on close_lru if they have a oo_last_closed_stid. Would we need a > >> > separate "never used lru", or should they just be destroyed as soon as > >> > the open fails? > >> > >> Hopefully we can just throw the new openowner away when the open fails. > >> > >> But it looks like the new openowner is visible on global data structures > >> by then, so we need to be sure somebody else isn't about to use it. > > > > But, also, if this has only been seen on 3.0, it may have been fixed > > already. It sounds like kind of a familiar problem, but I didn't spot a > > relevant commit on a quick look through the logs. > > > I guess I shouldn't expect you to remember something from 8 years ago. > This seems a perfect fit for what I see: > > commit d29b20cd589128a599e5045d4effc2d7dbc388f5 > Author: J. Bruce Fields > Date: Thu Oct 13 15:12:59 2011 -0400 > > nfsd4: clean up open owners on OPEN failure > > If process_open1() creates a new open owner, but the open later fails, > the current code will leave the open owner around. It won't be on the > close_lru list, and the client isn't expected to send a CLOSE, so it > will hang around as long as the client does. > > Similarly, if process_open1() removes an existing open owner from the > close lru, anticipating that an open owner that previously had no > associated stateid's now will, but the open subsequently fails, then > we'll again be left with the same leak. > > Fix both problems. > > I wonder if this is safe to backport ... 3.2 is fairly close to 3.0, but > there have been lots of changes to the code since then ... maybe there > are more bug fixes. > I'll work something out. This is all before the breakup of the big state lock, so you don't have that to worry about, at least. Anyway, not even remembering that commit, I'm afraid I'm no more expert on that era of the history that you at this point.... --b.