Skip to content

Commit

Permalink
fs/ufs: revert "ufs: fix deadlocks introduced by sb mutex merge"
Browse files Browse the repository at this point in the history
This reverts commit 9ef7db7 ("ufs: fix deadlocks introduced by sb
mutex merge") That patch tried to solve commit 0244756 ("ufs: sb
mutex merge + mutex_destroy") which is itself partially reverted due to
multiple deadlocks.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
Suggested-by: Jan Kara <jack@suse.cz>
Cc: Ian Campbell <ian.campbell@citrix.com>
Cc: Evgeniy Dushistov <dushistov@mail.ru>
Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
Cc: Roger Pau Monne <roger.pau@citrix.com>
Cc: Ian Jackson <Ian.Jackson@eu.citrix.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Fabian Frederick authored and Al Viro committed Jun 14, 2015
1 parent 3f4a949 commit 13b987e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
5 changes: 4 additions & 1 deletion fs/ufs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,9 @@ void ufs_evict_inode(struct inode * inode)
invalidate_inode_buffers(inode);
clear_inode(inode);

if (want_delete)
if (want_delete) {
lock_ufs(inode->i_sb);
ufs_free_inode(inode);
unlock_ufs(inode->i_sb);
}
}
14 changes: 8 additions & 6 deletions fs/ufs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,12 +128,12 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
if (l > sb->s_blocksize)
goto out_notlocked;

lock_ufs(dir->i_sb);
inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
err = PTR_ERR(inode);
if (IS_ERR(inode))
goto out_notlocked;
goto out;

lock_ufs(dir->i_sb);
if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) {
/* slow symlink */
inode->i_op = &ufs_symlink_inode_operations;
Expand Down Expand Up @@ -184,19 +184,20 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
struct inode * inode;
int err;

lock_ufs(dir->i_sb);
inode_inc_link_count(dir);

inode = ufs_new_inode(dir, S_IFDIR|mode);
err = PTR_ERR(inode);
if (IS_ERR(inode))
return PTR_ERR(inode);
goto out_dir;

inode->i_op = &ufs_dir_inode_operations;
inode->i_fop = &ufs_dir_operations;
inode->i_mapping->a_ops = &ufs_aops;

inode_inc_link_count(inode);

lock_ufs(dir->i_sb);
inode_inc_link_count(dir);

err = ufs_make_empty(inode, dir);
if (err)
goto out_fail;
Expand All @@ -215,6 +216,7 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
inode_dec_link_count(inode);
unlock_new_inode(inode);
iput (inode);
out_dir:
inode_dec_link_count(dir);
unlock_ufs(dir->i_sb);
goto out;
Expand Down

0 comments on commit 13b987e

Please sign in to comment.