xfs: don't hold onto reserved blocks on remount, ro
commit83b546b83752bd43cfc26458709d48293956a3c8
authorDave Chinner <david@fromorbit.com>
Thu, 11 Mar 2010 22:42:14 +0000 (12 09:42 +1100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Apr 2010 14:41:16 +0000 (26 07:41 -0700)
tree59849dbe1974399f740bbe18b825abfd1ec3d826
parent1b8e6dfb4997f2950cf6720f5b7a434a04ee80f0
xfs: don't hold onto reserved blocks on remount, ro

commit cbe132a8bdcff0f9afd9060948fb50597c7400b8 upstream

If we hold onto reserved blocks when doing a remount,ro we end
up writing the blocks used count to disk that includes the reserved
blocks. Reserved blocks are not actually used, so this results in
the values in the superblock being incorrect.

Hence if we run xfs_check or xfs_repair -n while the filesystem is
mounted remount,ro we end up with an inconsistent filesystem being
reported. Also, running xfs_copy on the remount,ro filesystem will
result in an inconsistent image being generated.

To fix this, unreserve the blocks when doing the remount,ro, and
reserved them again on remount,rw. This way a remount,ro filesystem
will appear consistent on disk to all utilities.

Signed-off-by: Dave Chinner <david@fromorbit.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/xfs/linux-2.6/xfs_super.c
fs/xfs/xfs_mount.h