diff options
author | Andrew Elble <aweits@rit.edu> | 2015-12-02 09:39:51 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-12-28 09:57:15 -0500 |
commit | 99ade3c71b1e40e7174d6527709399a87f3d05e0 (patch) | |
tree | 06d6b1090beba99e44018f4e2948577a2e9f53dc | |
parent | ed476752493bc997f1690516fdc0609ddcbaca82 (diff) |
nfs: machine credential support for additional operations
Allow LAYOUTRETURN and DELEGRETURN to use machine credentials if the
server supports it. Add request for OPEN_DOWNGRADE as the close path
also uses that.
Signed-off-by: Andrew Elble <aweits@rit.edu>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 20 | ||||
-rw-r--r-- | include/linux/nfs_fs_sb.h | 1 |
2 files changed, 21 insertions, 0 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 18d862db15b6..a7d564a83665 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -5383,6 +5383,11 @@ static int _nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, co | |||
5383 | if (data == NULL) | 5383 | if (data == NULL) |
5384 | return -ENOMEM; | 5384 | return -ENOMEM; |
5385 | nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1); | 5385 | nfs4_init_sequence(&data->args.seq_args, &data->res.seq_res, 1); |
5386 | |||
5387 | nfs4_state_protect(server->nfs_client, | ||
5388 | NFS_SP4_MACH_CRED_CLEANUP, | ||
5389 | &task_setup_data.rpc_client, &msg); | ||
5390 | |||
5386 | data->args.fhandle = &data->fh; | 5391 | data->args.fhandle = &data->fh; |
5387 | data->args.stateid = &data->stateid; | 5392 | data->args.stateid = &data->stateid; |
5388 | data->args.bitmask = server->cache_consistency_bitmask; | 5393 | data->args.bitmask = server->cache_consistency_bitmask; |
@@ -6859,10 +6864,13 @@ static const struct nfs41_state_protection nfs4_sp4_mach_cred_request = { | |||
6859 | }, | 6864 | }, |
6860 | .allow.u.words = { | 6865 | .allow.u.words = { |
6861 | [0] = 1 << (OP_CLOSE) | | 6866 | [0] = 1 << (OP_CLOSE) | |
6867 | 1 << (OP_OPEN_DOWNGRADE) | | ||
6862 | 1 << (OP_LOCKU) | | 6868 | 1 << (OP_LOCKU) | |
6869 | 1 << (OP_DELEGRETURN) | | ||
6863 | 1 << (OP_COMMIT), | 6870 | 1 << (OP_COMMIT), |
6864 | [1] = 1 << (OP_SECINFO - 32) | | 6871 | [1] = 1 << (OP_SECINFO - 32) | |
6865 | 1 << (OP_SECINFO_NO_NAME - 32) | | 6872 | 1 << (OP_SECINFO_NO_NAME - 32) | |
6873 | 1 << (OP_LAYOUTRETURN - 32) | | ||
6866 | 1 << (OP_TEST_STATEID - 32) | | 6874 | 1 << (OP_TEST_STATEID - 32) | |
6867 | 1 << (OP_FREE_STATEID - 32) | | 6875 | 1 << (OP_FREE_STATEID - 32) | |
6868 | 1 << (OP_WRITE - 32) | 6876 | 1 << (OP_WRITE - 32) |
@@ -6927,11 +6935,19 @@ static int nfs4_sp4_select_mode(struct nfs_client *clp, | |||
6927 | } | 6935 | } |
6928 | 6936 | ||
6929 | if (test_bit(OP_CLOSE, sp->allow.u.longs) && | 6937 | if (test_bit(OP_CLOSE, sp->allow.u.longs) && |
6938 | test_bit(OP_OPEN_DOWNGRADE, sp->allow.u.longs) && | ||
6939 | test_bit(OP_DELEGRETURN, sp->allow.u.longs) && | ||
6930 | test_bit(OP_LOCKU, sp->allow.u.longs)) { | 6940 | test_bit(OP_LOCKU, sp->allow.u.longs)) { |
6931 | dfprintk(MOUNT, " cleanup mode enabled\n"); | 6941 | dfprintk(MOUNT, " cleanup mode enabled\n"); |
6932 | set_bit(NFS_SP4_MACH_CRED_CLEANUP, &clp->cl_sp4_flags); | 6942 | set_bit(NFS_SP4_MACH_CRED_CLEANUP, &clp->cl_sp4_flags); |
6933 | } | 6943 | } |
6934 | 6944 | ||
6945 | if (test_bit(OP_LAYOUTRETURN, sp->allow.u.longs)) { | ||
6946 | dfprintk(MOUNT, " pnfs cleanup mode enabled\n"); | ||
6947 | set_bit(NFS_SP4_MACH_CRED_PNFS_CLEANUP, | ||
6948 | &clp->cl_sp4_flags); | ||
6949 | } | ||
6950 | |||
6935 | if (test_bit(OP_SECINFO, sp->allow.u.longs) && | 6951 | if (test_bit(OP_SECINFO, sp->allow.u.longs) && |
6936 | test_bit(OP_SECINFO_NO_NAME, sp->allow.u.longs)) { | 6952 | test_bit(OP_SECINFO_NO_NAME, sp->allow.u.longs)) { |
6937 | dfprintk(MOUNT, " secinfo mode enabled\n"); | 6953 | dfprintk(MOUNT, " secinfo mode enabled\n"); |
@@ -8084,6 +8100,10 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp, bool sync) | |||
8084 | }; | 8100 | }; |
8085 | int status = 0; | 8101 | int status = 0; |
8086 | 8102 | ||
8103 | nfs4_state_protect(NFS_SERVER(lrp->args.inode)->nfs_client, | ||
8104 | NFS_SP4_MACH_CRED_PNFS_CLEANUP, | ||
8105 | &task_setup_data.rpc_client, &msg); | ||
8106 | |||
8087 | dprintk("--> %s\n", __func__); | 8107 | dprintk("--> %s\n", __func__); |
8088 | if (!sync) { | 8108 | if (!sync) { |
8089 | lrp->inode = nfs_igrab_and_active(lrp->args.inode); | 8109 | lrp->inode = nfs_igrab_and_active(lrp->args.inode); |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 2469ab0bb3a1..7fcc13c8cf1f 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -102,6 +102,7 @@ struct nfs_client { | |||
102 | #define NFS_SP4_MACH_CRED_STATEID 4 /* TEST_STATEID and FREE_STATEID */ | 102 | #define NFS_SP4_MACH_CRED_STATEID 4 /* TEST_STATEID and FREE_STATEID */ |
103 | #define NFS_SP4_MACH_CRED_WRITE 5 /* WRITE */ | 103 | #define NFS_SP4_MACH_CRED_WRITE 5 /* WRITE */ |
104 | #define NFS_SP4_MACH_CRED_COMMIT 6 /* COMMIT */ | 104 | #define NFS_SP4_MACH_CRED_COMMIT 6 /* COMMIT */ |
105 | #define NFS_SP4_MACH_CRED_PNFS_CLEANUP 7 /* LAYOUTRETURN */ | ||
105 | #endif /* CONFIG_NFS_V4 */ | 106 | #endif /* CONFIG_NFS_V4 */ |
106 | 107 | ||
107 | /* Our own IP address, as a null-terminated string. | 108 | /* Our own IP address, as a null-terminated string. |