Received: by 2002:a05:6a10:8a4d:0:0:0:0 with SMTP id dn13csp254811pxb; Thu, 12 Aug 2021 15:48:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzC7Y/zUIJrq0hYj6KCDDFj0y0c4rUrflPLnrdt7IakQNxHTO9Bgle5N/QfkOgsVo7FRe6M X-Received: by 2002:a17:907:9152:: with SMTP id l18mr5856836ejs.190.1628808504350; Thu, 12 Aug 2021 15:48:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628808504; cv=none; d=google.com; s=arc-20160816; b=EoK2CtSGHDw4Dw3tlSUX6so72VZLjwCakdx7LCTRiNSZcRYqIOT0IgOCk2iUlx63/O /0nEKeOJxvwlgHZO7NpbSFr7UHmwBMqSzD/7AL1Pb7mMQzd7ath2sR7nrYnXpgMQoceU w3BrDe3smauq+gDNuszYoVvnXi+tgf6SdLkO52qk8hmTTx0B1lC/nynlMJx4eKsKPaGD YR/uRvIMQLtMSsaHu0cxXlSpasQdCcdH59lnsX32Eo2PtholcUgfixbd5TcHBn9M1wA1 kaRNhIAbQP3DG4dfXnwBXxBtRkA615UgexU+AKUjhOR+3JTRKLozrGAgVEmC6WvHMr76 tyFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=8NG/Nl+xLaaGV0VrGXl3aCbcv/ay2zFvI+KmIPBXXSI=; b=ccjZwrF62BeLehvv8p9Wf20A2q1eHJTB9FrlNvFwjI4oJ0GR5x+6QeTGBvV1JfYjW6 6I1BlcLoSjeKd8fAMl+D7jIAyjLigCHYcXhMwY04lnQFOukrGViweUaHD54I1wCBaJjG 6Pk00PSxgoDZTNjWbwVRp1gWwNQfsC+0N+NLpfZp7/W++l4kmCA3XAFtuAxjcisbF2Pm FBx79OaeJUq/mnc6K6gqVDOU1Xxou8vd4XDyZ0cWsAlxtv7G4hmtFwhjk6l3Uj9jkldn V1oZZqwSECw2L6hwyr3dqq4xZaCPhXCPC5fn+JwVBLdC7fe7mEMtyt28s4LUROxh4avu +gVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=f1sK5Eyh; dkim=neutral (no key) header.i=@suse.de header.b=kLOeHgV6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id by21si3189992ejb.289.2021.08.12.15.47.46; Thu, 12 Aug 2021 15:48:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@suse.de header.s=susede2_rsa header.b=f1sK5Eyh; dkim=neutral (no key) header.i=@suse.de header.b=kLOeHgV6; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233760AbhHLVg4 (ORCPT + 99 others); Thu, 12 Aug 2021 17:36:56 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:55270 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233283AbhHLVg4 (ORCPT ); Thu, 12 Aug 2021 17:36:56 -0400 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id BD0021FF79; Thu, 12 Aug 2021 21:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1628804189; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8NG/Nl+xLaaGV0VrGXl3aCbcv/ay2zFvI+KmIPBXXSI=; b=f1sK5EyhqgOmZ23WmAjo4UVpV3gbARWACUUl/U6LIWKzUImnnUpYAL2dwKhWpHd3NFPj9j sh24U6QHt9Lvi1ie9yRQazXx5oSEbi5QE93cntO1xxhEEFUZL+3exjovYzdOLjg2C8fv4r 2PyaoA/7MJQTv8gpv+V7S8zJaAHG1mM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1628804189; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8NG/Nl+xLaaGV0VrGXl3aCbcv/ay2zFvI+KmIPBXXSI=; b=kLOeHgV6doTp3hTdnOMbYlsbcaEU+6PZZ2P2dHbZIcJ4LAiooFptoNFuo8bZmlSVRFAfAJ QPw3oiQeJoVKP7CQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 25C2313C80; Thu, 12 Aug 2021 21:36:27 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id xVrfNFuUFWGybAAAMHmgww (envelope-from ); Thu, 12 Aug 2021 21:36:27 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit MIME-Version: 1.0 From: "NeilBrown" To: "J. Bruce Fields" Cc: "Timothy Pearson" , "Chuck Lever" , linux-nfs@vger.kernel.org, "Trond Myklebust" Subject: Re: CPU stall, eventual host hang with BTRFS + NFS under heavy load In-reply-to: <20210812144428.GA9536@fieldses.org> References: <281642234.3818.1625478269194.JavaMail.zimbra@raptorengineeringinc.com>, <162855621114.22632.14151019687856585770@noble.neil.brown.name>, <20210812144428.GA9536@fieldses.org> Date: Fri, 13 Aug 2021 07:36:25 +1000 Message-id: <162880418532.15074.7140645794203395299@noble.neil.brown.name> Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Fri, 13 Aug 2021, J. Bruce Fields wrote: > On Tue, Aug 10, 2021 at 10:43:31AM +1000, NeilBrown wrote: > > > > The problem here appears to be that a signalled task is being retried > > without clearing the SIGNALLED flag. That is causing the infinite loop > > and the soft lockup. > > > > This bug appears to have been introduced in Linux 5.2 by > > Commit: ae67bd3821bb ("SUNRPC: Fix up task signalling") > > I wonder how we arrived here. Does it require that an rpc task returns > from one of those rpc_delay() calls just as rpc_shutdown_client() is > signalling it? That's the only way async tasks get signalled, I think. I don't think "just as" is needed. I think it could only happen if rpc_shutdown_client() were called when there were active tasks - presumably from nfsd4_process_cb_update(), but I don't know the callback code well. If any of those active tasks has a ->done handler which might try to reschedule the task when tk_status == -ERESTARTSYS, then you get into the infinite loop. > > > Prior to this commit a flag RPC_TASK_KILLED was used, and it gets > > cleared by rpc_reset_task_statistics() (called from rpc_exit_task()). > > After this commit a new flag RPC_TASK_SIGNALLED is used, and it is never > > cleared. > > > > A fix might be to clear RPC_TASK_SIGNALLED in > > rpc_reset_task_statistics(), but I'll leave that decision to someone > > else. > > Might be worth testing with that change just to verify that this is > what's happening. > > diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c > index c045f63d11fa..caa931888747 100644 > --- a/net/sunrpc/sched.c > +++ b/net/sunrpc/sched.c > @@ -813,7 +813,8 @@ static void > rpc_reset_task_statistics(struct rpc_task *task) > { > task->tk_timeouts = 0; > - task->tk_flags &= ~(RPC_CALL_MAJORSEEN|RPC_TASK_SENT); > + task->tk_flags &= ~(RPC_CALL_MAJORSEEN|RPC_TASK_SIGNALLED| > + RPC_TASK_SENT); NONONONONO. RPC_TASK_SIGNALLED is a flag in tk_runstate. So you need clear_bit(RPC_TASK_SIGNALLED, &task->tk_runstate); NeilBrown