Commit fec87874 authored by Fabian Frederick's avatar Fabian Frederick Committed by Luis Henriques

fs/ufs: revert "ufs: fix deadlocks introduced by sb mutex merge"

commit 13b987ea upstream.

This reverts commit 9ef7db7f ("ufs: fix deadlocks introduced by sb
mutex merge") That patch tried to solve commit 0244756e ("ufs: sb
mutex merge + mutex_destroy") which is itself partially reverted due to
multiple deadlocks.
Signed-off-by: default avatarFabian Frederick <fabf@skynet.be>
Suggested-by: default avatarJan 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>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
parent bba5113a
...@@ -902,6 +902,9 @@ void ufs_evict_inode(struct inode * inode) ...@@ -902,6 +902,9 @@ void ufs_evict_inode(struct inode * inode)
invalidate_inode_buffers(inode); invalidate_inode_buffers(inode);
clear_inode(inode); clear_inode(inode);
if (want_delete) if (want_delete) {
lock_ufs(inode->i_sb);
ufs_free_inode(inode); ufs_free_inode(inode);
unlock_ufs(inode->i_sb);
}
} }
...@@ -126,12 +126,12 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry, ...@@ -126,12 +126,12 @@ static int ufs_symlink (struct inode * dir, struct dentry * dentry,
if (l > sb->s_blocksize) if (l > sb->s_blocksize)
goto out_notlocked; goto out_notlocked;
lock_ufs(dir->i_sb);
inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO); inode = ufs_new_inode(dir, S_IFLNK | S_IRWXUGO);
err = PTR_ERR(inode); err = PTR_ERR(inode);
if (IS_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) { if (l > UFS_SB(sb)->s_uspi->s_maxsymlinklen) {
/* slow symlink */ /* slow symlink */
inode->i_op = &ufs_symlink_inode_operations; inode->i_op = &ufs_symlink_inode_operations;
...@@ -181,9 +181,13 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) ...@@ -181,9 +181,13 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
struct inode * inode; struct inode * inode;
int err; int err;
lock_ufs(dir->i_sb);
inode_inc_link_count(dir);
inode = ufs_new_inode(dir, S_IFDIR|mode); inode = ufs_new_inode(dir, S_IFDIR|mode);
err = PTR_ERR(inode);
if (IS_ERR(inode)) if (IS_ERR(inode))
return PTR_ERR(inode); goto out_dir;
inode->i_op = &ufs_dir_inode_operations; inode->i_op = &ufs_dir_inode_operations;
inode->i_fop = &ufs_dir_operations; inode->i_fop = &ufs_dir_operations;
...@@ -191,9 +195,6 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) ...@@ -191,9 +195,6 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
inode_inc_link_count(inode); inode_inc_link_count(inode);
lock_ufs(dir->i_sb);
inode_inc_link_count(dir);
err = ufs_make_empty(inode, dir); err = ufs_make_empty(inode, dir);
if (err) if (err)
goto out_fail; goto out_fail;
...@@ -211,6 +212,7 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) ...@@ -211,6 +212,7 @@ static int ufs_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
inode_dec_link_count(inode); inode_dec_link_count(inode);
inode_dec_link_count(inode); inode_dec_link_count(inode);
iput (inode); iput (inode);
out_dir:
inode_dec_link_count(dir); inode_dec_link_count(dir);
unlock_ufs(dir->i_sb); unlock_ufs(dir->i_sb);
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment