aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2013-03-15 16:11:57 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2013-03-25 12:04:11 -0400
commit39c6daae70fe7692fc2d28738c7ebd63f0318741 (patch)
tree123246157abfaed0d4a61d5aeb3c8c6e2ffb7e65 /fs/nfs
parent5521abfdcf4d67c3441d4414f29e1acd7cc43380 (diff)
NFSv4: Prepare for minorversion-specific nfs_server capabilities
Clean up the setting of the nfs_server->caps, by shoving it all into nfs4_server_common_setup(). Then add an 'initial capabilities' field into struct nfs4_minor_version_ops. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4_fs.h1
-rw-r--r--fs/nfs/nfs4client.c24
-rw-r--r--fs/nfs/nfs4proc.c8
3 files changed, 22 insertions, 11 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 627a74f0e248..7ef19ce6d832 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -36,6 +36,7 @@ enum nfs4_client_state {
36 36
37struct nfs4_minor_version_ops { 37struct nfs4_minor_version_ops {
38 u32 minor_version; 38 u32 minor_version;
39 unsigned init_caps;
39 40
40 int (*call_sync)(struct rpc_clnt *clnt, 41 int (*call_sync)(struct rpc_clnt *clnt,
41 struct nfs_server *server, 42 struct nfs_server *server,
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c
index ac4fc9a8fdbc..17b34b2da2df 100644
--- a/fs/nfs/nfs4client.c
+++ b/fs/nfs/nfs4client.c
@@ -717,6 +717,19 @@ static int nfs4_server_common_setup(struct nfs_server *server,
717 if (error < 0) 717 if (error < 0)
718 goto out; 718 goto out;
719 719
720 /* Set the basic capabilities */
721 server->caps |= server->nfs_client->cl_mvops->init_caps;
722 if (server->flags & NFS_MOUNT_NORDIRPLUS)
723 server->caps &= ~NFS_CAP_READDIRPLUS;
724 /*
725 * Don't use NFS uid/gid mapping if we're using AUTH_SYS or lower
726 * authentication.
727 */
728 if (nfs4_disable_idmapping &&
729 server->client->cl_auth->au_flavor == RPC_AUTH_UNIX)
730 server->caps |= NFS_CAP_UIDGID_NOMAP;
731
732
720 /* Probe the root fh to retrieve its FSID and filehandle */ 733 /* Probe the root fh to retrieve its FSID and filehandle */
721 error = nfs4_get_rootfh(server, mntfh); 734 error = nfs4_get_rootfh(server, mntfh);
722 if (error < 0) 735 if (error < 0)
@@ -760,9 +773,6 @@ static int nfs4_init_server(struct nfs_server *server,
760 773
761 /* Initialise the client representation from the mount data */ 774 /* Initialise the client representation from the mount data */
762 server->flags = data->flags; 775 server->flags = data->flags;
763 server->caps |= NFS_CAP_ATOMIC_OPEN|NFS_CAP_CHANGE_ATTR|NFS_CAP_POSIX_LOCK;
764 if (!(data->flags & NFS_MOUNT_NORDIRPLUS))
765 server->caps |= NFS_CAP_READDIRPLUS;
766 server->options = data->options; 776 server->options = data->options;
767 777
768 /* Get a client record */ 778 /* Get a client record */
@@ -779,13 +789,6 @@ static int nfs4_init_server(struct nfs_server *server,
779 if (error < 0) 789 if (error < 0)
780 goto error; 790 goto error;
781 791
782 /*
783 * Don't use NFS uid/gid mapping if we're using AUTH_SYS or lower
784 * authentication.
785 */
786 if (nfs4_disable_idmapping && data->auth_flavors[0] == RPC_AUTH_UNIX)
787 server->caps |= NFS_CAP_UIDGID_NOMAP;
788
789 if (data->rsize) 792 if (data->rsize)
790 server->rsize = nfs_block_size(data->rsize, NULL); 793 server->rsize = nfs_block_size(data->rsize, NULL);
791 if (data->wsize) 794 if (data->wsize)
@@ -863,7 +866,6 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
863 866
864 /* Initialise the client representation from the parent server */ 867 /* Initialise the client representation from the parent server */
865 nfs_server_copy_userdata(server, parent_server); 868 nfs_server_copy_userdata(server, parent_server);
866 server->caps |= NFS_CAP_ATOMIC_OPEN|NFS_CAP_CHANGE_ATTR;
867 869
868 /* Get a client representation. 870 /* Get a client representation.
869 * Note: NFSv4 always uses TCP, */ 871 * Note: NFSv4 always uses TCP, */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 6ad06121d88c..22c80f9ed824 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -6823,6 +6823,10 @@ static const struct nfs4_state_maintenance_ops nfs41_state_renewal_ops = {
6823 6823
6824static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = { 6824static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = {
6825 .minor_version = 0, 6825 .minor_version = 0,
6826 .init_caps = NFS_CAP_READDIRPLUS
6827 | NFS_CAP_ATOMIC_OPEN
6828 | NFS_CAP_CHANGE_ATTR
6829 | NFS_CAP_POSIX_LOCK,
6826 .call_sync = _nfs4_call_sync, 6830 .call_sync = _nfs4_call_sync,
6827 .match_stateid = nfs4_match_stateid, 6831 .match_stateid = nfs4_match_stateid,
6828 .find_root_sec = nfs4_find_root_sec, 6832 .find_root_sec = nfs4_find_root_sec,
@@ -6834,6 +6838,10 @@ static const struct nfs4_minor_version_ops nfs_v4_0_minor_ops = {
6834#if defined(CONFIG_NFS_V4_1) 6838#if defined(CONFIG_NFS_V4_1)
6835static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = { 6839static const struct nfs4_minor_version_ops nfs_v4_1_minor_ops = {
6836 .minor_version = 1, 6840 .minor_version = 1,
6841 .init_caps = NFS_CAP_READDIRPLUS
6842 | NFS_CAP_ATOMIC_OPEN
6843 | NFS_CAP_CHANGE_ATTR
6844 | NFS_CAP_POSIX_LOCK,
6837 .call_sync = nfs4_call_sync_sequence, 6845 .call_sync = nfs4_call_sync_sequence,
6838 .match_stateid = nfs41_match_stateid, 6846 .match_stateid = nfs41_match_stateid,
6839 .find_root_sec = nfs41_find_root_sec, 6847 .find_root_sec = nfs41_find_root_sec,