aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@netapp.com>2013-08-13 16:37:36 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-09-05 10:49:35 -0400
commit3787d5063c52b0c38003e6293f24839508604070 (patch)
treed64ce8c1d73b7db57035b8eb4d15b617de1d56a0
parent8b5bee2e1b60a611b15b1862f55e60cc9f668324 (diff)
nfs4.1: Add SP4_MACH_CRED stateid support
TEST_STATEID and FREE_STATEID can use the machine credential. Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/nfs4proc.c19
-rw-r--r--include/linux/nfs_fs_sb.h1
2 files changed, 18 insertions, 2 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5c917c975432..4818a38f469b 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6143,7 +6143,9 @@ static const struct nfs41_state_protection nfs4_sp4_mach_cred_request = {
6143 [0] = 1 << (OP_CLOSE) | 6143 [0] = 1 << (OP_CLOSE) |
6144 1 << (OP_LOCKU), 6144 1 << (OP_LOCKU),
6145 [1] = 1 << (OP_SECINFO - 32) | 6145 [1] = 1 << (OP_SECINFO - 32) |
6146 1 << (OP_SECINFO_NO_NAME - 32) 6146 1 << (OP_SECINFO_NO_NAME - 32) |
6147 1 << (OP_TEST_STATEID - 32) |
6148 1 << (OP_FREE_STATEID - 32)
6147 } 6149 }
6148}; 6150};
6149 6151
@@ -6215,6 +6217,12 @@ static int nfs4_sp4_select_mode(struct nfs_client *clp,
6215 dfprintk(MOUNT, " secinfo mode enabled\n"); 6217 dfprintk(MOUNT, " secinfo mode enabled\n");
6216 set_bit(NFS_SP4_MACH_CRED_SECINFO, &clp->cl_sp4_flags); 6218 set_bit(NFS_SP4_MACH_CRED_SECINFO, &clp->cl_sp4_flags);
6217 } 6219 }
6220
6221 if (test_bit(OP_TEST_STATEID, sp->allow.u.longs) &&
6222 test_bit(OP_FREE_STATEID, sp->allow.u.longs)) {
6223 dfprintk(MOUNT, " stateid mode enabled\n");
6224 set_bit(NFS_SP4_MACH_CRED_STATEID, &clp->cl_sp4_flags);
6225 }
6218 } 6226 }
6219 6227
6220 return 0; 6228 return 0;
@@ -7547,11 +7555,15 @@ static int _nfs41_test_stateid(struct nfs_server *server,
7547 .rpc_resp = &res, 7555 .rpc_resp = &res,
7548 .rpc_cred = cred, 7556 .rpc_cred = cred,
7549 }; 7557 };
7558 struct rpc_clnt *rpc_client = server->client;
7559
7560 nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_STATEID,
7561 &rpc_client, &msg);
7550 7562
7551 dprintk("NFS call test_stateid %p\n", stateid); 7563 dprintk("NFS call test_stateid %p\n", stateid);
7552 nfs4_init_sequence(&args.seq_args, &res.seq_res, 0); 7564 nfs4_init_sequence(&args.seq_args, &res.seq_res, 0);
7553 nfs4_set_sequence_privileged(&args.seq_args); 7565 nfs4_set_sequence_privileged(&args.seq_args);
7554 status = nfs4_call_sync_sequence(server->client, server, &msg, 7566 status = nfs4_call_sync_sequence(rpc_client, server, &msg,
7555 &args.seq_args, &res.seq_res); 7567 &args.seq_args, &res.seq_res);
7556 if (status != NFS_OK) { 7568 if (status != NFS_OK) {
7557 dprintk("NFS reply test_stateid: failed, %d\n", status); 7569 dprintk("NFS reply test_stateid: failed, %d\n", status);
@@ -7643,6 +7655,9 @@ static struct rpc_task *_nfs41_free_stateid(struct nfs_server *server,
7643 }; 7655 };
7644 struct nfs_free_stateid_data *data; 7656 struct nfs_free_stateid_data *data;
7645 7657
7658 nfs4_state_protect(server->nfs_client, NFS_SP4_MACH_CRED_STATEID,
7659 &task_setup.rpc_client, &msg);
7660
7646 dprintk("NFS call free_stateid %p\n", stateid); 7661 dprintk("NFS call free_stateid %p\n", stateid);
7647 data = kmalloc(sizeof(*data), GFP_NOFS); 7662 data = kmalloc(sizeof(*data), GFP_NOFS);
7648 if (!data) 7663 if (!data)
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 800da116950b..179586555bbe 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -96,6 +96,7 @@ struct nfs_client {
96 * must use machine cred */ 96 * must use machine cred */
97#define NFS_SP4_MACH_CRED_CLEANUP 2 /* CLOSE and LOCKU */ 97#define NFS_SP4_MACH_CRED_CLEANUP 2 /* CLOSE and LOCKU */
98#define NFS_SP4_MACH_CRED_SECINFO 3 /* SECINFO and SECINFO_NO_NAME */ 98#define NFS_SP4_MACH_CRED_SECINFO 3 /* SECINFO and SECINFO_NO_NAME */
99#define NFS_SP4_MACH_CRED_STATEID 4 /* TEST_STATEID and FREE_STATEID */
99#endif /* CONFIG_NFS_V4 */ 100#endif /* CONFIG_NFS_V4 */
100 101
101#ifdef CONFIG_NFS_FSCACHE 102#ifdef CONFIG_NFS_FSCACHE