diff options
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index a49f9feff776..a204484072f3 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -588,16 +588,6 @@ static int nfs_init_server(struct nfs_server *server, const struct nfs_mount_dat | |||
588 | server->namelen = data->namlen; | 588 | server->namelen = data->namlen; |
589 | /* Create a client RPC handle for the NFSv3 ACL management interface */ | 589 | /* Create a client RPC handle for the NFSv3 ACL management interface */ |
590 | nfs_init_server_aclclient(server); | 590 | nfs_init_server_aclclient(server); |
591 | if (clp->cl_nfsversion == 3) { | ||
592 | if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN) | ||
593 | server->namelen = NFS3_MAXNAMLEN; | ||
594 | if (!(data->flags & NFS_MOUNT_NORDIRPLUS)) | ||
595 | server->caps |= NFS_CAP_READDIRPLUS; | ||
596 | } else { | ||
597 | if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN) | ||
598 | server->namelen = NFS2_MAXNAMLEN; | ||
599 | } | ||
600 | |||
601 | dprintk("<-- nfs_init_server() = 0 [new %p]\n", clp); | 591 | dprintk("<-- nfs_init_server() = 0 [new %p]\n", clp); |
602 | return 0; | 592 | return 0; |
603 | 593 | ||
@@ -794,6 +784,16 @@ struct nfs_server *nfs_create_server(const struct nfs_mount_data *data, | |||
794 | error = nfs_probe_fsinfo(server, mntfh, &fattr); | 784 | error = nfs_probe_fsinfo(server, mntfh, &fattr); |
795 | if (error < 0) | 785 | if (error < 0) |
796 | goto error; | 786 | goto error; |
787 | if (server->nfs_client->rpc_ops->version == 3) { | ||
788 | if (server->namelen == 0 || server->namelen > NFS3_MAXNAMLEN) | ||
789 | server->namelen = NFS3_MAXNAMLEN; | ||
790 | if (!(data->flags & NFS_MOUNT_NORDIRPLUS)) | ||
791 | server->caps |= NFS_CAP_READDIRPLUS; | ||
792 | } else { | ||
793 | if (server->namelen == 0 || server->namelen > NFS2_MAXNAMLEN) | ||
794 | server->namelen = NFS2_MAXNAMLEN; | ||
795 | } | ||
796 | |||
797 | if (!(fattr.valid & NFS_ATTR_FATTR)) { | 797 | if (!(fattr.valid & NFS_ATTR_FATTR)) { |
798 | error = server->nfs_client->rpc_ops->getattr(server, mntfh, &fattr); | 798 | error = server->nfs_client->rpc_ops->getattr(server, mntfh, &fattr); |
799 | if (error < 0) { | 799 | if (error < 0) { |
@@ -984,6 +984,9 @@ struct nfs_server *nfs4_create_server(const struct nfs4_mount_data *data, | |||
984 | if (error < 0) | 984 | if (error < 0) |
985 | goto error; | 985 | goto error; |
986 | 986 | ||
987 | if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN) | ||
988 | server->namelen = NFS4_MAXNAMLEN; | ||
989 | |||
987 | BUG_ON(!server->nfs_client); | 990 | BUG_ON(!server->nfs_client); |
988 | BUG_ON(!server->nfs_client->rpc_ops); | 991 | BUG_ON(!server->nfs_client->rpc_ops); |
989 | BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); | 992 | BUG_ON(!server->nfs_client->rpc_ops->file_inode_ops); |
@@ -1056,6 +1059,9 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data, | |||
1056 | if (error < 0) | 1059 | if (error < 0) |
1057 | goto error; | 1060 | goto error; |
1058 | 1061 | ||
1062 | if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN) | ||
1063 | server->namelen = NFS4_MAXNAMLEN; | ||
1064 | |||
1059 | dprintk("Referral FSID: %llx:%llx\n", | 1065 | dprintk("Referral FSID: %llx:%llx\n", |
1060 | (unsigned long long) server->fsid.major, | 1066 | (unsigned long long) server->fsid.major, |
1061 | (unsigned long long) server->fsid.minor); | 1067 | (unsigned long long) server->fsid.minor); |
@@ -1115,6 +1121,9 @@ struct nfs_server *nfs_clone_server(struct nfs_server *source, | |||
1115 | if (error < 0) | 1121 | if (error < 0) |
1116 | goto out_free_server; | 1122 | goto out_free_server; |
1117 | 1123 | ||
1124 | if (server->namelen == 0 || server->namelen > NFS4_MAXNAMLEN) | ||
1125 | server->namelen = NFS4_MAXNAMLEN; | ||
1126 | |||
1118 | dprintk("Cloned FSID: %llx:%llx\n", | 1127 | dprintk("Cloned FSID: %llx:%llx\n", |
1119 | (unsigned long long) server->fsid.major, | 1128 | (unsigned long long) server->fsid.major, |
1120 | (unsigned long long) server->fsid.minor); | 1129 | (unsigned long long) server->fsid.minor); |