Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3402886pxb; Mon, 24 Jan 2022 08:52:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbUtHx3nIEjuyUpDGxX4Jno4TasLHBiE2j+d//OXNrEtTSVTiT++2T22OqC15HYg3tqQos X-Received: by 2002:a05:6a00:1745:b0:4c8:b982:d500 with SMTP id j5-20020a056a00174500b004c8b982d500mr7307651pfc.59.1643043161151; Mon, 24 Jan 2022 08:52:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643043161; cv=none; d=google.com; s=arc-20160816; b=RRgeBpr4KCO9Q6+NGpwD2WT4HWKm0dqhi56F7xIQVSVq531AXS0Mzof/J9lWqFrU9D IxibWxbRwkXtvg4cMTE5eg4EKxVGLDk/yg+XDNqBo7j0mckqkAcAST+0a8US8El7tdtA eIIQoCIbOCHtnxhAZ1rO1R1lbdWuJ7zt45SLOd5blhXLip7v33dtlpk74ce1w6C3gspY cFO6US6zGHDWavzzb87YsEZO3kRMdEOSUXebX5Q+umfCc+eWt43F2IHgWcAr8TCrjFDA cgi6Dp5JEnd0u2ES3ASoSdTid1YNlUBpcFmniNrNRV4FKZ+QSmZ6WMEI0hAnBdrS4BSo yI/g== 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:cc:to:from :subject:dkim-signature:dkim-signature; bh=azmox78FA+UkT5DRfdfUnBYA52daA5AqYmjfYZjaXVU=; b=Sg+S/AbtBV2Zc8XoeaC/xPntsCB8Zo0j3uSyiYNxpjpPYxHjazVTJaNmJEqCvj3P0P CHRm+hb02JIn31pW9503dIAlbfTQYSeoECUwnMZrFVNNNgxk3msam+3HRmAV49kEHSl0 Md50QwmfirTJfXtUPzXwTTOlm07XYFrrIsO3KHhjo9D6xEFhcGCpawqW44AoYrbkt/FI swt3zUaBtJKp4XnI7R/jXQZbgODBbDB8RvDK/nAL1gmEM0kSVqx0ke9HEKHugGg172dh oW64QQ7Ktlhwp7litCKoJm7Qkv9AuwUaedn4LGdnF6EFv86tDY2e2H+x/+5ZeKy0vpFg yC5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SvjCElxi; dkim=neutral (no key) header.i=@suse.de; 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 x4si13011551pfb.350.2022.01.24.08.52.28; Mon, 24 Jan 2022 08:52:41 -0800 (PST) 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=SvjCElxi; dkim=neutral (no key) header.i=@suse.de; 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 S241256AbiAXDyq (ORCPT + 99 others); Sun, 23 Jan 2022 22:54:46 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:57042 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241288AbiAXDyn (ORCPT ); Sun, 23 Jan 2022 22:54:43 -0500 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-out1.suse.de (Postfix) with ESMTPS id BEDB221995; Mon, 24 Jan 2022 03:54:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1642996481; 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=azmox78FA+UkT5DRfdfUnBYA52daA5AqYmjfYZjaXVU=; b=SvjCElxiZL71HUL1QKmR8N6TjTOkCtoj0nlAhVdRzI8aHkVdWC1FxUJsrJDadWz/jXad/E k0TSIoScbEGeNJNO4y9QqPG5lg887GwF5rgipEqDxURbMGWBMEpy56u9NvpCY+OTs3DyP8 Qcc3iIJ9CAKqgXXgydcQOIRxjh0Dnko= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1642996481; 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=azmox78FA+UkT5DRfdfUnBYA52daA5AqYmjfYZjaXVU=; b=2mur45c8AUVh1bD4Pih8u6DoyIKnnBRd535iZfKCCJaJTEhHv7J+v+vLrzpd//e+KDB5LX XZYsI4dHQYt8/yAQ== 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 B204013305; Mon, 24 Jan 2022 03:54:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id RDAXG/4i7mERRgAAMHmgww (envelope-from ); Mon, 24 Jan 2022 03:54:38 +0000 Subject: [PATCH 19/23] NFS: discard NFS_RPC_SWAPFLAGS and RPC_TASK_ROOTCREDS From: NeilBrown To: Trond Myklebust , Anna Schumaker , Chuck Lever , Andrew Morton , Mel Gorman , Christoph Hellwig , David Howells Cc: linux-nfs@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Mon, 24 Jan 2022 14:48:32 +1100 Message-ID: <164299611284.26253.4993812368278110635.stgit@noble.brown> In-Reply-To: <164299573337.26253.7538614611220034049.stgit@noble.brown> References: <164299573337.26253.7538614611220034049.stgit@noble.brown> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org NFS_RPC_SWAPFLAGS is only used for READ requests. It sets RPC_TASK_SWAPPER which gives some memory-allocation priority to requests. This is not needed for swap READ - though it is for writes where it is set via a different mechanism. RPC_TASK_ROOTCREDS causes the 'machine' credential to be used. This is not needed as the root credential is saved when the swap file is opened, and this is used for all IO. So NFS_RPC_SWAPFLAGS isn't needed, and as it is the only user of RPC_TASK_ROOTCREDS, that isn't needed either. Remove both. Signed-off-by: NeilBrown --- fs/nfs/read.c | 4 ---- include/linux/nfs_fs.h | 5 ----- include/linux/sunrpc/sched.h | 1 - include/trace/events/sunrpc.h | 1 - net/sunrpc/auth.c | 2 +- 5 files changed, 1 insertion(+), 12 deletions(-) diff --git a/fs/nfs/read.c b/fs/nfs/read.c index eb00229c1a50..cd797ce3a67c 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c @@ -194,10 +194,6 @@ static void nfs_initiate_read(struct nfs_pgio_header *hdr, const struct nfs_rpc_ops *rpc_ops, struct rpc_task_setup *task_setup_data, int how) { - struct inode *inode = hdr->inode; - int swap_flags = IS_SWAPFILE(inode) ? NFS_RPC_SWAPFLAGS : 0; - - task_setup_data->flags |= swap_flags; rpc_ops->read_setup(hdr, msg); trace_nfs_initiate_read(hdr); } diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index aba38dc4fd29..9e87752bdd00 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -45,11 +45,6 @@ */ #define NFS_MAX_TRANSPORTS 16 -/* - * These are the default flags for swap requests - */ -#define NFS_RPC_SWAPFLAGS (RPC_TASK_SWAPPER|RPC_TASK_ROOTCREDS) - /* * Size of the NFS directory verifier */ diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h index db964bb63912..56710f8056d3 100644 --- a/include/linux/sunrpc/sched.h +++ b/include/linux/sunrpc/sched.h @@ -124,7 +124,6 @@ struct rpc_task_setup { #define RPC_TASK_MOVEABLE 0x0004 /* nfs4.1+ rpc tasks */ #define RPC_TASK_NULLCREDS 0x0010 /* Use AUTH_NULL credential */ #define RPC_CALL_MAJORSEEN 0x0020 /* major timeout seen */ -#define RPC_TASK_ROOTCREDS 0x0040 /* force root creds */ #define RPC_TASK_DYNAMIC 0x0080 /* task was kmalloc'ed */ #define RPC_TASK_NO_ROUND_ROBIN 0x0100 /* send requests on "main" xprt */ #define RPC_TASK_SOFT 0x0200 /* Use soft timeouts */ diff --git a/include/trace/events/sunrpc.h b/include/trace/events/sunrpc.h index 1e566ac4b812..ef9e9351cb2f 100644 --- a/include/trace/events/sunrpc.h +++ b/include/trace/events/sunrpc.h @@ -311,7 +311,6 @@ TRACE_EVENT(rpc_request, { RPC_TASK_MOVEABLE, "MOVEABLE" }, \ { RPC_TASK_NULLCREDS, "NULLCREDS" }, \ { RPC_CALL_MAJORSEEN, "MAJORSEEN" }, \ - { RPC_TASK_ROOTCREDS, "ROOTCREDS" }, \ { RPC_TASK_DYNAMIC, "DYNAMIC" }, \ { RPC_TASK_NO_ROUND_ROBIN, "NO_ROUND_ROBIN" }, \ { RPC_TASK_SOFT, "SOFT" }, \ diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 6bfa19f9fa6a..682fcd24bf43 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c @@ -670,7 +670,7 @@ rpcauth_bindcred(struct rpc_task *task, const struct cred *cred, int flags) /* If machine cred couldn't be bound, try a root cred */ if (new) ; - else if (cred == &machine_cred || (flags & RPC_TASK_ROOTCREDS)) + else if (cred == &machine_cred) new = rpcauth_bind_root_cred(task, lookupflags); else if (flags & RPC_TASK_NULLCREDS) new = authnull_ops.lookup_cred(NULL, NULL, 0);