aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/coda/dir.c')
-rw-r--r--fs/coda/dir.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index df0f9c1b01d3..177515829062 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -96,12 +96,11 @@ const struct file_operations coda_dir_operations = {
96/* access routines: lookup, readlink, permission */ 96/* access routines: lookup, readlink, permission */
97static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd) 97static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd)
98{ 98{
99 struct inode *inode = NULL; 99 struct super_block *sb = dir->i_sb;
100 struct CodaFid resfid = { { 0, } };
101 int type = 0;
102 int error = 0;
103 const char *name = entry->d_name.name; 100 const char *name = entry->d_name.name;
104 size_t length = entry->d_name.len; 101 size_t length = entry->d_name.len;
102 struct inode *inode;
103 int type = 0;
105 104
106 if (length > CODA_MAXNAMLEN) { 105 if (length > CODA_MAXNAMLEN) {
107 printk(KERN_ERR "name too long: lookup, %s (%*s)\n", 106 printk(KERN_ERR "name too long: lookup, %s (%*s)\n",
@@ -111,23 +110,21 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc
111 110
112 /* control object, create inode on the fly */ 111 /* control object, create inode on the fly */
113 if (coda_isroot(dir) && coda_iscontrol(name, length)) { 112 if (coda_isroot(dir) && coda_iscontrol(name, length)) {
114 inode = coda_cnode_makectl(dir->i_sb); 113 inode = coda_cnode_makectl(sb);
115 type = CODA_NOCACHE; 114 type = CODA_NOCACHE;
116 goto exit; 115 } else {
116 struct CodaFid fid = { { 0, } };
117 int error = venus_lookup(sb, coda_i2f(dir), name, length,
118 &type, &fid);
119 inode = !error ? coda_cnode_make(&fid, sb) : ERR_PTR(error);
117 } 120 }
118 121
119 error = venus_lookup(dir->i_sb, coda_i2f(dir), name, length, 122 if (!IS_ERR(inode) && (type & CODA_NOCACHE))
120 &type, &resfid);
121 if (!error)
122 error = coda_cnode_make(&inode, &resfid, dir->i_sb);
123
124 if (error && error != -ENOENT)
125 return ERR_PTR(error);
126
127exit:
128 if (inode && !IS_ERR(inode) && (type & CODA_NOCACHE))
129 coda_flag_inode(inode, C_VATTR | C_PURGE); 123 coda_flag_inode(inode, C_VATTR | C_PURGE);
130 124
125 if (inode == ERR_PTR(-ENOENT))
126 inode = NULL;
127
131 return d_splice_alias(inode, entry); 128 return d_splice_alias(inode, entry);
132} 129}
133 130