To: Christoph Hellwig <hch@...>, Andrew Morton <akpm@...>, Eric Sandeen <sandeen@...>, David Chinner <dgc@...>, linux-kernel Mailing List <linux-kernel@...>, <xfs@...>
On Tue, Jan 09, 2007 at 10:04:20AM +0000, Christoph Hellwig wrote:
This can be done without needing to hold a semaphore across the
freeze/thaw.
In the XFS case, we never try to lock the semaphore a second
time - the freeze code checks if the filesystem is not already
(being) frozen before calling freeze_bdev(). On thaw it also
checks that the filesystem is frozen before calling thaw_bdev().
IOWs, you can safely do:
# xfs_freeze -f /dev/sda1; xfs_freeze -f /dev/sda1; xfs_freeze -f /dev/sda1;
# xfs_freeze -u /dev/sda1; xfs_freeze -u /dev/sda1; xfs_freeze -u /dev/sda1;
And the filesystem will only be frozen once and thawed once. The second
and subsequent incantations of the freeze/thaw are effectively ignored
and don't block.
IMO, if we need to prevent certain operations from occurring when the
filesystem is frozen, those operations need to explicitly check the
frozen state and block i.e. do something like:
wait_event(sb->s_wait_unfrozen, (sb->s_frozen < SB_FREEZE_WRITE));
If you need to prevent unmounts from occurring while snapshotting a
frozen filesystem, then the snapshot code needs to take the s_umount
semaphore while the snapshot is in progress. We should not be making
frozen filesystems unmountable....
Thoughts?
Cheers,
Dave.
--
Dave Chinner
Principal Engineer
SGI Australian Software Group
-