Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3354362pxf; Mon, 15 Mar 2021 07:50:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlvfg8i9iMH4E5XhRuukut3OHXQnyLIMI9yxVvrtJJNS6uf5ClcgXwaJ/iMHPjcY4E5R69 X-Received: by 2002:a17:906:3952:: with SMTP id g18mr8267669eje.104.1615819816630; Mon, 15 Mar 2021 07:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615819816; cv=none; d=google.com; s=arc-20160816; b=uwncJ46qJlzWhe2Bi2zyR+v/3E8FZBlOOBuPpkHFtu+Y94mBf9j/0CxlQT06Ncd9ZW 0O4x2vnXAgPNrnlkf45cEQJXvhKNlg0Vwkb+A1NZ8P0E7v2g8Xxx6URhUFjYYqiJXXNL bT1RISRjY7JpOJVW4Xo0+4zehQPG938iP5VaEWgS2zdh1P5v2+KIbrnqsD5CquK3OjrS E1oSbRZAxcQ0Ib4w76FlbX0vzeYai/5SIO78tAfF4MUGrdKHs6zkbjFWx+wz1ObqEk67 N2uDaGerXST4SRy1Ao1+uWqERdYOhQkPRqbha4LRdHe7Cr9Rs2zopNVLGDsnHcSYaTej eRxw== 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=vPakCeL857dYZ+IBnBReDXYpCm0hzW+kzQGNnxfzebM=; b=DmMdGsLUmFQ647riMRxbR3DhBUsne8UuQBUZldQRkgatSqqrxd+63pOLLVSnouH6Em /B/ytuFMQR4KHy8DtLwHZAlDRcJL7du+fxiotsbKPD5rkn4ZmN4gQrY4dUJzmXvZh9ED BWXAMKUZmUqaFemvaqgpfMdiE9Reoq5vnQPepja8zntb0gNY72mQbeeNOy8bj7f+rHNw otnXWign3tjxPhmZ8AvC067iE1LjWaS4IXkJn9DcTykcyAsJ9U8pq91Ahlvr1gK7U9h1 eLIiijll27ZhmIBZC2yEKZ137ttTNjcTw6u1tTvIFSwkIP5D9nh6LKkQig1ANDngt1nC XBvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dDXewo+J; 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 z26si10669664ejw.136.2021.03.15.07.49.53; Mon, 15 Mar 2021 07:50:16 -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=dDXewo+J; 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 S240923AbhCOOsO (ORCPT + 99 others); Mon, 15 Mar 2021 10:48:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:49518 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234241AbhCOODG (ORCPT ); Mon, 15 Mar 2021 10:03:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 77FE064EFD; Mon, 15 Mar 2021 14:03:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816986; bh=qWN0tpeZyplYUIYgezzOy80IpLdTww9WSjmeKYer3P4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dDXewo+JV7FQRwvN7xZ/XIZH835RvAPKqYuS3I1jgrU7OtbFq2VNhYPnwZF3xncc4 mJ1wbFtWUcW/bedJHLfTfrAqV1jsENdhHHVwKRqCZgw0F4NOJAWHg48E8R2E02G+ov uvR57c71CGxyuQd8cIb1NB3ntZmFYxKqvcOE3iPA= 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.11 245/306] SUNRPC: Set memalloc_nofs_save() for sync tasks Date: Mon, 15 Mar 2021 14:55:08 +0100 Message-Id: <20210315135515.919800930@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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 cf702a5f7fe5..39ed0e0afe6d 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c @@ -963,8 +963,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