diff options
author | David Chinner <dgc@sgi.com> | 2007-02-10 02:36:40 -0500 |
---|---|---|
committer | Tim Shimmin <tes@sgi.com> | 2007-02-10 02:36:40 -0500 |
commit | 2823945fda94e0636be573a037c45cb7b6495af2 (patch) | |
tree | b06f13e327978cb4e44710cec46839539c394cf5 /fs/xfs/linux-2.6 | |
parent | 549054afadae44889c0b40d4c3bfb0207b98d5a0 (diff) |
[XFS] Ensure a frozen filesystem has a clean log before writing the dummy
record.
The current Linux XFS freeze code is a mess. We flush the metadata buffers
out while we are still allowing new transactions to start and then fail to
flush the dirty buffers back out before writing the unmount and dummy
records to the log.
This leads to problems when the frozen filesystem is used for snapshots -
we do log recovery on a readonly image and often it appears that the log
image in the snapshot is not correct. Hence we end up with hangs, oops and
mount failures when trying to mount a snapshot image that has been created
when the filesystem has not been correctly frozen.
To fix this, we need to move th metadata flush to after we wait for all
current transactions to complete in teh second stage of the freeze. This
means that when we write the final log records, the log should be clean
and recovery should never occur on a snapshot image created from a frozen
filesystem.
SGI-PV: 959267
SGI-Modid: xfs-linux-melb:xfs-kern:28010a
Signed-off-by: David Chinner <dgc@sgi.com>
Signed-off-by: Donald Douwsma <donaldd@sgi.com>
Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 14 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_vfs.h | 1 |
2 files changed, 12 insertions, 3 deletions
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c index dab5d3802374..003e5f29d684 100644 --- a/fs/xfs/linux-2.6/xfs_super.c +++ b/fs/xfs/linux-2.6/xfs_super.c | |||
@@ -659,9 +659,17 @@ xfs_fs_sync_super( | |||
659 | int error; | 659 | int error; |
660 | int flags; | 660 | int flags; |
661 | 661 | ||
662 | if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) | 662 | if (unlikely(sb->s_frozen == SB_FREEZE_WRITE)) { |
663 | flags = SYNC_QUIESCE; | 663 | /* |
664 | else | 664 | * First stage of freeze - no more writers will make progress |
665 | * now we are here, so we flush delwri and delalloc buffers | ||
666 | * here, then wait for all I/O to complete. Data is frozen at | ||
667 | * that point. Metadata is not frozen, transactions can still | ||
668 | * occur here so don't bother flushing the buftarg (i.e | ||
669 | * SYNC_QUIESCE) because it'll just get dirty again. | ||
670 | */ | ||
671 | flags = SYNC_FSDATA | SYNC_DELWRI | SYNC_WAIT | SYNC_DIO_WAIT; | ||
672 | } else | ||
665 | flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); | 673 | flags = SYNC_FSDATA | (wait ? SYNC_WAIT : 0); |
666 | 674 | ||
667 | error = bhv_vfs_sync(vfsp, flags, NULL); | 675 | error = bhv_vfs_sync(vfsp, flags, NULL); |
diff --git a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h index da255bdf5260..558823a83065 100644 --- a/fs/xfs/linux-2.6/xfs_vfs.h +++ b/fs/xfs/linux-2.6/xfs_vfs.h | |||
@@ -92,6 +92,7 @@ typedef enum { | |||
92 | #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ | 92 | #define SYNC_REFCACHE 0x0040 /* prune some of the nfs ref cache */ |
93 | #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ | 93 | #define SYNC_REMOUNT 0x0080 /* remount readonly, no dummy LRs */ |
94 | #define SYNC_QUIESCE 0x0100 /* quiesce fileystem for a snapshot */ | 94 | #define SYNC_QUIESCE 0x0100 /* quiesce fileystem for a snapshot */ |
95 | #define SYNC_DIO_WAIT 0x0200 /* wait for direct I/O to complete */ | ||
95 | 96 | ||
96 | #define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */ | 97 | #define SHUTDOWN_META_IO_ERROR 0x0001 /* write attempt to metadata failed */ |
97 | #define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */ | 98 | #define SHUTDOWN_LOG_IO_ERROR 0x0002 /* write attempt to the log failed */ |