aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c209
1 files changed, 133 insertions, 76 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6922469d6fc5..f2781ca42761 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -358,6 +358,35 @@ out_no_root:
358 return no_root_error; 358 return no_root_error;
359} 359}
360 360
361static void nfs_init_timeout_values(struct rpc_timeout *to, int proto, unsigned int timeo, unsigned int retrans)
362{
363 to->to_initval = timeo * HZ / 10;
364 to->to_retries = retrans;
365 if (!to->to_retries)
366 to->to_retries = 2;
367
368 switch (proto) {
369 case IPPROTO_TCP:
370 if (!to->to_initval)
371 to->to_initval = 60 * HZ;
372 if (to->to_initval > NFS_MAX_TCP_TIMEOUT)
373 to->to_initval = NFS_MAX_TCP_TIMEOUT;
374 to->to_increment = to->to_initval;
375 to->to_maxval = to->to_initval + (to->to_increment * to->to_retries);
376 to->to_exponential = 0;
377 break;
378 case IPPROTO_UDP:
379 default:
380 if (!to->to_initval)
381 to->to_initval = 11 * HZ / 10;
382 if (to->to_initval > NFS_MAX_UDP_TIMEOUT)
383 to->to_initval = NFS_MAX_UDP_TIMEOUT;
384 to->to_maxval = NFS_MAX_UDP_TIMEOUT;
385 to->to_exponential = 1;
386 break;
387 }
388}
389
361/* 390/*
362 * Create an RPC client handle. 391 * Create an RPC client handle.
363 */ 392 */
@@ -367,22 +396,12 @@ nfs_create_client(struct nfs_server *server, const struct nfs_mount_data *data)
367 struct rpc_timeout timeparms; 396 struct rpc_timeout timeparms;
368 struct rpc_xprt *xprt = NULL; 397 struct rpc_xprt *xprt = NULL;
369 struct rpc_clnt *clnt = NULL; 398 struct rpc_clnt *clnt = NULL;
370 int tcp = (data->flags & NFS_MOUNT_TCP); 399 int proto = (data->flags & NFS_MOUNT_TCP) ? IPPROTO_TCP : IPPROTO_UDP;
371 400
372 /* Initialize timeout values */ 401 nfs_init_timeout_values(&timeparms, proto, data->timeo, data->retrans);
373 timeparms.to_initval = data->timeo * HZ / 10;
374 timeparms.to_retries = data->retrans;
375 timeparms.to_maxval = tcp ? RPC_MAX_TCP_TIMEOUT : RPC_MAX_UDP_TIMEOUT;
376 timeparms.to_exponential = 1;
377
378 if (!timeparms.to_initval)
379 timeparms.to_initval = (tcp ? 600 : 11) * HZ / 10;
380 if (!timeparms.to_retries)
381 timeparms.to_retries = 5;
382 402
383 /* create transport and client */ 403 /* create transport and client */
384 xprt = xprt_create_proto(tcp ? IPPROTO_TCP : IPPROTO_UDP, 404 xprt = xprt_create_proto(proto, &server->addr, &timeparms);
385 &server->addr, &timeparms);
386 if (IS_ERR(xprt)) { 405 if (IS_ERR(xprt)) {
387 dprintk("%s: cannot create RPC transport. Error = %ld\n", 406 dprintk("%s: cannot create RPC transport. Error = %ld\n",
388 __FUNCTION__, PTR_ERR(xprt)); 407 __FUNCTION__, PTR_ERR(xprt));
@@ -576,7 +595,6 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
576 { NFS_MOUNT_SOFT, ",soft", ",hard" }, 595 { NFS_MOUNT_SOFT, ",soft", ",hard" },
577 { NFS_MOUNT_INTR, ",intr", "" }, 596 { NFS_MOUNT_INTR, ",intr", "" },
578 { NFS_MOUNT_POSIX, ",posix", "" }, 597 { NFS_MOUNT_POSIX, ",posix", "" },
579 { NFS_MOUNT_TCP, ",tcp", ",udp" },
580 { NFS_MOUNT_NOCTO, ",nocto", "" }, 598 { NFS_MOUNT_NOCTO, ",nocto", "" },
581 { NFS_MOUNT_NOAC, ",noac", "" }, 599 { NFS_MOUNT_NOAC, ",noac", "" },
582 { NFS_MOUNT_NONLM, ",nolock", ",lock" }, 600 { NFS_MOUNT_NONLM, ",nolock", ",lock" },
@@ -585,6 +603,8 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
585 }; 603 };
586 struct proc_nfs_info *nfs_infop; 604 struct proc_nfs_info *nfs_infop;
587 struct nfs_server *nfss = NFS_SB(mnt->mnt_sb); 605 struct nfs_server *nfss = NFS_SB(mnt->mnt_sb);
606 char buf[12];
607 char *proto;
588 608
589 seq_printf(m, ",v%d", nfss->rpc_ops->version); 609 seq_printf(m, ",v%d", nfss->rpc_ops->version);
590 seq_printf(m, ",rsize=%d", nfss->rsize); 610 seq_printf(m, ",rsize=%d", nfss->rsize);
@@ -603,6 +623,18 @@ static int nfs_show_options(struct seq_file *m, struct vfsmount *mnt)
603 else 623 else
604 seq_puts(m, nfs_infop->nostr); 624 seq_puts(m, nfs_infop->nostr);
605 } 625 }
626 switch (nfss->client->cl_xprt->prot) {
627 case IPPROTO_TCP:
628 proto = "tcp";
629 break;
630 case IPPROTO_UDP:
631 proto = "udp";
632 break;
633 default:
634 snprintf(buf, sizeof(buf), "%u", nfss->client->cl_xprt->prot);
635 proto = buf;
636 }
637 seq_printf(m, ",proto=%s", proto);
606 seq_puts(m, ",addr="); 638 seq_puts(m, ",addr=");
607 seq_escape(m, nfss->hostname, " \t\n\\"); 639 seq_escape(m, nfss->hostname, " \t\n\\");
608 return 0; 640 return 0;
@@ -753,7 +785,8 @@ nfs_fhget(struct super_block *sb, struct nfs_fh *fh, struct nfs_fattr *fattr)
753 else 785 else
754 init_special_inode(inode, inode->i_mode, fattr->rdev); 786 init_special_inode(inode, inode->i_mode, fattr->rdev);
755 787
756 nfsi->read_cache_jiffies = fattr->timestamp; 788 nfsi->read_cache_jiffies = fattr->time_start;
789 nfsi->last_updated = jiffies;
757 inode->i_atime = fattr->atime; 790 inode->i_atime = fattr->atime;
758 inode->i_mtime = fattr->mtime; 791 inode->i_mtime = fattr->mtime;
759 inode->i_ctime = fattr->ctime; 792 inode->i_ctime = fattr->ctime;
@@ -821,6 +854,11 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
821 filemap_fdatawait(inode->i_mapping); 854 filemap_fdatawait(inode->i_mapping);
822 nfs_wb_all(inode); 855 nfs_wb_all(inode);
823 } 856 }
857 /*
858 * Return any delegations if we're going to change ACLs
859 */
860 if ((attr->ia_valid & (ATTR_MODE|ATTR_UID|ATTR_GID)) != 0)
861 nfs_inode_return_delegation(inode);
824 error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr); 862 error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr);
825 if (error == 0) 863 if (error == 0)
826 nfs_refresh_inode(inode, &fattr); 864 nfs_refresh_inode(inode, &fattr);
@@ -877,12 +915,10 @@ static int nfs_wait_on_inode(struct inode *inode)
877 sigset_t oldmask; 915 sigset_t oldmask;
878 int error; 916 int error;
879 917
880 atomic_inc(&inode->i_count);
881 rpc_clnt_sigmask(clnt, &oldmask); 918 rpc_clnt_sigmask(clnt, &oldmask);
882 error = wait_on_bit_lock(&nfsi->flags, NFS_INO_REVALIDATING, 919 error = wait_on_bit_lock(&nfsi->flags, NFS_INO_REVALIDATING,
883 nfs_wait_schedule, TASK_INTERRUPTIBLE); 920 nfs_wait_schedule, TASK_INTERRUPTIBLE);
884 rpc_clnt_sigunmask(clnt, &oldmask); 921 rpc_clnt_sigunmask(clnt, &oldmask);
885 iput(inode);
886 922
887 return error; 923 return error;
888} 924}
@@ -1021,15 +1057,11 @@ int nfs_open(struct inode *inode, struct file *filp)
1021 ctx->mode = filp->f_mode; 1057 ctx->mode = filp->f_mode;
1022 nfs_file_set_open_context(filp, ctx); 1058 nfs_file_set_open_context(filp, ctx);
1023 put_nfs_open_context(ctx); 1059 put_nfs_open_context(ctx);
1024 if ((filp->f_mode & FMODE_WRITE) != 0)
1025 nfs_begin_data_update(inode);
1026 return 0; 1060 return 0;
1027} 1061}
1028 1062
1029int nfs_release(struct inode *inode, struct file *filp) 1063int nfs_release(struct inode *inode, struct file *filp)
1030{ 1064{
1031 if ((filp->f_mode & FMODE_WRITE) != 0)
1032 nfs_end_data_update(inode);
1033 nfs_file_clear_open_context(filp); 1065 nfs_file_clear_open_context(filp);
1034 return 0; 1066 return 0;
1035} 1067}
@@ -1085,14 +1117,15 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
1085 goto out; 1117 goto out;
1086 } 1118 }
1087 1119
1120 spin_lock(&inode->i_lock);
1088 status = nfs_update_inode(inode, &fattr, verifier); 1121 status = nfs_update_inode(inode, &fattr, verifier);
1089 if (status) { 1122 if (status) {
1123 spin_unlock(&inode->i_lock);
1090 dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Ld) refresh failed, error=%d\n", 1124 dfprintk(PAGECACHE, "nfs_revalidate_inode: (%s/%Ld) refresh failed, error=%d\n",
1091 inode->i_sb->s_id, 1125 inode->i_sb->s_id,
1092 (long long)NFS_FILEID(inode), status); 1126 (long long)NFS_FILEID(inode), status);
1093 goto out; 1127 goto out;
1094 } 1128 }
1095 spin_lock(&inode->i_lock);
1096 cache_validity = nfsi->cache_validity; 1129 cache_validity = nfsi->cache_validity;
1097 nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE; 1130 nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE;
1098 1131
@@ -1100,7 +1133,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode)
1100 * We may need to keep the attributes marked as invalid if 1133 * We may need to keep the attributes marked as invalid if
1101 * we raced with nfs_end_attr_update(). 1134 * we raced with nfs_end_attr_update().
1102 */ 1135 */
1103 if (verifier == nfsi->cache_change_attribute) 1136 if (time_after_eq(verifier, nfsi->cache_change_attribute))
1104 nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME); 1137 nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME);
1105 spin_unlock(&inode->i_lock); 1138 spin_unlock(&inode->i_lock);
1106 1139
@@ -1167,7 +1200,7 @@ void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping)
1167 if (S_ISDIR(inode->i_mode)) { 1200 if (S_ISDIR(inode->i_mode)) {
1168 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); 1201 memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf));
1169 /* This ensures we revalidate child dentries */ 1202 /* This ensures we revalidate child dentries */
1170 nfsi->cache_change_attribute++; 1203 nfsi->cache_change_attribute = jiffies;
1171 } 1204 }
1172 spin_unlock(&inode->i_lock); 1205 spin_unlock(&inode->i_lock);
1173 1206
@@ -1199,20 +1232,19 @@ void nfs_end_data_update(struct inode *inode)
1199 struct nfs_inode *nfsi = NFS_I(inode); 1232 struct nfs_inode *nfsi = NFS_I(inode);
1200 1233
1201 if (!nfs_have_delegation(inode, FMODE_READ)) { 1234 if (!nfs_have_delegation(inode, FMODE_READ)) {
1202 /* Mark the attribute cache for revalidation */ 1235 /* Directories and symlinks: invalidate page cache */
1203 spin_lock(&inode->i_lock); 1236 if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) {
1204 nfsi->cache_validity |= NFS_INO_INVALID_ATTR; 1237 spin_lock(&inode->i_lock);
1205 /* Directories and symlinks: invalidate page cache too */
1206 if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode))
1207 nfsi->cache_validity |= NFS_INO_INVALID_DATA; 1238 nfsi->cache_validity |= NFS_INO_INVALID_DATA;
1208 spin_unlock(&inode->i_lock); 1239 spin_unlock(&inode->i_lock);
1240 }
1209 } 1241 }
1210 nfsi->cache_change_attribute ++; 1242 nfsi->cache_change_attribute = jiffies;
1211 atomic_dec(&nfsi->data_updates); 1243 atomic_dec(&nfsi->data_updates);
1212} 1244}
1213 1245
1214/** 1246/**
1215 * nfs_refresh_inode - verify consistency of the inode attribute cache 1247 * nfs_check_inode_attributes - verify consistency of the inode attribute cache
1216 * @inode - pointer to inode 1248 * @inode - pointer to inode
1217 * @fattr - updated attributes 1249 * @fattr - updated attributes
1218 * 1250 *
@@ -1220,17 +1252,12 @@ void nfs_end_data_update(struct inode *inode)
1220 * so that fattr carries weak cache consistency data, then it may 1252 * so that fattr carries weak cache consistency data, then it may
1221 * also update the ctime/mtime/change_attribute. 1253 * also update the ctime/mtime/change_attribute.
1222 */ 1254 */
1223int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) 1255static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fattr)
1224{ 1256{
1225 struct nfs_inode *nfsi = NFS_I(inode); 1257 struct nfs_inode *nfsi = NFS_I(inode);
1226 loff_t cur_size, new_isize; 1258 loff_t cur_size, new_isize;
1227 int data_unstable; 1259 int data_unstable;
1228 1260
1229 /* Do we hold a delegation? */
1230 if (nfs_have_delegation(inode, FMODE_READ))
1231 return 0;
1232
1233 spin_lock(&inode->i_lock);
1234 1261
1235 /* Are we in the process of updating data on the server? */ 1262 /* Are we in the process of updating data on the server? */
1236 data_unstable = nfs_caches_unstable(inode); 1263 data_unstable = nfs_caches_unstable(inode);
@@ -1294,11 +1321,67 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
1294 if (!timespec_equal(&inode->i_atime, &fattr->atime)) 1321 if (!timespec_equal(&inode->i_atime, &fattr->atime))
1295 nfsi->cache_validity |= NFS_INO_INVALID_ATIME; 1322 nfsi->cache_validity |= NFS_INO_INVALID_ATIME;
1296 1323
1297 nfsi->read_cache_jiffies = fattr->timestamp; 1324 nfsi->read_cache_jiffies = fattr->time_start;
1298 spin_unlock(&inode->i_lock);
1299 return 0; 1325 return 0;
1300} 1326}
1301 1327
1328/**
1329 * nfs_refresh_inode - try to update the inode attribute cache
1330 * @inode - pointer to inode
1331 * @fattr - updated attributes
1332 *
1333 * Check that an RPC call that returned attributes has not overlapped with
1334 * other recent updates of the inode metadata, then decide whether it is
1335 * safe to do a full update of the inode attributes, or whether just to
1336 * call nfs_check_inode_attributes.
1337 */
1338int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr)
1339{
1340 struct nfs_inode *nfsi = NFS_I(inode);
1341 int status;
1342
1343 if ((fattr->valid & NFS_ATTR_FATTR) == 0)
1344 return 0;
1345 spin_lock(&inode->i_lock);
1346 nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE;
1347 if (nfs_verify_change_attribute(inode, fattr->time_start))
1348 nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME);
1349 if (time_after(fattr->time_start, nfsi->last_updated))
1350 status = nfs_update_inode(inode, fattr, fattr->time_start);
1351 else
1352 status = nfs_check_inode_attributes(inode, fattr);
1353
1354 spin_unlock(&inode->i_lock);
1355 return status;
1356}
1357
1358/**
1359 * nfs_post_op_update_inode - try to update the inode attribute cache
1360 * @inode - pointer to inode
1361 * @fattr - updated attributes
1362 *
1363 * After an operation that has changed the inode metadata, mark the
1364 * attribute cache as being invalid, then try to update it.
1365 */
1366int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr)
1367{
1368 struct nfs_inode *nfsi = NFS_I(inode);
1369 int status = 0;
1370
1371 spin_lock(&inode->i_lock);
1372 if (unlikely((fattr->valid & NFS_ATTR_FATTR) == 0)) {
1373 nfsi->cache_validity |= NFS_INO_INVALID_ATTR | NFS_INO_INVALID_ACCESS;
1374 goto out;
1375 }
1376 status = nfs_update_inode(inode, fattr, fattr->time_start);
1377 if (time_after_eq(fattr->time_start, nfsi->cache_change_attribute))
1378 nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME|NFS_INO_REVAL_PAGECACHE);
1379 nfsi->cache_change_attribute = jiffies;
1380out:
1381 spin_unlock(&inode->i_lock);
1382 return status;
1383}
1384
1302/* 1385/*
1303 * Many nfs protocol calls return the new file attributes after 1386 * Many nfs protocol calls return the new file attributes after
1304 * an operation. Here we update the inode to reflect the state 1387 * an operation. Here we update the inode to reflect the state
@@ -1334,23 +1417,21 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign
1334 goto out_err; 1417 goto out_err;
1335 } 1418 }
1336 1419
1337 spin_lock(&inode->i_lock);
1338
1339 /* 1420 /*
1340 * Make sure the inode's type hasn't changed. 1421 * Make sure the inode's type hasn't changed.
1341 */ 1422 */
1342 if ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) { 1423 if ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT))
1343 spin_unlock(&inode->i_lock);
1344 goto out_changed; 1424 goto out_changed;
1345 }
1346 1425
1347 /* 1426 /*
1348 * Update the read time so we don't revalidate too often. 1427 * Update the read time so we don't revalidate too often.
1349 */ 1428 */
1350 nfsi->read_cache_jiffies = fattr->timestamp; 1429 nfsi->read_cache_jiffies = fattr->time_start;
1430 nfsi->last_updated = jiffies;
1351 1431
1352 /* Are we racing with known updates of the metadata on the server? */ 1432 /* Are we racing with known updates of the metadata on the server? */
1353 data_unstable = ! nfs_verify_change_attribute(inode, verifier); 1433 data_unstable = ! (nfs_verify_change_attribute(inode, verifier) ||
1434 (nfsi->cache_validity & NFS_INO_REVAL_PAGECACHE));
1354 1435
1355 /* Check if our cached file size is stale */ 1436 /* Check if our cached file size is stale */
1356 new_isize = nfs_size_to_loff_t(fattr->size); 1437 new_isize = nfs_size_to_loff_t(fattr->size);
@@ -1359,7 +1440,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign
1359 /* Do we perhaps have any outstanding writes? */ 1440 /* Do we perhaps have any outstanding writes? */
1360 if (nfsi->npages == 0) { 1441 if (nfsi->npages == 0) {
1361 /* No, but did we race with nfs_end_data_update()? */ 1442 /* No, but did we race with nfs_end_data_update()? */
1362 if (verifier == nfsi->cache_change_attribute) { 1443 if (time_after_eq(verifier, nfsi->cache_change_attribute)) {
1363 inode->i_size = new_isize; 1444 inode->i_size = new_isize;
1364 invalid |= NFS_INO_INVALID_DATA; 1445 invalid |= NFS_INO_INVALID_DATA;
1365 } 1446 }
@@ -1435,7 +1516,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign
1435 if (!nfs_have_delegation(inode, FMODE_READ)) 1516 if (!nfs_have_delegation(inode, FMODE_READ))
1436 nfsi->cache_validity |= invalid; 1517 nfsi->cache_validity |= invalid;
1437 1518
1438 spin_unlock(&inode->i_lock);
1439 return 0; 1519 return 0;
1440 out_changed: 1520 out_changed:
1441 /* 1521 /*
@@ -1644,8 +1724,7 @@ static void nfs4_clear_inode(struct inode *inode)
1644 struct nfs_inode *nfsi = NFS_I(inode); 1724 struct nfs_inode *nfsi = NFS_I(inode);
1645 1725
1646 /* If we are holding a delegation, return it! */ 1726 /* If we are holding a delegation, return it! */
1647 if (nfsi->delegation != NULL) 1727 nfs_inode_return_delegation(inode);
1648 nfs_inode_return_delegation(inode);
1649 /* First call standard NFS clear_inode() code */ 1728 /* First call standard NFS clear_inode() code */
1650 nfs_clear_inode(inode); 1729 nfs_clear_inode(inode);
1651 /* Now clear out any remaining state */ 1730 /* Now clear out any remaining state */
@@ -1674,7 +1753,7 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data,
1674 struct rpc_clnt *clnt = NULL; 1753 struct rpc_clnt *clnt = NULL;
1675 struct rpc_timeout timeparms; 1754 struct rpc_timeout timeparms;
1676 rpc_authflavor_t authflavour; 1755 rpc_authflavor_t authflavour;
1677 int proto, err = -EIO; 1756 int err = -EIO;
1678 1757
1679 sb->s_blocksize_bits = 0; 1758 sb->s_blocksize_bits = 0;
1680 sb->s_blocksize = 0; 1759 sb->s_blocksize = 0;
@@ -1692,30 +1771,8 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data,
1692 server->acdirmax = data->acdirmax*HZ; 1771 server->acdirmax = data->acdirmax*HZ;
1693 1772
1694 server->rpc_ops = &nfs_v4_clientops; 1773 server->rpc_ops = &nfs_v4_clientops;
1695 /* Initialize timeout values */
1696
1697 timeparms.to_initval = data->timeo * HZ / 10;
1698 timeparms.to_retries = data->retrans;
1699 timeparms.to_exponential = 1;
1700 if (!timeparms.to_retries)
1701 timeparms.to_retries = 5;
1702 1774
1703 proto = data->proto; 1775 nfs_init_timeout_values(&timeparms, data->proto, data->timeo, data->retrans);
1704 /* Which IP protocol do we use? */
1705 switch (proto) {
1706 case IPPROTO_TCP:
1707 timeparms.to_maxval = RPC_MAX_TCP_TIMEOUT;
1708 if (!timeparms.to_initval)
1709 timeparms.to_initval = 600 * HZ / 10;
1710 break;
1711 case IPPROTO_UDP:
1712 timeparms.to_maxval = RPC_MAX_UDP_TIMEOUT;
1713 if (!timeparms.to_initval)
1714 timeparms.to_initval = 11 * HZ / 10;
1715 break;
1716 default:
1717 return -EINVAL;
1718 }
1719 1776
1720 clp = nfs4_get_client(&server->addr.sin_addr); 1777 clp = nfs4_get_client(&server->addr.sin_addr);
1721 if (!clp) { 1778 if (!clp) {
@@ -1740,7 +1797,7 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data,
1740 1797
1741 down_write(&clp->cl_sem); 1798 down_write(&clp->cl_sem);
1742 if (IS_ERR(clp->cl_rpcclient)) { 1799 if (IS_ERR(clp->cl_rpcclient)) {
1743 xprt = xprt_create_proto(proto, &server->addr, &timeparms); 1800 xprt = xprt_create_proto(data->proto, &server->addr, &timeparms);
1744 if (IS_ERR(xprt)) { 1801 if (IS_ERR(xprt)) {
1745 up_write(&clp->cl_sem); 1802 up_write(&clp->cl_sem);
1746 err = PTR_ERR(xprt); 1803 err = PTR_ERR(xprt);