aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hppfs/hppfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hppfs/hppfs.c')
-rw-r--r--fs/hppfs/hppfs.c31
1 files changed, 9 insertions, 22 deletions
diff --git a/fs/hppfs/hppfs.c b/fs/hppfs/hppfs.c
index 87ed48e0343d..85c098a499f3 100644
--- a/fs/hppfs/hppfs.c
+++ b/fs/hppfs/hppfs.c
@@ -139,7 +139,8 @@ static int file_removed(struct dentry *dentry, const char *file)
139static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry, 139static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
140 struct nameidata *nd) 140 struct nameidata *nd)
141{ 141{
142 struct dentry *proc_dentry, *new, *parent; 142 struct dentry *proc_dentry, *parent;
143 struct qstr *name = &dentry->d_name;
143 struct inode *inode; 144 struct inode *inode;
144 int err, deleted; 145 int err, deleted;
145 146
@@ -149,23 +150,9 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
149 else if (deleted) 150 else if (deleted)
150 return ERR_PTR(-ENOENT); 151 return ERR_PTR(-ENOENT);
151 152
152 err = -ENOMEM;
153 parent = HPPFS_I(ino)->proc_dentry; 153 parent = HPPFS_I(ino)->proc_dentry;
154 mutex_lock(&parent->d_inode->i_mutex); 154 mutex_lock(&parent->d_inode->i_mutex);
155 proc_dentry = d_lookup(parent, &dentry->d_name); 155 proc_dentry = lookup_one_len(name->name, parent, name->len);
156 if (proc_dentry == NULL) {
157 proc_dentry = d_alloc(parent, &dentry->d_name);
158 if (proc_dentry == NULL) {
159 mutex_unlock(&parent->d_inode->i_mutex);
160 goto out;
161 }
162 new = (*parent->d_inode->i_op->lookup)(parent->d_inode,
163 proc_dentry, NULL);
164 if (new) {
165 dput(proc_dentry);
166 proc_dentry = new;
167 }
168 }
169 mutex_unlock(&parent->d_inode->i_mutex); 156 mutex_unlock(&parent->d_inode->i_mutex);
170 157
171 if (IS_ERR(proc_dentry)) 158 if (IS_ERR(proc_dentry))
@@ -174,13 +161,11 @@ static struct dentry *hppfs_lookup(struct inode *ino, struct dentry *dentry,
174 err = -ENOMEM; 161 err = -ENOMEM;
175 inode = get_inode(ino->i_sb, proc_dentry); 162 inode = get_inode(ino->i_sb, proc_dentry);
176 if (!inode) 163 if (!inode)
177 goto out_dput; 164 goto out;
178 165
179 d_add(dentry, inode); 166 d_add(dentry, inode);
180 return NULL; 167 return NULL;
181 168
182 out_dput:
183 dput(proc_dentry);
184 out: 169 out:
185 return ERR_PTR(err); 170 return ERR_PTR(err);
186} 171}
@@ -690,8 +675,10 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
690 struct inode *proc_ino = dentry->d_inode; 675 struct inode *proc_ino = dentry->d_inode;
691 struct inode *inode = new_inode(sb); 676 struct inode *inode = new_inode(sb);
692 677
693 if (!inode) 678 if (!inode) {
679 dput(dentry);
694 return ERR_PTR(-ENOMEM); 680 return ERR_PTR(-ENOMEM);
681 }
695 682
696 if (S_ISDIR(dentry->d_inode->i_mode)) { 683 if (S_ISDIR(dentry->d_inode->i_mode)) {
697 inode->i_op = &hppfs_dir_iops; 684 inode->i_op = &hppfs_dir_iops;
@@ -704,7 +691,7 @@ static struct inode *get_inode(struct super_block *sb, struct dentry *dentry)
704 inode->i_fop = &hppfs_file_fops; 691 inode->i_fop = &hppfs_file_fops;
705 } 692 }
706 693
707 HPPFS_I(inode)->proc_dentry = dget(dentry); 694 HPPFS_I(inode)->proc_dentry = dentry;
708 695
709 inode->i_uid = proc_ino->i_uid; 696 inode->i_uid = proc_ino->i_uid;
710 inode->i_gid = proc_ino->i_gid; 697 inode->i_gid = proc_ino->i_gid;
@@ -737,7 +724,7 @@ static int hppfs_fill_super(struct super_block *sb, void *d, int silent)
737 sb->s_fs_info = proc_mnt; 724 sb->s_fs_info = proc_mnt;
738 725
739 err = -ENOMEM; 726 err = -ENOMEM;
740 root_inode = get_inode(sb, proc_mnt->mnt_sb->s_root); 727 root_inode = get_inode(sb, dget(proc_mnt->mnt_sb->s_root));
741 if (!root_inode) 728 if (!root_inode)
742 goto out_mntput; 729 goto out_mntput;
743 730