Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3528096pxf; Mon, 15 Mar 2021 11:33:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLlfVcAszfxUn/UjFlAu+J7hVMEhwwA8l5TRPY7Ajcq8o5Hc7JIU5ET7T72EDCqYwCRECi X-Received: by 2002:a17:906:d9c9:: with SMTP id qk9mr24840254ejb.504.1615833212621; Mon, 15 Mar 2021 11:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833212; cv=none; d=google.com; s=arc-20160816; b=kF79nRC6F4+yYzUtgZVPUyYNIotLf4M2WlN/KG++vnwNmdvsv1QZs9Gom+XpUMCORH DlVRUQ7C7Fchn9ACHR0DlpiRbFpYiWbJYiqbAxxUJMfQeWOyKD7OloenI8zuO39CnUEx WjWwtKTkMBtgtGpd55KoIA4fYmRU/vc4FqNTmKaH0OhSOBOln+d8GldP9PzBsMglhIvV F7N8ez2QUZIcBjpPuaCIrfnr0lEu8FUs0c4PTNJ1Es9TZcF1OW8NTHBRWbVF2Hjb89NK KRjYZGzy33oPTP+s/vPcHtxaOFsdLLSRNMio1kLI8LQFBYDi7bjAF1lUr09FWtfKrlkR 79CQ== 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=EPyMqDAQ20t+KF8NCnnU2TO6RUCHe+cPE1l2QAKmHjSrHSuqgtyBdByZgdDhoFNsBI nyBCVxmjFK2dQmij0eC5FULX2EDVlov84HctskFNDE0PtHSViajt3157QaxPCftPoAw7 9FSRRDrKSyqlINLZ2UB+E+Xp1VK7ZM8wkk8q6PoFY2mgCkuooDec/EMEnSwVC4U2/dXG rBGAfpaU4kJlnKA6e7EIXqPSzL8ShNA4odVb9iHe630exTObYwdoU5nwPHE8Ag2YSysP spiso2LrGaICP1YeMgv4lPW4w5x5sGaw8q+1XM9ju35LJNzbBlp3Xnx/Marw9nQLaRzh YNyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=d8duqTxA; 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 z15si11835332edr.361.2021.03.15.11.33.10; Mon, 15 Mar 2021 11:33:32 -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=d8duqTxA; 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 S237995AbhCOOnh (ORCPT + 99 others); Mon, 15 Mar 2021 10:43:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:49822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231151AbhCOODa (ORCPT ); Mon, 15 Mar 2021 10:03:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id AAB8D64EF1; Mon, 15 Mar 2021 14:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615817009; bh=qWN0tpeZyplYUIYgezzOy80IpLdTww9WSjmeKYer3P4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8duqTxA+fEG0GjASinM1QQtBEuAUoVcasti+AKj9kLwLghWZeaZxk97PNlRB8p4D TD2IVK19fiWwQmpx02POWa2tWBhm7fzHRzI93mDIzOFI1lc+Vddd0q8kjfkxXj3M7m t4P5aFA5B47/iXeu391JBoRYFjeZcIBSn5w+saT4= 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.10 245/290] SUNRPC: Set memalloc_nofs_save() for sync tasks Date: Mon, 15 Mar 2021 14:55:38 +0100 Message-Id: <20210315135550.298265584@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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