NFS: discard NFS_RPC_SWAPFLAGS and RPC_TASK_ROOTCREDS
authorNeilBrown <neilb@suse.de>
Sun, 6 Mar 2022 23:41:44 +0000 (10:41 +1100)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 13 Mar 2022 16:59:35 +0000 (12:59 -0400)
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 <neilb@suse.de>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/read.c
include/linux/nfs_fs.h
include/linux/sunrpc/sched.h
include/trace/events/sunrpc.h
net/sunrpc/auth.c

index e4c1a49b012614769d7da61dc5e3e4fb0cf56e8e..5e7657374bc3f86b7ee1fa67050ac5870abe459e 100644 (file)
@@ -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);
 }
index 3893386ceaedef16c062dd1bf0d0a4e5dd756517..9074ed0b65aa9f15e3cdb0b424dde5f3631d21de 100644 (file)
  */
 #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
  */
index db964bb6391247e79e3aeff602a3084c74d56e00..56710f8056d3362740fd5f9f450efe7ab89a9e93 100644 (file)
@@ -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 */
index 29982d60b68ab271729d17190d175559a50eeb85..ac33892da411ba6eab5ab3b3fb012a6cc438a36c 100644 (file)
@@ -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" },                              \
index 6bfa19f9fa6a99b6384b04a20c492410f72f7df2..682fcd24bf439ca23aeffb3efd202b03f956187f 100644 (file)
@@ -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);