diff options
Diffstat (limited to 'fs/nfs/inode.c')
| -rw-r--r-- | fs/nfs/inode.c | 200 |
1 files changed, 131 insertions, 69 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index d4eadeea128e..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 | ||
| 361 | static 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 | |||
| 372 | /* Initialize timeout values */ | ||
| 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 | 400 | ||
| 378 | if (!timeparms.to_initval) | 401 | nfs_init_timeout_values(&timeparms, proto, data->timeo, data->retrans); |
| 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); |
| @@ -1019,15 +1057,11 @@ int nfs_open(struct inode *inode, struct file *filp) | |||
| 1019 | ctx->mode = filp->f_mode; | 1057 | ctx->mode = filp->f_mode; |
| 1020 | nfs_file_set_open_context(filp, ctx); | 1058 | nfs_file_set_open_context(filp, ctx); |
| 1021 | put_nfs_open_context(ctx); | 1059 | put_nfs_open_context(ctx); |
| 1022 | if ((filp->f_mode & FMODE_WRITE) != 0) | ||
| 1023 | nfs_begin_data_update(inode); | ||
| 1024 | return 0; | 1060 | return 0; |
| 1025 | } | 1061 | } |
| 1026 | 1062 | ||
| 1027 | int nfs_release(struct inode *inode, struct file *filp) | 1063 | int nfs_release(struct inode *inode, struct file *filp) |
| 1028 | { | 1064 | { |
| 1029 | if ((filp->f_mode & FMODE_WRITE) != 0) | ||
| 1030 | nfs_end_data_update(inode); | ||
| 1031 | nfs_file_clear_open_context(filp); | 1065 | nfs_file_clear_open_context(filp); |
| 1032 | return 0; | 1066 | return 0; |
| 1033 | } | 1067 | } |
| @@ -1083,14 +1117,15 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
| 1083 | goto out; | 1117 | goto out; |
| 1084 | } | 1118 | } |
| 1085 | 1119 | ||
| 1120 | spin_lock(&inode->i_lock); | ||
| 1086 | status = nfs_update_inode(inode, &fattr, verifier); | 1121 | status = nfs_update_inode(inode, &fattr, verifier); |
| 1087 | if (status) { | 1122 | if (status) { |
| 1123 | spin_unlock(&inode->i_lock); | ||
| 1088 | 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", |
| 1089 | inode->i_sb->s_id, | 1125 | inode->i_sb->s_id, |
| 1090 | (long long)NFS_FILEID(inode), status); | 1126 | (long long)NFS_FILEID(inode), status); |
| 1091 | goto out; | 1127 | goto out; |
| 1092 | } | 1128 | } |
| 1093 | spin_lock(&inode->i_lock); | ||
| 1094 | cache_validity = nfsi->cache_validity; | 1129 | cache_validity = nfsi->cache_validity; |
| 1095 | nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE; | 1130 | nfsi->cache_validity &= ~NFS_INO_REVAL_PAGECACHE; |
| 1096 | 1131 | ||
| @@ -1098,7 +1133,7 @@ __nfs_revalidate_inode(struct nfs_server *server, struct inode *inode) | |||
| 1098 | * We may need to keep the attributes marked as invalid if | 1133 | * We may need to keep the attributes marked as invalid if |
| 1099 | * we raced with nfs_end_attr_update(). | 1134 | * we raced with nfs_end_attr_update(). |
| 1100 | */ | 1135 | */ |
| 1101 | if (verifier == nfsi->cache_change_attribute) | 1136 | if (time_after_eq(verifier, nfsi->cache_change_attribute)) |
| 1102 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME); | 1137 | nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR|NFS_INO_INVALID_ATIME); |
| 1103 | spin_unlock(&inode->i_lock); | 1138 | spin_unlock(&inode->i_lock); |
| 1104 | 1139 | ||
| @@ -1165,7 +1200,7 @@ void nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping) | |||
| 1165 | if (S_ISDIR(inode->i_mode)) { | 1200 | if (S_ISDIR(inode->i_mode)) { |
| 1166 | memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); | 1201 | memset(nfsi->cookieverf, 0, sizeof(nfsi->cookieverf)); |
| 1167 | /* This ensures we revalidate child dentries */ | 1202 | /* This ensures we revalidate child dentries */ |
| 1168 | nfsi->cache_change_attribute++; | 1203 | nfsi->cache_change_attribute = jiffies; |
| 1169 | } | 1204 | } |
| 1170 | spin_unlock(&inode->i_lock); | 1205 | spin_unlock(&inode->i_lock); |
| 1171 | 1206 | ||
| @@ -1197,20 +1232,19 @@ void nfs_end_data_update(struct inode *inode) | |||
| 1197 | struct nfs_inode *nfsi = NFS_I(inode); | 1232 | struct nfs_inode *nfsi = NFS_I(inode); |
| 1198 | 1233 | ||
| 1199 | if (!nfs_have_delegation(inode, FMODE_READ)) { | 1234 | if (!nfs_have_delegation(inode, FMODE_READ)) { |
| 1200 | /* Mark the attribute cache for revalidation */ | 1235 | /* Directories and symlinks: invalidate page cache */ |
| 1201 | spin_lock(&inode->i_lock); | 1236 | if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) { |
| 1202 | nfsi->cache_validity |= NFS_INO_INVALID_ATTR; | 1237 | spin_lock(&inode->i_lock); |
| 1203 | /* Directories and symlinks: invalidate page cache too */ | ||
| 1204 | if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) | ||
| 1205 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; | 1238 | nfsi->cache_validity |= NFS_INO_INVALID_DATA; |
| 1206 | spin_unlock(&inode->i_lock); | 1239 | spin_unlock(&inode->i_lock); |
| 1240 | } | ||
| 1207 | } | 1241 | } |
| 1208 | nfsi->cache_change_attribute ++; | 1242 | nfsi->cache_change_attribute = jiffies; |
| 1209 | atomic_dec(&nfsi->data_updates); | 1243 | atomic_dec(&nfsi->data_updates); |
| 1210 | } | 1244 | } |
| 1211 | 1245 | ||
| 1212 | /** | 1246 | /** |
| 1213 | * nfs_refresh_inode - verify consistency of the inode attribute cache | 1247 | * nfs_check_inode_attributes - verify consistency of the inode attribute cache |
| 1214 | * @inode - pointer to inode | 1248 | * @inode - pointer to inode |
| 1215 | * @fattr - updated attributes | 1249 | * @fattr - updated attributes |
| 1216 | * | 1250 | * |
| @@ -1218,13 +1252,12 @@ void nfs_end_data_update(struct inode *inode) | |||
| 1218 | * so that fattr carries weak cache consistency data, then it may | 1252 | * so that fattr carries weak cache consistency data, then it may |
| 1219 | * also update the ctime/mtime/change_attribute. | 1253 | * also update the ctime/mtime/change_attribute. |
| 1220 | */ | 1254 | */ |
| 1221 | int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) | 1255 | static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fattr) |
| 1222 | { | 1256 | { |
| 1223 | struct nfs_inode *nfsi = NFS_I(inode); | 1257 | struct nfs_inode *nfsi = NFS_I(inode); |
| 1224 | loff_t cur_size, new_isize; | 1258 | loff_t cur_size, new_isize; |
| 1225 | int data_unstable; | 1259 | int data_unstable; |
| 1226 | 1260 | ||
| 1227 | spin_lock(&inode->i_lock); | ||
| 1228 | 1261 | ||
| 1229 | /* Are we in the process of updating data on the server? */ | 1262 | /* Are we in the process of updating data on the server? */ |
| 1230 | data_unstable = nfs_caches_unstable(inode); | 1263 | data_unstable = nfs_caches_unstable(inode); |
| @@ -1288,11 +1321,67 @@ int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) | |||
| 1288 | if (!timespec_equal(&inode->i_atime, &fattr->atime)) | 1321 | if (!timespec_equal(&inode->i_atime, &fattr->atime)) |
| 1289 | nfsi->cache_validity |= NFS_INO_INVALID_ATIME; | 1322 | nfsi->cache_validity |= NFS_INO_INVALID_ATIME; |
| 1290 | 1323 | ||
| 1291 | nfsi->read_cache_jiffies = fattr->timestamp; | 1324 | nfsi->read_cache_jiffies = fattr->time_start; |
| 1292 | spin_unlock(&inode->i_lock); | ||
| 1293 | return 0; | 1325 | return 0; |
| 1294 | } | 1326 | } |
| 1295 | 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 | */ | ||
| 1338 | int 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 | */ | ||
| 1366 | int 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; | ||
| 1380 | out: | ||
| 1381 | spin_unlock(&inode->i_lock); | ||
| 1382 | return status; | ||
| 1383 | } | ||
| 1384 | |||
| 1296 | /* | 1385 | /* |
| 1297 | * Many nfs protocol calls return the new file attributes after | 1386 | * Many nfs protocol calls return the new file attributes after |
| 1298 | * an operation. Here we update the inode to reflect the state | 1387 | * an operation. Here we update the inode to reflect the state |
| @@ -1328,20 +1417,17 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign | |||
| 1328 | goto out_err; | 1417 | goto out_err; |
| 1329 | } | 1418 | } |
| 1330 | 1419 | ||
| 1331 | spin_lock(&inode->i_lock); | ||
| 1332 | |||
| 1333 | /* | 1420 | /* |
| 1334 | * Make sure the inode's type hasn't changed. | 1421 | * Make sure the inode's type hasn't changed. |
| 1335 | */ | 1422 | */ |
| 1336 | if ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) { | 1423 | if ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT)) |
| 1337 | spin_unlock(&inode->i_lock); | ||
| 1338 | goto out_changed; | 1424 | goto out_changed; |
| 1339 | } | ||
| 1340 | 1425 | ||
| 1341 | /* | 1426 | /* |
| 1342 | * Update the read time so we don't revalidate too often. | 1427 | * Update the read time so we don't revalidate too often. |
| 1343 | */ | 1428 | */ |
| 1344 | nfsi->read_cache_jiffies = fattr->timestamp; | 1429 | nfsi->read_cache_jiffies = fattr->time_start; |
| 1430 | nfsi->last_updated = jiffies; | ||
| 1345 | 1431 | ||
| 1346 | /* 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? */ |
| 1347 | data_unstable = ! (nfs_verify_change_attribute(inode, verifier) || | 1433 | data_unstable = ! (nfs_verify_change_attribute(inode, verifier) || |
| @@ -1354,7 +1440,7 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign | |||
| 1354 | /* Do we perhaps have any outstanding writes? */ | 1440 | /* Do we perhaps have any outstanding writes? */ |
| 1355 | if (nfsi->npages == 0) { | 1441 | if (nfsi->npages == 0) { |
| 1356 | /* No, but did we race with nfs_end_data_update()? */ | 1442 | /* No, but did we race with nfs_end_data_update()? */ |
| 1357 | if (verifier == nfsi->cache_change_attribute) { | 1443 | if (time_after_eq(verifier, nfsi->cache_change_attribute)) { |
| 1358 | inode->i_size = new_isize; | 1444 | inode->i_size = new_isize; |
| 1359 | invalid |= NFS_INO_INVALID_DATA; | 1445 | invalid |= NFS_INO_INVALID_DATA; |
| 1360 | } | 1446 | } |
| @@ -1430,7 +1516,6 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr, unsign | |||
| 1430 | if (!nfs_have_delegation(inode, FMODE_READ)) | 1516 | if (!nfs_have_delegation(inode, FMODE_READ)) |
| 1431 | nfsi->cache_validity |= invalid; | 1517 | nfsi->cache_validity |= invalid; |
| 1432 | 1518 | ||
| 1433 | spin_unlock(&inode->i_lock); | ||
| 1434 | return 0; | 1519 | return 0; |
| 1435 | out_changed: | 1520 | out_changed: |
| 1436 | /* | 1521 | /* |
| @@ -1639,8 +1724,7 @@ static void nfs4_clear_inode(struct inode *inode) | |||
| 1639 | struct nfs_inode *nfsi = NFS_I(inode); | 1724 | struct nfs_inode *nfsi = NFS_I(inode); |
| 1640 | 1725 | ||
| 1641 | /* If we are holding a delegation, return it! */ | 1726 | /* If we are holding a delegation, return it! */ |
| 1642 | if (nfsi->delegation != NULL) | 1727 | nfs_inode_return_delegation(inode); |
| 1643 | nfs_inode_return_delegation(inode); | ||
| 1644 | /* First call standard NFS clear_inode() code */ | 1728 | /* First call standard NFS clear_inode() code */ |
| 1645 | nfs_clear_inode(inode); | 1729 | nfs_clear_inode(inode); |
| 1646 | /* Now clear out any remaining state */ | 1730 | /* Now clear out any remaining state */ |
| @@ -1669,7 +1753,7 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data, | |||
| 1669 | struct rpc_clnt *clnt = NULL; | 1753 | struct rpc_clnt *clnt = NULL; |
| 1670 | struct rpc_timeout timeparms; | 1754 | struct rpc_timeout timeparms; |
| 1671 | rpc_authflavor_t authflavour; | 1755 | rpc_authflavor_t authflavour; |
| 1672 | int proto, err = -EIO; | 1756 | int err = -EIO; |
| 1673 | 1757 | ||
| 1674 | sb->s_blocksize_bits = 0; | 1758 | sb->s_blocksize_bits = 0; |
| 1675 | sb->s_blocksize = 0; | 1759 | sb->s_blocksize = 0; |
| @@ -1687,30 +1771,8 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data, | |||
| 1687 | server->acdirmax = data->acdirmax*HZ; | 1771 | server->acdirmax = data->acdirmax*HZ; |
| 1688 | 1772 | ||
| 1689 | server->rpc_ops = &nfs_v4_clientops; | 1773 | server->rpc_ops = &nfs_v4_clientops; |
| 1690 | /* Initialize timeout values */ | ||
| 1691 | |||
| 1692 | timeparms.to_initval = data->timeo * HZ / 10; | ||
| 1693 | timeparms.to_retries = data->retrans; | ||
| 1694 | timeparms.to_exponential = 1; | ||
| 1695 | if (!timeparms.to_retries) | ||
| 1696 | timeparms.to_retries = 5; | ||
| 1697 | 1774 | ||
| 1698 | proto = data->proto; | 1775 | nfs_init_timeout_values(&timeparms, data->proto, data->timeo, data->retrans); |
| 1699 | /* Which IP protocol do we use? */ | ||
| 1700 | switch (proto) { | ||
| 1701 | case IPPROTO_TCP: | ||
| 1702 | timeparms.to_maxval = RPC_MAX_TCP_TIMEOUT; | ||
| 1703 | if (!timeparms.to_initval) | ||
| 1704 | timeparms.to_initval = 600 * HZ / 10; | ||
| 1705 | break; | ||
| 1706 | case IPPROTO_UDP: | ||
| 1707 | timeparms.to_maxval = RPC_MAX_UDP_TIMEOUT; | ||
| 1708 | if (!timeparms.to_initval) | ||
| 1709 | timeparms.to_initval = 11 * HZ / 10; | ||
| 1710 | break; | ||
| 1711 | default: | ||
| 1712 | return -EINVAL; | ||
| 1713 | } | ||
| 1714 | 1776 | ||
| 1715 | clp = nfs4_get_client(&server->addr.sin_addr); | 1777 | clp = nfs4_get_client(&server->addr.sin_addr); |
| 1716 | if (!clp) { | 1778 | if (!clp) { |
| @@ -1735,7 +1797,7 @@ static int nfs4_fill_super(struct super_block *sb, struct nfs4_mount_data *data, | |||
| 1735 | 1797 | ||
| 1736 | down_write(&clp->cl_sem); | 1798 | down_write(&clp->cl_sem); |
| 1737 | if (IS_ERR(clp->cl_rpcclient)) { | 1799 | if (IS_ERR(clp->cl_rpcclient)) { |
| 1738 | xprt = xprt_create_proto(proto, &server->addr, &timeparms); | 1800 | xprt = xprt_create_proto(data->proto, &server->addr, &timeparms); |
| 1739 | if (IS_ERR(xprt)) { | 1801 | if (IS_ERR(xprt)) { |
| 1740 | up_write(&clp->cl_sem); | 1802 | up_write(&clp->cl_sem); |
| 1741 | err = PTR_ERR(xprt); | 1803 | err = PTR_ERR(xprt); |
