aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-01-10 10:46:03 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2012-01-10 11:13:13 -0500
commit0b2c4e39c014219ef73f05ab580c284bf8e6af0a (patch)
tree4447c0dbab25dc209f267c17123845b1d3bb8273 /fs/coda
parent3e25eb9c4bb649acdddb333d10774b640190f727 (diff)
coda: deal correctly with allocation failure from coda_cnode_makectl()
lookup should fail with ENOMEM, not silently make dentry negative. Switched to saner calling conventions, while we are at it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/coda')
-rw-r--r--fs/coda/cnode.c21
-rw-r--r--fs/coda/coda_fs_i.h2
-rw-r--r--fs/coda/dir.c4
3 files changed, 12 insertions, 15 deletions
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c
index 6475877b0763..8af67c9c47dd 100644
--- a/fs/coda/cnode.c
+++ b/fs/coda/cnode.c
@@ -156,19 +156,16 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb)
156} 156}
157 157
158/* the CONTROL inode is made without asking attributes from Venus */ 158/* the CONTROL inode is made without asking attributes from Venus */
159int coda_cnode_makectl(struct inode **inode, struct super_block *sb) 159struct inode *coda_cnode_makectl(struct super_block *sb)
160{ 160{
161 int error = -ENOMEM; 161 struct inode *inode = new_inode(sb);
162 162 if (inode) {
163 *inode = new_inode(sb); 163 inode->i_ino = CTL_INO;
164 if (*inode) { 164 inode->i_op = &coda_ioctl_inode_operations;
165 (*inode)->i_ino = CTL_INO; 165 inode->i_fop = &coda_ioctl_operations;
166 (*inode)->i_op = &coda_ioctl_inode_operations; 166 inode->i_mode = 0444;
167 (*inode)->i_fop = &coda_ioctl_operations; 167 return inode;
168 (*inode)->i_mode = 0444;
169 error = 0;
170 } 168 }
171 169 return ERR_PTR(-ENOMEM);
172 return error;
173} 170}
174 171
diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h
index e35071b1de0e..1c17446f1afe 100644
--- a/fs/coda/coda_fs_i.h
+++ b/fs/coda/coda_fs_i.h
@@ -51,7 +51,7 @@ struct coda_file_info {
51 51
52int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *); 52int coda_cnode_make(struct inode **, struct CodaFid *, struct super_block *);
53struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); 53struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr);
54int coda_cnode_makectl(struct inode **inode, struct super_block *sb); 54struct inode *coda_cnode_makectl(struct super_block *sb);
55struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); 55struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb);
56void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); 56void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *);
57 57
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index 83d2fd8ec24b..df0f9c1b01d3 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -111,7 +111,7 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc
111 111
112 /* control object, create inode on the fly */ 112 /* control object, create inode on the fly */
113 if (coda_isroot(dir) && coda_iscontrol(name, length)) { 113 if (coda_isroot(dir) && coda_iscontrol(name, length)) {
114 error = coda_cnode_makectl(&inode, dir->i_sb); 114 inode = coda_cnode_makectl(dir->i_sb);
115 type = CODA_NOCACHE; 115 type = CODA_NOCACHE;
116 goto exit; 116 goto exit;
117 } 117 }
@@ -125,7 +125,7 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc
125 return ERR_PTR(error); 125 return ERR_PTR(error);
126 126
127exit: 127exit:
128 if (inode && (type & CODA_NOCACHE)) 128 if (inode && !IS_ERR(inode) && (type & CODA_NOCACHE))
129 coda_flag_inode(inode, C_VATTR | C_PURGE); 129 coda_flag_inode(inode, C_VATTR | C_PURGE);
130 130
131 return d_splice_alias(inode, entry); 131 return d_splice_alias(inode, entry);