aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/ufs/inode.c5
-rw-r--r--fs/ufs/namei.c14
2 files changed, 12 insertions, 7 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index be7d42c7d938..2d93ab07da8a 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -902,6 +902,9 @@ void ufs_evict_inode(struct inode * inode)
902 invalidate_inode_buffers(inode); 902 invalidate_inode_buffers(inode);
903 clear_inode(inode); 903 clear_inode(inode);
904 904
905 if (want_delete) 905 if (want_delete) {
906 lock_ufs(inode->i_sb);
906 ufs_free_inode(inode); 907 ufs_free_inode(inode);
908 unlock_ufs(inode->i_sb);
909 }
907} 910}
diff --git a/fs/ufs/namei.c b/fs/ufs/namei.c
index e491a93a7e9a..1f5223c9e1e2 100644
--- a/fs/ufs/namei.c
+++ b/fs/ufs/namei.c
@@ -128,12 +128,12 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
128 if (l > sb->s_blocksize) 128 if (l > sb->s_blocksize)
129 goto out_notlocked; 129 goto out_notlocked;
130 130
131 lock_ufs(dir->i_sb);
131 inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); 132 inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
132 err = PTR_ERR(inode); 133 err = PTR_ERR(inode);
133 if (IS_ERR(inode)) 134 if (IS_ERR(inode))
134 goto out_notlocked; 135 goto out;
135 136
136 lock_ufs(dir->i_sb);
137 if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) { 137 if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) {
138 /* slow symlink */ 138 /* slow symlink */
139 inode->i_op = &ufs_symlink_inode_operations; 139 inode->i_op = &ufs_symlink_inode_operations;
@@ -184,9 +184,13 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
184 struct inode * inode; 184 struct inode * inode;
185 int err; 185 int err;
186 186
187 lock_ufs(dir->i_sb);
188 inode_inc_link_count(dir);
189
187 inode = ufs_new_inode(dir, S_IFDIR|mode); 190 inode = ufs_new_inode(dir, S_IFDIR|mode);
191 err = PTR_ERR(inode);
188 if (IS_ERR(inode)) 192 if (IS_ERR(inode))
189 return PTR_ERR(inode); 193 goto out_dir;
190 194
191 inode->i_op = &ufs_dir_inode_operations; 195 inode->i_op = &ufs_dir_inode_operations;
192 inode->i_fop = &ufs_dir_operations; 196 inode->i_fop = &ufs_dir_operations;
@@ -194,9 +198,6 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
194 198
195 inode_inc_link_count(inode); 199 inode_inc_link_count(inode);
196 200
197 lock_ufs(dir->i_sb);
198 inode_inc_link_count(dir);
199
200 err = ufs_make_empty(inode, dir); 201 err = ufs_make_empty(inode, dir);
201 if (err) 202 if (err)
202 goto out_fail; 203 goto out_fail;
@@ -215,6 +216,7 @@ out_fail:
215 inode_dec_link_count(inode); 216 inode_dec_link_count(inode);
216 unlock_new_inode(inode); 217 unlock_new_inode(inode);
217 iput (inode); 218 iput (inode);
219out_dir:
218 inode_dec_link_count(dir); 220 inode_dec_link_count(dir);
219 unlock_ufs(dir->i_sb); 221 unlock_ufs(dir->i_sb);
220 goto out; 222 goto out;