fs/ufs: restore s_lock mutex
Commit 0244756edc
("ufs: sb mutex merge + mutex_destroy") generated
deadlocks in read/write mode on mkdir.
This patch partially reverts it keeping fixes by Andrew Morton and
mutex_destroy()
[AV: fixed a missing bit in ufs_remount()]
Signed-off-by: Fabian Frederick <fabf@skynet.be>
Reported-by: Ian Campbell <ian.campbell@citrix.com>
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>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:

committed by
Al Viro

parent
13b987ea27
commit
cdd9eefdf9
@@ -694,6 +694,7 @@ static int ufs_sync_fs(struct super_block *sb, int wait)
|
||||
unsigned flags;
|
||||
|
||||
lock_ufs(sb);
|
||||
mutex_lock(&UFS_SB(sb)->s_lock);
|
||||
|
||||
UFSD("ENTER\n");
|
||||
|
||||
@@ -711,6 +712,7 @@ static int ufs_sync_fs(struct super_block *sb, int wait)
|
||||
ufs_put_cstotal(sb);
|
||||
|
||||
UFSD("EXIT\n");
|
||||
mutex_unlock(&UFS_SB(sb)->s_lock);
|
||||
unlock_ufs(sb);
|
||||
|
||||
return 0;
|
||||
@@ -1277,6 +1279,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||
|
||||
sync_filesystem(sb);
|
||||
lock_ufs(sb);
|
||||
mutex_lock(&UFS_SB(sb)->s_lock);
|
||||
uspi = UFS_SB(sb)->s_uspi;
|
||||
flags = UFS_SB(sb)->s_flags;
|
||||
usb1 = ubh_get_usb_first(uspi);
|
||||
@@ -1290,6 +1293,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||
new_mount_opt = 0;
|
||||
ufs_set_opt (new_mount_opt, ONERROR_LOCK);
|
||||
if (!ufs_parse_options (data, &new_mount_opt)) {
|
||||
mutex_unlock(&UFS_SB(sb)->s_lock);
|
||||
unlock_ufs(sb);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -1297,12 +1301,14 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||
new_mount_opt |= ufstype;
|
||||
} else if ((new_mount_opt & UFS_MOUNT_UFSTYPE) != ufstype) {
|
||||
pr_err("ufstype can't be changed during remount\n");
|
||||
mutex_unlock(&UFS_SB(sb)->s_lock);
|
||||
unlock_ufs(sb);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if ((*mount_flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
|
||||
UFS_SB(sb)->s_mount_opt = new_mount_opt;
|
||||
mutex_unlock(&UFS_SB(sb)->s_lock);
|
||||
unlock_ufs(sb);
|
||||
return 0;
|
||||
}
|
||||
@@ -1326,6 +1332,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||
*/
|
||||
#ifndef CONFIG_UFS_FS_WRITE
|
||||
pr_err("ufs was compiled with read-only support, can't be mounted as read-write\n");
|
||||
mutex_unlock(&UFS_SB(sb)->s_lock);
|
||||
unlock_ufs(sb);
|
||||
return -EINVAL;
|
||||
#else
|
||||
@@ -1335,11 +1342,13 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||
ufstype != UFS_MOUNT_UFSTYPE_SUNx86 &&
|
||||
ufstype != UFS_MOUNT_UFSTYPE_UFS2) {
|
||||
pr_err("this ufstype is read-only supported\n");
|
||||
mutex_unlock(&UFS_SB(sb)->s_lock);
|
||||
unlock_ufs(sb);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!ufs_read_cylinder_structures(sb)) {
|
||||
pr_err("failed during remounting\n");
|
||||
mutex_unlock(&UFS_SB(sb)->s_lock);
|
||||
unlock_ufs(sb);
|
||||
return -EPERM;
|
||||
}
|
||||
@@ -1347,6 +1356,7 @@ static int ufs_remount (struct super_block *sb, int *mount_flags, char *data)
|
||||
#endif
|
||||
}
|
||||
UFS_SB(sb)->s_mount_opt = new_mount_opt;
|
||||
mutex_unlock(&UFS_SB(sb)->s_lock);
|
||||
unlock_ufs(sb);
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user