Commit a788a8ec authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Nathan Scott

[XFS] fix a freeze/thaw deadlock

Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 5dba7057
......@@ -818,13 +818,15 @@ xfs_ioctl(
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
freeze_bdev(inode->i_sb->s_bdev);
if (inode->i_sb->s_frozen == SB_UNFROZEN)
freeze_bdev(inode->i_sb->s_bdev);
return 0;
case XFS_IOC_THAW:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
thaw_bdev(inode->i_sb->s_bdev, inode->i_sb);
if (inode->i_sb->s_frozen != SB_UNFROZEN)
thaw_bdev(inode->i_sb->s_bdev, inode->i_sb);
return 0;
case XFS_IOC_GOINGDOWN: {
......
......@@ -216,4 +216,8 @@ extern void bhv_insert_all_vfsops(struct vfs *);
extern void bhv_remove_all_vfsops(struct vfs *, int);
extern void bhv_remove_vfsops(struct vfs *, int);
#define fs_frozen(vfsp) ((vfsp)->vfs_super->s_frozen)
#define fs_check_frozen(vfsp, level) \
vfs_check_frozen(vfsp->vfs_super, level);
#endif /* __XFS_VFS_H__ */
......@@ -590,9 +590,6 @@ xfs_fs_goingdown(
xfs_mount_t *mp,
__uint32_t inflags)
{
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
switch (inflags) {
case XFS_FSOP_GOING_FLAGS_DEFAULT: {
struct vfs *vfsp = XFS_MTOVFS(mp);
......@@ -602,7 +599,7 @@ xfs_fs_goingdown(
xfs_force_shutdown(mp, XFS_FORCE_UMOUNT);
thaw_bdev(sb->s_bdev, sb);
}
break;
}
case XFS_FSOP_GOING_FLAGS_LOGFLUSH:
......
......@@ -811,7 +811,7 @@ xfs_log_need_covered(xfs_mount_t *mp)
xlog_t *log = mp->m_log;
vfs_t *vfsp = XFS_MTOVFS(mp);
if (vfsp->vfs_super->s_frozen || XFS_FORCED_SHUTDOWN(mp) ||
if (fs_frozen(vfsp) || XFS_FORCED_SHUTDOWN(mp) ||
(vfsp->vfs_flag & VFS_RDONLY))
return 0;
......
......@@ -131,7 +131,7 @@ xfs_trans_alloc(
xfs_mount_t *mp,
uint type)
{
vfs_check_frozen(XFS_MTOVFS(mp)->vfs_super, SB_FREEZE_TRANS);
fs_check_frozen(XFS_MTOVFS(mp), SB_FREEZE_TRANS);
atomic_inc(&mp->m_active_trans);
return (_xfs_trans_alloc(mp, type));
......
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