Skip to contentSkip to conversation

Patch "fs/ufs: revert "ufs: fix deadlocks introduced by sb mutex merge"" has been added to the 4.0-stable tree

PATCH [email protected] 1 participant 1 message Jul 8, 2015 Stable branch

lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

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

to the 4.0-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
fs-ufs-revert-ufs-fix-deadlocks-introduced-by-sb-mutex-merge.patch
and it can be found in the queue-4.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 13b987ea275840d74d9df9a44326632fab1894da Mon Sep 17 00:00:00 2001

From: Fabian Frederick <[email protected]>
Date: Wed, 10 Jun 2015 10:09:32 +1000
Subject: fs/ufs: revert "ufs: fix deadlocks introduced by sb mutex merge"

From: Fabian Frederick <[email protected]>

commit 13b987ea275840d74d9df9a44326632fab1894da upstream.

This reverts commit 9ef7db7f38d0 ("ufs: fix deadlocks introduced by sb mutex merge") That patch tried to solve commit 0244756edc4b98c ("ufs: sb mutex merge + mutex_destroy") which is itself partially reverted due to multiple deadlocks.

Cc Ian Campbell <[email protected]>
Cc Evgeniy Dushistov <[email protected]>
Cc Alexey Khoroshilov <[email protected]>
Cc Roger Pau Monne <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Al Viro <[email protected]>
---
 fs/ufs/inode.c |    5 ++++-
 fs/ufs/namei.c |   14 ++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)
fs/ufs/inode.c +4 -1
@@ -902,6 +902,9 @@ void ufs_evict_inode(struct inode * inod
 	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);
+	}
 }
fs/ufs/namei.c +8 -6
@@ -128,12 +128,12 @@ static int ufs_symlink (struct inode * d
 	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;
@@ -184,9 +184,13 @@ static int ufs_mkdir(struct inode * dir,
 	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;
@@ -194,9 +198,6 @@ static int ufs_mkdir(struct inode * dir,
 
 	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;
@@ -215,6 +216,7 @@ out_fail:
 	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;

Patches currently in stable-queue which might be from [email protected] are

queue-4.0/fs-ufs-restore-s_lock-mutex.patch queue-4.0/fs-ufs-revert-ufs-fix-deadlocks-introduced-by-sb-mutex-merge.patch