]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
xfs_db: flush devices before exiting
authorDave Chinner <dchinner@redhat.com>
Fri, 9 Nov 2012 07:02:57 +0000 (07:02 +0000)
committerMark Tinguely <tinguely@eagdhcp-232-125.americas.sgi.com>
Tue, 20 Nov 2012 23:06:19 +0000 (17:06 -0600)
commit1adfff6fb6450277a68d3b3aebde814ebdffac6f
treed3333a33353f26b0e9f018fd9e902fd5926aabcc
parentb5a08fe31f780b19170b0a82d2493bdf0cbf0ad8
xfs_db: flush devices before exiting

Test 287 uses xfs_db to change 32-bit project ID support while the
filesystem is unmounted. On a large filesystem the test was failing
due to the mount not seeing the feature bit in the superblock.

xfs_db uses a different address space to the filesystem when it is
mounte dby the kernel, so the only way to keep them coherent is to
ensure that all buffered data is written to disk before the other
entity tries to read it. xfs_db uses buffered IO, but does not close
the devices when it exits, thereby leaving changes it has written in
the block device cache rather than on disk. Hence when th ekernel
tries to mount the filesystem, it reads what is on disk and does not
see xfs_db's changes.

Fix this by ensuring that xfs_db flushes it's changes to disk before
it exits by caling libxfs_device_close(). This fsyncs the data and
flushes the caches to ensure that it is present on disk before
xfs_db exits.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Mark Tinguely <tinguely@sgi.com>
db/init.c