提交 d28c61f0 编写于 作者: A Aneesh Kumar K.V 提交者: Eric Van Hensbergen

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: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: NVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: NEric Van Hensbergen <ericvh@gmail.com>
上级 823fcfd4
...@@ -499,8 +499,8 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid, ...@@ -499,8 +499,8 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, struct p9_fid *fid,
static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir) static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
{ {
int retval; int retval;
struct inode *file_inode;
struct p9_fid *v9fid; struct p9_fid *v9fid;
struct inode *file_inode;
P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file, P9_DPRINTK(P9_DEBUG_VFS, "inode: %p dentry: %p rmdir: %d\n", dir, file,
rmdir); rmdir);
...@@ -521,7 +521,9 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir) ...@@ -521,7 +521,9 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
drop_nlink(dir); drop_nlink(dir);
} else } else
drop_nlink(file_inode); drop_nlink(file_inode);
v9fs_invalidate_inode_attr(file_inode); v9fs_invalidate_inode_attr(file_inode);
v9fs_invalidate_inode_attr(dir);
} }
return retval; return retval;
} }
...@@ -644,6 +646,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, ...@@ -644,6 +646,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode,
goto error; goto error;
} }
v9fs_invalidate_inode_attr(dir);
/* if we are opening a file, assign the open fid to the file */ /* if we are opening a file, assign the open fid to the file */
if (nd && nd->flags & LOOKUP_OPEN) { if (nd && nd->flags & LOOKUP_OPEN) {
v9inode = V9FS_I(dentry->d_inode); v9inode = V9FS_I(dentry->d_inode);
...@@ -697,8 +700,8 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -697,8 +700,8 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{ {
int err; int err;
u32 perm; u32 perm;
struct v9fs_session_info *v9ses;
struct p9_fid *fid; struct p9_fid *fid;
struct v9fs_session_info *v9ses;
P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name); P9_DPRINTK(P9_DEBUG_VFS, "name %s\n", dentry->d_name.name);
err = 0; err = 0;
...@@ -708,8 +711,10 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) ...@@ -708,8 +711,10 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
if (IS_ERR(fid)) { if (IS_ERR(fid)) {
err = PTR_ERR(fid); err = PTR_ERR(fid);
fid = NULL; fid = NULL;
} else } else {
inc_nlink(dir); inc_nlink(dir);
v9fs_invalidate_inode_attr(dir);
}
if (fid) if (fid)
p9_client_clunk(fid); p9_client_clunk(fid);
...@@ -820,6 +825,7 @@ int ...@@ -820,6 +825,7 @@ int
v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *new_dir, struct dentry *new_dentry) struct inode *new_dir, struct dentry *new_dentry)
{ {
int retval;
struct inode *old_inode; struct inode *old_inode;
struct inode *new_inode; struct inode *new_inode;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
...@@ -827,7 +833,6 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -827,7 +833,6 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct p9_fid *olddirfid; struct p9_fid *olddirfid;
struct p9_fid *newdirfid; struct p9_fid *newdirfid;
struct p9_wstat wstat; struct p9_wstat wstat;
int retval;
P9_DPRINTK(P9_DEBUG_VFS, "\n"); P9_DPRINTK(P9_DEBUG_VFS, "\n");
retval = 0; retval = 0;
...@@ -886,6 +891,8 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -886,6 +891,8 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
drop_nlink(old_dir); drop_nlink(old_dir);
} }
v9fs_invalidate_inode_attr(old_inode); v9fs_invalidate_inode_attr(old_inode);
v9fs_invalidate_inode_attr(old_dir);
v9fs_invalidate_inode_attr(new_dir);
/* successful rename */ /* successful rename */
d_move(old_dentry, new_dentry); d_move(old_dentry, new_dentry);
...@@ -1208,8 +1215,8 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, ...@@ -1208,8 +1215,8 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
int mode, const char *extension) int mode, const char *extension)
{ {
u32 perm; u32 perm;
struct v9fs_session_info *v9ses;
struct p9_fid *fid; struct p9_fid *fid;
struct v9fs_session_info *v9ses;
v9ses = v9fs_inode2v9ses(dir); v9ses = v9fs_inode2v9ses(dir);
if (!v9fs_proto_dotu(v9ses)) { if (!v9fs_proto_dotu(v9ses)) {
...@@ -1223,6 +1230,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, ...@@ -1223,6 +1230,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry,
if (IS_ERR(fid)) if (IS_ERR(fid))
return PTR_ERR(fid); return PTR_ERR(fid);
v9fs_invalidate_inode_attr(dir);
p9_client_clunk(fid); p9_client_clunk(fid);
return 0; return 0;
} }
...@@ -1259,8 +1267,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, ...@@ -1259,8 +1267,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
struct dentry *dentry) struct dentry *dentry)
{ {
int retval; int retval;
struct p9_fid *oldfid;
char *name; char *name;
struct p9_fid *oldfid;
P9_DPRINTK(P9_DEBUG_VFS, P9_DPRINTK(P9_DEBUG_VFS,
" %lu,%s,%s\n", dir->i_ino, dentry->d_name.name, " %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,7 +1287,8 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
sprintf(name, "%d\n", oldfid->fid); sprintf(name, "%d\n", oldfid->fid);
retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name); retval = v9fs_vfs_mkspecial(dir, dentry, P9_DMLINK, name);
__putname(name); __putname(name);
if (!retval)
v9fs_invalidate_inode_attr(dir);
clunk_fid: clunk_fid:
p9_client_clunk(oldfid); p9_client_clunk(oldfid);
return retval; return retval;
......
...@@ -220,6 +220,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode, ...@@ -220,6 +220,7 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int omode,
err); err);
goto error; goto error;
} }
v9fs_invalidate_inode_attr(dir);
/* instantiate inode and assign the unopened fid to the dentry */ /* instantiate inode and assign the unopened fid to the dentry */
fid = p9_client_walk(dfid, 1, &name, 1); fid = p9_client_walk(dfid, 1, &name, 1);
...@@ -372,6 +373,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir, ...@@ -372,6 +373,7 @@ static int v9fs_vfs_mkdir_dotl(struct inode *dir,
/* Now set the ACL based on the default value */ /* Now set the ACL based on the default value */
v9fs_set_create_acl(dentry, dacl, pacl); v9fs_set_create_acl(dentry, dacl, pacl);
inc_nlink(dir); inc_nlink(dir);
v9fs_invalidate_inode_attr(dir);
error: error:
if (fid) if (fid)
p9_client_clunk(fid); p9_client_clunk(fid);
...@@ -551,14 +553,14 @@ static int ...@@ -551,14 +553,14 @@ static int
v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry, v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
const char *symname) const char *symname)
{ {
struct v9fs_session_info *v9ses;
struct p9_fid *dfid;
struct p9_fid *fid = NULL;
struct inode *inode;
struct p9_qid qid;
char *name;
int err; int err;
gid_t gid; gid_t gid;
char *name;
struct p9_qid qid;
struct inode *inode;
struct p9_fid *dfid;
struct p9_fid *fid = NULL;
struct v9fs_session_info *v9ses;
name = (char *) dentry->d_name.name; name = (char *) dentry->d_name.name;
P9_DPRINTK(P9_DEBUG_VFS, "v9fs_vfs_symlink_dotl : %lu,%s,%s\n", 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,6 +584,7 @@ v9fs_vfs_symlink_dotl(struct inode *dir, struct dentry *dentry,
goto error; goto error;
} }
v9fs_invalidate_inode_attr(dir);
if (v9ses->cache) { if (v9ses->cache) {
/* Now walk from the parent so we can get an unopened fid. */ /* Now walk from the parent so we can get an unopened fid. */
fid = p9_client_walk(dfid, 1, &name, 1); fid = p9_client_walk(dfid, 1, &name, 1);
...@@ -636,10 +639,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir, ...@@ -636,10 +639,10 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
struct dentry *dentry) struct dentry *dentry)
{ {
int err; int err;
struct p9_fid *dfid, *oldfid;
char *name; char *name;
struct v9fs_session_info *v9ses;
struct dentry *dir_dentry; struct dentry *dir_dentry;
struct p9_fid *dfid, *oldfid;
struct v9fs_session_info *v9ses;
P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n", P9_DPRINTK(P9_DEBUG_VFS, "dir ino: %lu, old_name: %s, new_name: %s\n",
dir->i_ino, old_dentry->d_name.name, dir->i_ino, old_dentry->d_name.name,
...@@ -664,6 +667,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir, ...@@ -664,6 +667,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct inode *dir,
return err; return err;
} }
v9fs_invalidate_inode_attr(dir);
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
/* Get the latest stat info from server. */ /* Get the latest stat info from server. */
struct p9_fid *fid; struct p9_fid *fid;
...@@ -700,12 +704,12 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, ...@@ -700,12 +704,12 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
dev_t rdev) dev_t rdev)
{ {
int err; int err;
gid_t gid;
char *name; char *name;
mode_t mode; mode_t mode;
struct v9fs_session_info *v9ses; struct v9fs_session_info *v9ses;
struct p9_fid *fid = NULL, *dfid = NULL; struct p9_fid *fid = NULL, *dfid = NULL;
struct inode *inode; struct inode *inode;
gid_t gid;
struct p9_qid qid; struct p9_qid qid;
struct dentry *dir_dentry; struct dentry *dir_dentry;
struct posix_acl *dacl = NULL, *pacl = NULL; struct posix_acl *dacl = NULL, *pacl = NULL;
...@@ -742,6 +746,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode, ...@@ -742,6 +746,7 @@ v9fs_vfs_mknod_dotl(struct inode *dir, struct dentry *dentry, int omode,
if (err < 0) if (err < 0)
goto error; goto error;
v9fs_invalidate_inode_attr(dir);
/* instantiate inode and assign the unopened fid to the dentry */ /* instantiate inode and assign the unopened fid to the dentry */
if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) { if (v9ses->cache == CACHE_LOOSE || v9ses->cache == CACHE_FSCACHE) {
fid = p9_client_walk(dfid, 1, &name, 1); fid = p9_client_walk(dfid, 1, &name, 1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册