aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-09-29 17:48:19 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-10-09 17:19:53 -0400
commit60ccd4ec4170c9487e3792322626acd160197bce (patch)
treeb35353518bd7945a40e39edfa543ce80aaa3f8b4
parent80eb209def76d375677840800eb838abce1e6639 (diff)
NFS: Remove nfs_begin_data_update/nfs_end_data_update
The lower level routines in fs/nfs/proc.c, fs/nfs/nfs3proc.c and fs/nfs/nfs4proc.c should already be dealing with the revalidation issues. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--fs/nfs/dir.c35
-rw-r--r--fs/nfs/direct.c4
-rw-r--r--fs/nfs/inode.c19
-rw-r--r--fs/nfs/nfs3acl.c2
-rw-r--r--fs/nfs/unlink.c3
-rw-r--r--fs/nfs/write.c2
-rw-r--r--include/linux/nfs_fs.h12
7 files changed, 1 insertions, 76 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index a03ed2f85047..34da48586829 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -1001,12 +1001,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
1001 goto out; 1001 goto out;
1002 } 1002 }
1003 1003
1004 if (nd->intent.open.flags & O_CREAT) { 1004 res = nfs4_atomic_open(dir, dentry, nd);
1005 nfs_begin_data_update(dir);
1006 res = nfs4_atomic_open(dir, dentry, nd);
1007 nfs_end_data_update(dir);
1008 } else
1009 res = nfs4_atomic_open(dir, dentry, nd);
1010 unlock_kernel(); 1005 unlock_kernel();
1011 if (IS_ERR(res)) { 1006 if (IS_ERR(res)) {
1012 error = PTR_ERR(res); 1007 error = PTR_ERR(res);
@@ -1224,9 +1219,7 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode,
1224 open_flags = nd->intent.open.flags; 1219 open_flags = nd->intent.open.flags;
1225 1220
1226 lock_kernel(); 1221 lock_kernel();
1227 nfs_begin_data_update(dir);
1228 error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, nd); 1222 error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, nd);
1229 nfs_end_data_update(dir);
1230 if (error != 0) 1223 if (error != 0)
1231 goto out_err; 1224 goto out_err;
1232 unlock_kernel(); 1225 unlock_kernel();
@@ -1256,9 +1249,7 @@ nfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev)
1256 attr.ia_valid = ATTR_MODE; 1249 attr.ia_valid = ATTR_MODE;
1257 1250
1258 lock_kernel(); 1251 lock_kernel();
1259 nfs_begin_data_update(dir);
1260 status = NFS_PROTO(dir)->mknod(dir, dentry, &attr, rdev); 1252 status = NFS_PROTO(dir)->mknod(dir, dentry, &attr, rdev);
1261 nfs_end_data_update(dir);
1262 if (status != 0) 1253 if (status != 0)
1263 goto out_err; 1254 goto out_err;
1264 unlock_kernel(); 1255 unlock_kernel();
@@ -1284,9 +1275,7 @@ static int nfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1284 attr.ia_mode = mode | S_IFDIR; 1275 attr.ia_mode = mode | S_IFDIR;
1285 1276
1286 lock_kernel(); 1277 lock_kernel();
1287 nfs_begin_data_update(dir);
1288 error = NFS_PROTO(dir)->mkdir(dir, dentry, &attr); 1278 error = NFS_PROTO(dir)->mkdir(dir, dentry, &attr);
1289 nfs_end_data_update(dir);
1290 if (error != 0) 1279 if (error != 0)
1291 goto out_err; 1280 goto out_err;
1292 unlock_kernel(); 1281 unlock_kernel();
@@ -1305,12 +1294,10 @@ static int nfs_rmdir(struct inode *dir, struct dentry *dentry)
1305 dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); 1294 dir->i_sb->s_id, dir->i_ino, dentry->d_name.name);
1306 1295
1307 lock_kernel(); 1296 lock_kernel();
1308 nfs_begin_data_update(dir);
1309 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name); 1297 error = NFS_PROTO(dir)->rmdir(dir, &dentry->d_name);
1310 /* Ensure the VFS deletes this inode */ 1298 /* Ensure the VFS deletes this inode */
1311 if (error == 0 && dentry->d_inode != NULL) 1299 if (error == 0 && dentry->d_inode != NULL)
1312 clear_nlink(dentry->d_inode); 1300 clear_nlink(dentry->d_inode);
1313 nfs_end_data_update(dir);
1314 unlock_kernel(); 1301 unlock_kernel();
1315 1302
1316 return error; 1303 return error;
@@ -1368,17 +1355,13 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
1368 1355
1369 qsilly.name = silly; 1356 qsilly.name = silly;
1370 qsilly.len = strlen(silly); 1357 qsilly.len = strlen(silly);
1371 nfs_begin_data_update(dir);
1372 if (dentry->d_inode) { 1358 if (dentry->d_inode) {
1373 nfs_begin_data_update(dentry->d_inode);
1374 error = NFS_PROTO(dir)->rename(dir, &dentry->d_name, 1359 error = NFS_PROTO(dir)->rename(dir, &dentry->d_name,
1375 dir, &qsilly); 1360 dir, &qsilly);
1376 nfs_mark_for_revalidate(dentry->d_inode); 1361 nfs_mark_for_revalidate(dentry->d_inode);
1377 nfs_end_data_update(dentry->d_inode);
1378 } else 1362 } else
1379 error = NFS_PROTO(dir)->rename(dir, &dentry->d_name, 1363 error = NFS_PROTO(dir)->rename(dir, &dentry->d_name,
1380 dir, &qsilly); 1364 dir, &qsilly);
1381 nfs_end_data_update(dir);
1382 if (!error) { 1365 if (!error) {
1383 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1366 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1384 d_move(dentry, sdentry); 1367 d_move(dentry, sdentry);
@@ -1412,19 +1395,15 @@ static int nfs_safe_remove(struct dentry *dentry)
1412 goto out; 1395 goto out;
1413 } 1396 }
1414 1397
1415 nfs_begin_data_update(dir);
1416 if (inode != NULL) { 1398 if (inode != NULL) {
1417 nfs_inode_return_delegation(inode); 1399 nfs_inode_return_delegation(inode);
1418 nfs_begin_data_update(inode);
1419 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); 1400 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
1420 /* The VFS may want to delete this inode */ 1401 /* The VFS may want to delete this inode */
1421 if (error == 0) 1402 if (error == 0)
1422 drop_nlink(inode); 1403 drop_nlink(inode);
1423 nfs_mark_for_revalidate(inode); 1404 nfs_mark_for_revalidate(inode);
1424 nfs_end_data_update(inode);
1425 } else 1405 } else
1426 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name); 1406 error = NFS_PROTO(dir)->remove(dir, &dentry->d_name);
1427 nfs_end_data_update(dir);
1428out: 1407out:
1429 return error; 1408 return error;
1430} 1409}
@@ -1516,9 +1495,7 @@ static int nfs_symlink(struct inode *dir, struct dentry *dentry, const char *sym
1516 memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen); 1495 memset(kaddr + pathlen, 0, PAGE_SIZE - pathlen);
1517 kunmap_atomic(kaddr, KM_USER0); 1496 kunmap_atomic(kaddr, KM_USER0);
1518 1497
1519 nfs_begin_data_update(dir);
1520 error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr); 1498 error = NFS_PROTO(dir)->symlink(dir, dentry, page, pathlen, &attr);
1521 nfs_end_data_update(dir);
1522 if (error != 0) { 1499 if (error != 0) {
1523 dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s) error %d\n", 1500 dfprintk(VFS, "NFS: symlink(%s/%ld, %s, %s) error %d\n",
1524 dir->i_sb->s_id, dir->i_ino, 1501 dir->i_sb->s_id, dir->i_ino,
@@ -1558,15 +1535,11 @@ nfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry)
1558 dentry->d_parent->d_name.name, dentry->d_name.name); 1535 dentry->d_parent->d_name.name, dentry->d_name.name);
1559 1536
1560 lock_kernel(); 1537 lock_kernel();
1561 nfs_begin_data_update(dir);
1562 nfs_begin_data_update(inode);
1563 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name); 1538 error = NFS_PROTO(dir)->link(inode, dir, &dentry->d_name);
1564 if (error == 0) { 1539 if (error == 0) {
1565 atomic_inc(&inode->i_count); 1540 atomic_inc(&inode->i_count);
1566 d_instantiate(dentry, inode); 1541 d_instantiate(dentry, inode);
1567 } 1542 }
1568 nfs_end_data_update(inode);
1569 nfs_end_data_update(dir);
1570 unlock_kernel(); 1543 unlock_kernel();
1571 return error; 1544 return error;
1572} 1545}
@@ -1669,15 +1642,9 @@ go_ahead:
1669 d_delete(new_dentry); 1642 d_delete(new_dentry);
1670 } 1643 }
1671 1644
1672 nfs_begin_data_update(old_dir);
1673 nfs_begin_data_update(new_dir);
1674 nfs_begin_data_update(old_inode);
1675 error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name, 1645 error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name,
1676 new_dir, &new_dentry->d_name); 1646 new_dir, &new_dentry->d_name);
1677 nfs_mark_for_revalidate(old_inode); 1647 nfs_mark_for_revalidate(old_inode);
1678 nfs_end_data_update(old_inode);
1679 nfs_end_data_update(new_dir);
1680 nfs_end_data_update(old_dir);
1681out: 1648out:
1682 if (rehash) 1649 if (rehash)
1683 d_rehash(rehash); 1650 d_rehash(rehash);
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 28c8e1b65db0..32fe97211eea 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -510,7 +510,6 @@ static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode
510 nfs_direct_write_reschedule(dreq); 510 nfs_direct_write_reschedule(dreq);
511 break; 511 break;
512 default: 512 default:
513 nfs_end_data_update(inode);
514 if (dreq->commit_data != NULL) 513 if (dreq->commit_data != NULL)
515 nfs_commit_free(dreq->commit_data); 514 nfs_commit_free(dreq->commit_data);
516 nfs_direct_free_writedata(dreq); 515 nfs_direct_free_writedata(dreq);
@@ -533,7 +532,6 @@ static inline void nfs_alloc_commit_data(struct nfs_direct_req *dreq)
533 532
534static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode) 533static void nfs_direct_write_complete(struct nfs_direct_req *dreq, struct inode *inode)
535{ 534{
536 nfs_end_data_update(inode);
537 nfs_direct_free_writedata(dreq); 535 nfs_direct_free_writedata(dreq);
538 nfs_zap_mapping(inode, inode->i_mapping); 536 nfs_zap_mapping(inode, inode->i_mapping);
539 nfs_direct_complete(dreq); 537 nfs_direct_complete(dreq);
@@ -724,8 +722,6 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, unsigned long user_addr, siz
724 722
725 nfs_add_stats(inode, NFSIOS_DIRECTWRITTENBYTES, count); 723 nfs_add_stats(inode, NFSIOS_DIRECTWRITTENBYTES, count);
726 724
727 nfs_begin_data_update(inode);
728
729 rpc_clnt_sigmask(clnt, &oldset); 725 rpc_clnt_sigmask(clnt, &oldset);
730 result = nfs_direct_write_schedule(dreq, user_addr, count, pos, sync); 726 result = nfs_direct_write_schedule(dreq, user_addr, count, pos, sync);
731 if (!result) 727 if (!result)
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 1d507a2a96d6..1c23d3a67c85 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -344,7 +344,6 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
344 return 0; 344 return 0;
345 345
346 lock_kernel(); 346 lock_kernel();
347 nfs_begin_data_update(inode);
348 /* Write all dirty data */ 347 /* Write all dirty data */
349 if (S_ISREG(inode->i_mode)) { 348 if (S_ISREG(inode->i_mode)) {
350 filemap_write_and_wait(inode->i_mapping); 349 filemap_write_and_wait(inode->i_mapping);
@@ -358,7 +357,6 @@ nfs_setattr(struct dentry *dentry, struct iattr *attr)
358 error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr); 357 error = NFS_PROTO(inode)->setattr(dentry, &fattr, attr);
359 if (error == 0) 358 if (error == 0)
360 nfs_refresh_inode(inode, &fattr); 359 nfs_refresh_inode(inode, &fattr);
361 nfs_end_data_update(inode);
362 unlock_kernel(); 360 unlock_kernel();
363 return error; 361 return error;
364} 362}
@@ -755,23 +753,6 @@ out:
755 return ret; 753 return ret;
756} 754}
757 755
758/**
759 * nfs_end_data_update
760 * @inode - pointer to inode
761 * Declare end of the operations that will update file data
762 * This will mark the inode as immediately needing revalidation
763 * of its attribute cache.
764 */
765void nfs_end_data_update(struct inode *inode)
766{
767 /* Directories: invalidate page cache */
768 if (S_ISDIR(inode->i_mode)) {
769 spin_lock(&inode->i_lock);
770 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_DATA;
771 spin_unlock(&inode->i_lock);
772 }
773}
774
775static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr) 756static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
776{ 757{
777 struct nfs_inode *nfsi = NFS_I(inode); 758 struct nfs_inode *nfsi = NFS_I(inode);
diff --git a/fs/nfs/nfs3acl.c b/fs/nfs/nfs3acl.c
index 7322da4d2055..9b7362565c0c 100644
--- a/fs/nfs/nfs3acl.c
+++ b/fs/nfs/nfs3acl.c
@@ -317,13 +317,11 @@ static int nfs3_proc_setacls(struct inode *inode, struct posix_acl *acl,
317 } 317 }
318 318
319 dprintk("NFS call setacl\n"); 319 dprintk("NFS call setacl\n");
320 nfs_begin_data_update(inode);
321 msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL]; 320 msg.rpc_proc = &server->client_acl->cl_procinfo[ACLPROC3_SETACL];
322 status = rpc_call_sync(server->client_acl, &msg, 0); 321 status = rpc_call_sync(server->client_acl, &msg, 0);
323 spin_lock(&inode->i_lock); 322 spin_lock(&inode->i_lock);
324 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS; 323 NFS_I(inode)->cache_validity |= NFS_INO_INVALID_ACCESS;
325 spin_unlock(&inode->i_lock); 324 spin_unlock(&inode->i_lock);
326 nfs_end_data_update(inode);
327 dprintk("NFS reply setacl: %d\n", status); 325 dprintk("NFS reply setacl: %d\n", status);
328 326
329 /* pages may have been allocated at the xdr layer. */ 327 /* pages may have been allocated at the xdr layer. */
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 045ab805c17f..1aed850d18f2 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -66,7 +66,6 @@ static void nfs_async_unlink_init(struct rpc_task *task, void *calldata)
66 .rpc_cred = data->cred, 66 .rpc_cred = data->cred,
67 }; 67 };
68 68
69 nfs_begin_data_update(dir);
70 NFS_PROTO(dir)->unlink_setup(&msg, dir); 69 NFS_PROTO(dir)->unlink_setup(&msg, dir);
71 rpc_call_setup(task, &msg, 0); 70 rpc_call_setup(task, &msg, 0);
72} 71}
@@ -84,8 +83,6 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
84 83
85 if (!NFS_PROTO(dir)->unlink_done(task, dir)) 84 if (!NFS_PROTO(dir)->unlink_done(task, dir))
86 rpc_restart_call(task); 85 rpc_restart_call(task);
87 else
88 nfs_end_data_update(dir);
89} 86}
90 87
91/** 88/**
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 3e9e268b887e..e2bb66c34406 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -378,7 +378,6 @@ static int nfs_inode_add_request(struct inode *inode, struct nfs_page *req)
378 return error; 378 return error;
379 if (!nfsi->npages) { 379 if (!nfsi->npages) {
380 igrab(inode); 380 igrab(inode);
381 nfs_begin_data_update(inode);
382 if (nfs_have_delegation(inode, FMODE_WRITE)) 381 if (nfs_have_delegation(inode, FMODE_WRITE))
383 nfsi->change_attr++; 382 nfsi->change_attr++;
384 } 383 }
@@ -406,7 +405,6 @@ static void nfs_inode_remove_request(struct nfs_page *req)
406 nfsi->npages--; 405 nfsi->npages--;
407 if (!nfsi->npages) { 406 if (!nfsi->npages) {
408 spin_unlock(&inode->i_lock); 407 spin_unlock(&inode->i_lock);
409 nfs_end_data_update(inode);
410 iput(inode); 408 iput(inode);
411 } else 409 } else
412 spin_unlock(&inode->i_lock); 410 spin_unlock(&inode->i_lock);
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 1b4edc6f7fd7..8f632bd854af 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -219,15 +219,6 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
219 219
220#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 220#define NFS_FILEID(inode) (NFS_I(inode)->fileid)
221 221
222/**
223 * nfs_begin_data_update
224 * @inode - pointer to inode
225 * Declare that a set of operations will update file data on the server
226 */
227static inline void nfs_begin_data_update(struct inode *inode)
228{
229}
230
231static inline void nfs_mark_for_revalidate(struct inode *inode) 222static inline void nfs_mark_for_revalidate(struct inode *inode)
232{ 223{
233 struct nfs_inode *nfsi = NFS_I(inode); 224 struct nfs_inode *nfsi = NFS_I(inode);
@@ -296,9 +287,6 @@ extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *map
296extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping); 287extern int nfs_revalidate_mapping_nolock(struct inode *inode, struct address_space *mapping);
297extern int nfs_setattr(struct dentry *, struct iattr *); 288extern int nfs_setattr(struct dentry *, struct iattr *);
298extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 289extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
299extern void nfs_begin_attr_update(struct inode *);
300extern void nfs_end_attr_update(struct inode *);
301extern void nfs_end_data_update(struct inode *);
302extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 290extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
303extern void put_nfs_open_context(struct nfs_open_context *ctx); 291extern void put_nfs_open_context(struct nfs_open_context *ctx);
304extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode); 292extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, int mode);