Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3524422pxf; Mon, 15 Mar 2021 11:28:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyArVXreCpWK4ztpEvVKl5LnBPMW+/L3rEZbzHUhS0Y34SUtT+LA0QOzl+AI8ctEm1sgfln X-Received: by 2002:a17:907:10ce:: with SMTP id rv14mr25607484ejb.56.1615832920361; Mon, 15 Mar 2021 11:28:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832920; cv=none; d=google.com; s=arc-20160816; b=ZGXUUcc3bgD2M1SRPCl4c71m49uYl1ZZXLBCg+mDBRRfLwKGoTEvLZdHhJowjwp9LC TXf003nBJT0cFbonJHLtYrTYA46m+x3oNpNjChHV2R7gFxPGJe6mJKWwpYtIiRQniUcj AhMNWJGHt1GvxWcdSdOdRsMcx2TsoCSU6/rBGdMg/54sklBgaXWS1T/bpEymheXmBBFZ OFukMytWfzP42cjOgIalSwNQaHRLYk4Ede/G3qkONnWfh+mRINcwCZ5g3UigCspwD8Ox nkSaTBprPckQZKT6qwb5dolPSvVVjuOimfXwWS0fyM0HtuhTTrRhkKONcFbsOOTdr4Be VW/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6wqh1zRT5gqTyPkhghfDxy59XcRniOeUp4589SudqXM=; b=KM7AVJf3IdbM5ZPmTbARn3AKVU4moGzsiOEY1eFlDOMX4+a0SJ0nJ5t3ROgN8KACZ2 +VMd8jQ8vfbXKwBRM6JVn97hWh68RfB39XoLbgT+b4bQGw1UG8JwxpYvNA15M7cxv0vj FljucZG4irRyfMFvX0kRdqQ6f9vT0jHTE2u+ZPyR13NMJqfJLBcIfgUYacpTuQ4EYyOl 1goICxDJ4hHEYTl+ptLMf3pjq1Jv1Xvz74urzBHztZFAfEyyNd+rvu+RUevs8jVRSoTa 0P2wi45tcxSg8tZjDnEiFtaUHjvNSGeKfldHd9Kca1cMPMgclAzpLEfSX3pP+gT3o9or IMmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="IfD6YL/X"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co21si11942588edb.513.2021.03.15.11.28.10; Mon, 15 Mar 2021 11:28:40 -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=@linuxfoundation.org header.s=korg header.b="IfD6YL/X"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235048AbhCOObw (ORCPT + 99 others); Mon, 15 Mar 2021 10:31:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:37632 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229743AbhCOOBL (ORCPT ); Mon, 15 Mar 2021 10:01:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 906E164F0C; Mon, 15 Mar 2021 14:00:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816838; bh=fg8Q1EYWAk3JgG7ZOKsNwOrprZ0nqJY0OgF5mVDigTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfD6YL/Xdyo/HbNZyZ9gp0v6RPetwkqDH3FDB5OI1LIOvjxY3u7zRQ1sotEK+ZSEu oYCJF6bdIBVxPc79mkXI/cafNDLnujavBzSXpPW1NGDiiqqwMzZckBJF58yipDpo0K vnAAgXiaT3i25edOnfHYrdiiYrUmq8gJWGY7qrTo= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Coddington , Anna Schumaker , Sasha Levin Subject: [PATCH 5.4 145/168] SUNRPC: Set memalloc_nofs_save() for sync tasks Date: Mon, 15 Mar 2021 14:56:17 +0100 Message-Id: <20210315135555.106561418@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Benjamin Coddington [ Upstream commit f0940f4b3284a00f38a5d42e6067c2aaa20e1f2e ] We could recurse into NFS doing memory reclaim while sending a sync task, which might result in a deadlock. Set memalloc_nofs_save for sync task execution. Fixes: a1231fda7e94 ("SUNRPC: Set memalloc_nofs_save() on all rpciod/xprtiod jobs") Signed-off-by: Benjamin Coddington Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- net/sunrpc/sched.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 7afbf15bcbd9..4beb6d2957c3 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -990,8 +990,11 @@ void rpc_execute(struct rpc_task *task) rpc_set_active(task); rpc_make_runnable(rpciod_workqueue, task); - if (!is_async) + if (!is_async) { + unsigned int pflags = memalloc_nofs_save(); __rpc_execute(task); + memalloc_nofs_restore(pflags); + } } static void rpc_async_schedule(struct work_struct *work) -- 2.30.1