[XFS] quiesce the filesystem proper when freezing
SGI-PV: 936977 SGI-Modid: xfs-linux:xfs-kern:193840a Signed-off-by: Christoph Hellwig <hch@sgi.com> Signed-off-by: Nathan Scott <nathans@sgi.com>
This commit is contained in:
parent
48fab6bf5f
commit
f898d6c09c
fs/xfs
|
@ -590,8 +590,10 @@ linvfs_sync_super(
|
||||||
int error;
|
int error;
|
||||||
int flags = SYNC_FSDATA;
|
int flags = SYNC_FSDATA;
|
||||||
|
|
||||||
if (wait)
|
if (unlikely(sb->s_frozen == SB_FREEZE_WRITE))
|
||||||
flags |= SYNC_WAIT;
|
flags = SYNC_QUIESCE;
|
||||||
|
else
|
||||||
|
flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0);
|
||||||
|
|
||||||
VFS_SYNC(vfsp, flags, NULL, error);
|
VFS_SYNC(vfsp, flags, NULL, error);
|
||||||
sb->s_dirt = 0;
|
sb->s_dirt = 0;
|
||||||
|
|
|
@ -107,6 +107,7 @@ typedef enum {
|
||||||
#define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */
|
#define SYNC_FSDATA 0x0020 /* flush fs data (e.g. superblocks) */
|
||||||
#define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */
|
#define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */
|
||||||
#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
|
#define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */
|
||||||
|
#define SYNC_QUIESCE 0x0100 /* quiesce fileystem for a snapshot */
|
||||||
|
|
||||||
typedef int (*vfs_mount_t)(bhv_desc_t *,
|
typedef int (*vfs_mount_t)(bhv_desc_t *,
|
||||||
struct xfs_mount_args *, struct cred *);
|
struct xfs_mount_args *, struct cred *);
|
||||||
|
|
|
@ -612,29 +612,12 @@ out:
|
||||||
return XFS_ERROR(error);
|
return XFS_ERROR(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define REMOUNT_READONLY_FLAGS (SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT)
|
|
||||||
|
|
||||||
STATIC int
|
STATIC int
|
||||||
xfs_mntupdate(
|
xfs_quiesce_fs(
|
||||||
bhv_desc_t *bdp,
|
xfs_mount_t *mp)
|
||||||
int *flags,
|
|
||||||
struct xfs_mount_args *args)
|
|
||||||
{
|
{
|
||||||
struct vfs *vfsp = bhvtovfs(bdp);
|
int count = 0, pincount;
|
||||||
xfs_mount_t *mp = XFS_BHVTOM(bdp);
|
|
||||||
int pincount, error;
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
if (args->flags & XFSMNT_NOATIME)
|
|
||||||
mp->m_flags |= XFS_MOUNT_NOATIME;
|
|
||||||
else
|
|
||||||
mp->m_flags &= ~XFS_MOUNT_NOATIME;
|
|
||||||
|
|
||||||
if (!(vfsp->vfs_flag & VFS_RDONLY)) {
|
|
||||||
VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*flags & MS_RDONLY) {
|
|
||||||
xfs_refcache_purge_mp(mp);
|
xfs_refcache_purge_mp(mp);
|
||||||
xfs_flush_buftarg(mp->m_ddev_targp, 0);
|
xfs_flush_buftarg(mp->m_ddev_targp, 0);
|
||||||
xfs_finish_reclaim_all(mp, 0);
|
xfs_finish_reclaim_all(mp, 0);
|
||||||
|
@ -647,7 +630,7 @@ xfs_mntupdate(
|
||||||
* we can write the unmount record.
|
* we can write the unmount record.
|
||||||
*/
|
*/
|
||||||
do {
|
do {
|
||||||
VFS_SYNC(vfsp, REMOUNT_READONLY_FLAGS, NULL, error);
|
xfs_syncsub(mp, SYNC_REMOUNT|SYNC_ATTR|SYNC_WAIT, 0, NULL);
|
||||||
pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);
|
pincount = xfs_flush_buftarg(mp->m_ddev_targp, 1);
|
||||||
if (!pincount) {
|
if (!pincount) {
|
||||||
delay(50);
|
delay(50);
|
||||||
|
@ -655,6 +638,31 @@ xfs_mntupdate(
|
||||||
}
|
}
|
||||||
} while (count < 2);
|
} while (count < 2);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
STATIC int
|
||||||
|
xfs_mntupdate(
|
||||||
|
bhv_desc_t *bdp,
|
||||||
|
int *flags,
|
||||||
|
struct xfs_mount_args *args)
|
||||||
|
{
|
||||||
|
struct vfs *vfsp = bhvtovfs(bdp);
|
||||||
|
xfs_mount_t *mp = XFS_BHVTOM(bdp);
|
||||||
|
int error;
|
||||||
|
|
||||||
|
if (args->flags & XFSMNT_NOATIME)
|
||||||
|
mp->m_flags |= XFS_MOUNT_NOATIME;
|
||||||
|
else
|
||||||
|
mp->m_flags &= ~XFS_MOUNT_NOATIME;
|
||||||
|
|
||||||
|
if (!(vfsp->vfs_flag & VFS_RDONLY)) {
|
||||||
|
VFS_SYNC(vfsp, SYNC_FSDATA|SYNC_BDFLUSH|SYNC_ATTR, NULL, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*flags & MS_RDONLY) {
|
||||||
|
xfs_quiesce_fs(mp);
|
||||||
|
|
||||||
/* Ok now write out an unmount record */
|
/* Ok now write out an unmount record */
|
||||||
xfs_log_unmount_write(mp);
|
xfs_log_unmount_write(mp);
|
||||||
xfs_unmountfs_writesb(mp);
|
xfs_unmountfs_writesb(mp);
|
||||||
|
@ -869,10 +877,12 @@ xfs_sync(
|
||||||
int flags,
|
int flags,
|
||||||
cred_t *credp)
|
cred_t *credp)
|
||||||
{
|
{
|
||||||
xfs_mount_t *mp;
|
xfs_mount_t *mp = XFS_BHVTOM(bdp);
|
||||||
|
|
||||||
mp = XFS_BHVTOM(bdp);
|
if (unlikely(flags == SYNC_QUIESCE))
|
||||||
return (xfs_syncsub(mp, flags, 0, NULL));
|
return xfs_quiesce_fs(mp);
|
||||||
|
else
|
||||||
|
return xfs_syncsub(mp, flags, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in New Issue