aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p
diff options
context:
space:
mode:
authorAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>2011-02-28 06:34:08 -0500
committerEric Van Hensbergen <ericvh@gmail.com>2011-03-15 10:57:41 -0400
commitd28c61f0e08aab9e3a2d3430e75f97937c5fe5fd (patch)
tree2a75e52772d832e4b9203fdc7500ecf8a05c5b43 /fs/9p
parent823fcfd42297acaf28892b3d2aabef2a121449c2 (diff)
fs/9p: Mark directory inode invalid for many directory inode operations
One successfull directory operation we would have changed directory inode attribute. So mark them invalid Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p')
-rw-r--r--fs/9p/vfs_inode.c23
-rw-r--r--fs/9p/vfs_inode_dotl.c23
2 files changed, 30 insertions, 16 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 3e3ffe3ad1a0..c072bb97e957 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -499,8 +499,8 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
499static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir) 499static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
500{ 500{
501 int retval; 501 int retval;
502 struct inode *file_inode;
503 struct p9_fid *v9fid; 502 struct p9_fid *v9fid;
503 struct inode *file_inode;
504 504
505 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file, 505 P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file,
506 rmdir); 506 rmdir);
@@ -521,7 +521,9 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
521 drop_nlink(dir); 521 drop_nlink(dir);
522 } else 522 } else
523 drop_nlink(file_inode); 523 drop_nlink(file_inode);
524
524 v9fs_invalidate_inode_attr(file_inode); 525 v9fs_invalidate_inode_attr(file_inode);
526 v9fs_invalidate_inode_attr(dir);
525 } 527 }
526 return retval; 528 return retval;
527} 529}
@@ -644,6 +646,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
644 goto error; 646 goto error;
645 } 647 }
646 648
649 v9fs_invalidate_inode_attr(dir);
647 /* if we are opening a file, assign the open fid to the file */ 650 /* if we are opening a file, assign the open fid to the file */
648 if (nd && nd->flags & LOOKUP_OPEN) { 651 if (nd && nd->flags & LOOKUP_OPEN) {
649 v9inode = V9FS_I(dentry->d_inode); 652 v9inode = V9FS_I(dentry->d_inode);
@@ -697,8 +700,8 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
697{ 700{
698 int err; 701 int err;
699 u32 perm; 702 u32 perm;
700 struct v9fs_session_info *v9ses;
701 struct p9_fid *fid; 703 struct p9_fid *fid;
704 struct v9fs_session_info *v9ses;
702 705
703 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); 706 P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
704 err = 0; 707 err = 0;
@@ -708,8 +711,10 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
708 if (IS_ERR(fid)) { 711 if (IS_ERR(fid)) {
709 err = PTR_ERR(fid); 712 err = PTR_ERR(fid);
710 fid = NULL; 713 fid = NULL;
711 } else 714 } else {
712 inc_nlink(dir); 715 inc_nlink(dir);
716 v9fs_invalidate_inode_attr(dir);
717 }
713 718
714 if (fid) 719 if (fid)
715 p9_client_clunk(fid); 720 p9_client_clunk(fid);
@@ -820,6 +825,7 @@ int
820v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, 825v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
821 struct inode *new_dir, struct dentry *new_dentry) 826 struct inode *new_dir, struct dentry *new_dentry)
822{ 827{
828 int retval;
823 struct inode *old_inode; 829 struct inode *old_inode;
824 struct inode *new_inode; 830 struct inode *new_inode;
825 struct v9fs_session_info *v9ses; 831 struct v9fs_session_info *v9ses;
@@ -827,7 +833,6 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
827 struct p9_fid *olddirfid; 833 struct p9_fid *olddirfid;
828 struct p9_fid *newdirfid; 834 struct p9_fid *newdirfid;
829 struct p9_wstat wstat; 835 struct p9_wstat wstat;
830 int retval;
831 836
832 P9_DPRINTK(P9_DEBUG_VFS, "\n"); 837 P9_DPRINTK(P9_DEBUG_VFS, "\n");
833 retval = 0; 838 retval = 0;
@@ -886,6 +891,8 @@ clunk_newdir:
886 drop_nlink(old_dir); 891 drop_nlink(old_dir);
887 } 892 }
888 v9fs_invalidate_inode_attr(old_inode); 893 v9fs_invalidate_inode_attr(old_inode);
894 v9fs_invalidate_inode_attr(old_dir);
895 v9fs_invalidate_inode_attr(new_dir);
889 896
890 /* successful rename */ 897 /* successful rename */
891 d_move(old_dentry, new_dentry); 898 d_move(old_dentry, new_dentry);
@@ -1208,8 +1215,8 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1208 int mode, const char *extension) 1215 int mode, const char *extension)
1209{ 1216{
1210 u32 perm; 1217 u32 perm;
1211 struct v9fs_session_info *v9ses;
1212 struct p9_fid *fid; 1218 struct p9_fid *fid;
1219 struct v9fs_session_info *v9ses;
1213 1220
1214 v9ses = v9fs_inode2v9ses(dir); 1221 v9ses = v9fs_inode2v9ses(dir);
1215 if (!v9fs_proto_dotu(v9ses)) { 1222 if (!v9fs_proto_dotu(v9ses)) {
@@ -1223,6 +1230,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
1223 if (IS_ERR(fid)) 1230 if (IS_ERR(fid))
1224 return PTR_ERR(fid); 1231 return PTR_ERR(fid);
1225 1232
1233 v9fs_invalidate_inode_attr(dir);
1226 p9_client_clunk(fid); 1234 p9_client_clunk(fid);
1227 return 0; 1235 return 0;
1228} 1236}
@@ -1259,8 +1267,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1259 struct dentry *dentry) 1267 struct dentry *dentry)
1260{ 1268{
1261 int retval; 1269 int retval;
1262 struct p9_fid *oldfid;
1263 char *name; 1270 char *name;
1271 struct p9_fid *oldfid;
1264 1272
1265 P9_DPRINTK(P9_DEBUG_VFS, 1273 P9_DPRINTK(P9_DEBUG_VFS,
1266 " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name, 1274 " %lu,%s,%s\n", dir->i_ino, dentry->d_name.name,
@@ -1279,7 +1287,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1279 sprintf(name, "%d\n", oldfid->fid); 1287 sprintf(name, "%d\n", oldfid->fid);
1280 retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name); 1288 retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name);
1281 __putname(name); 1289 __putname(name);
1282 1290 if (!retval)
1291 v9fs_invalidate_inode_attr(dir);
1283clunk_fid: 1292clunk_fid:
1284 p9_client_clunk(oldfid); 1293 p9_client_clunk(oldfid);
1285 return retval; 1294 return retval;
diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c
index 8d5f7e328631..4d4c70e07081 100644
--- a/fs/9p/vfs_inode_dotl.c
+++ b/fs/9p/vfs_inode_dotl.c
@@ -220,6 +220,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
220 err); 220 err);
221 goto error; 221 goto error;
222 } 222 }
223 v9fs_invalidate_inode_attr(dir);
223 224
224 /* instantiate inode and assign the unopened fid to the dentry */ 225 /* instantiate inode and assign the unopened fid to the dentry */
225 fid = p9_client_walk(dfid, 1, &name, 1); 226 fid = p9_client_walk(dfid, 1, &name, 1);
@@ -372,6 +373,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
372 /* Now set the ACL based on the default value */ 373 /* Now set the ACL based on the default value */
373 v9fs_set_create_acl(dentry, dacl, pacl); 374 v9fs_set_create_acl(dentry, dacl, pacl);
374 inc_nlink(dir); 375 inc_nlink(dir);
376 v9fs_invalidate_inode_attr(dir);
375error: 377error:
376 if (fid) 378 if (fid)
377 p9_client_clunk(fid); 379 p9_client_clunk(fid);
@@ -551,14 +553,14 @@ static int
551v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, 553v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
552 const char *symname) 554 const char *symname)
553{ 555{
554 struct v9fs_session_info *v9ses;
555 struct p9_fid *dfid;
556 struct p9_fid *fid = NULL;
557 struct inode *inode;
558 struct p9_qid qid;
559 char *name;
560 int err; 556 int err;
561 gid_t gid; 557 gid_t gid;
558 char *name;
559 struct p9_qid qid;
560 struct inode *inode;
561 struct p9_fid *dfid;
562 struct p9_fid *fid = NULL;
563 struct v9fs_session_info *v9ses;
562 564
563 name = (char *) dentry->d_name.name; 565 name = (char *) dentry->d_name.name;
564 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n", 566 P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n",
@@ -582,6 +584,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
582 goto error; 584 goto error;
583 } 585 }
584 586
587 v9fs_invalidate_inode_attr(dir);
585 if (v9ses->cache) { 588 if (v9ses->cache) {
586 /* Now walk from the parent so we can get an unopened fid. */ 589 /* Now walk from the parent so we can get an unopened fid. */
587 fid = p9_client_walk(dfid, 1, &name, 1); 590 fid = p9_client_walk(dfid, 1, &name, 1);
@@ -636,10 +639,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
636 struct dentry *dentry) 639 struct dentry *dentry)
637{ 640{
638 int err; 641 int err;
639 struct p9_fid *dfid, *oldfid;
640 char *name; 642 char *name;
641 struct v9fs_session_info *v9ses;
642 struct dentry *dir_dentry; 643 struct dentry *dir_dentry;
644 struct p9_fid *dfid, *oldfid;
645 struct v9fs_session_info *v9ses;
643 646
644 P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n", 647 P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
645 dir->i_ino, old_dentry->d_name.name, 648 dir->i_ino, old_dentry->d_name.name,
@@ -664,6 +667,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
664 return err; 667 return err;
665 } 668 }
666 669
670 v9fs_invalidate_inode_attr(dir);
667 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 671 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
668 /* Get the latest stat info from server. */ 672 /* Get the latest stat info from server. */
669 struct p9_fid *fid; 673 struct p9_fid *fid;
@@ -700,12 +704,12 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
700 dev_t rdev) 704 dev_t rdev)
701{ 705{
702 int err; 706 int err;
707 gid_t gid;
703 char *name; 708 char *name;
704 mode_t mode; 709 mode_t mode;
705 struct v9fs_session_info *v9ses; 710 struct v9fs_session_info *v9ses;
706 struct p9_fid *fid = NULL, *dfid = NULL; 711 struct p9_fid *fid = NULL, *dfid = NULL;
707 struct inode *inode; 712 struct inode *inode;
708 gid_t gid;
709 struct p9_qid qid; 713 struct p9_qid qid;
710 struct dentry *dir_dentry; 714 struct dentry *dir_dentry;
711 struct posix_acl *dacl = NULL, *pacl = NULL; 715 struct posix_acl *dacl = NULL, *pacl = NULL;
@@ -742,6 +746,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
742 if (err < 0) 746 if (err < 0)
743 goto error; 747 goto error;
744 748
749 v9fs_invalidate_inode_attr(dir);
745 /* instantiate inode and assign the unopened fid to the dentry */ 750 /* instantiate inode and assign the unopened fid to the dentry */
746 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { 751 if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
747 fid = p9_client_walk(dfid, 1, &name, 1); 752 fid = p9_client_walk(dfid, 1, &name, 1);