diff options
author | Nathan Scott <nathans@sgi.com> | 2006-05-08 05:51:28 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2006-05-08 05:51:28 -0400 |
commit | d08d389d5aef0509edba7ee42cd6c6a3998fee22 (patch) | |
tree | 829f45f629852b421f74db2ee5db0ca1a706ed4f /fs | |
parent | 9d21f09ca03d1142f1988001f228d02581d8986c (diff) |
[XFS] Fix a possible forced shutdown due to mishandling write barriers
with remount,ro.
SGI-PV: 951944
SGI-Modid: xfs-linux-melb:xfs-kern:25742a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_vfsops.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c index f0e09ca14139..36ea1b2094f2 100644 --- a/fs/xfs/xfs_vfsops.c +++ b/fs/xfs/xfs_vfsops.c | |||
@@ -669,31 +669,22 @@ xfs_mntupdate( | |||
669 | xfs_mount_t *mp = XFS_BHVTOM(bdp); | 669 | xfs_mount_t *mp = XFS_BHVTOM(bdp); |
670 | int error; | 670 | int error; |
671 | 671 | ||
672 | if (args->flags & XFSMNT_BARRIER) | 672 | if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */ |
673 | mp->m_flags |= XFS_MOUNT_BARRIER; | 673 | if (vfsp->vfs_flag & VFS_RDONLY) |
674 | else | 674 | vfsp->vfs_flag &= ~VFS_RDONLY; |
675 | mp->m_flags &= ~XFS_MOUNT_BARRIER; | 675 | if (args->flags & XFSMNT_BARRIER) { |
676 | 676 | mp->m_flags |= XFS_MOUNT_BARRIER; | |
677 | if ((vfsp->vfs_flag & VFS_RDONLY) && | ||
678 | !(*flags & MS_RDONLY)) { | ||
679 | vfsp->vfs_flag &= ~VFS_RDONLY; | ||
680 | |||
681 | if (args->flags & XFSMNT_BARRIER) | ||
682 | xfs_mountfs_check_barriers(mp); | 677 | xfs_mountfs_check_barriers(mp); |
683 | } | 678 | } else { |
684 | 679 | mp->m_flags &= ~XFS_MOUNT_BARRIER; | |
685 | if (!(vfsp->vfs_flag & VFS_RDONLY) && | 680 | } |
686 | (*flags & MS_RDONLY)) { | 681 | } else if (!(vfsp->vfs_flag & VFS_RDONLY)) { /* rw -> ro */ |
687 | VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error); | 682 | VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error); |
688 | |||
689 | xfs_quiesce_fs(mp); | 683 | xfs_quiesce_fs(mp); |
690 | |||
691 | /* Ok now write out an unmount record */ | ||
692 | xfs_log_unmount_write(mp); | 684 | xfs_log_unmount_write(mp); |
693 | xfs_unmountfs_writesb(mp); | 685 | xfs_unmountfs_writesb(mp); |
694 | vfsp->vfs_flag |= VFS_RDONLY; | 686 | vfsp->vfs_flag |= VFS_RDONLY; |
695 | } | 687 | } |
696 | |||
697 | return 0; | 688 | return 0; |
698 | } | 689 | } |
699 | 690 | ||