]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
libxfs: don't discard dirty buffers
authorDave Chinner <dchinner@redhat.com>
Tue, 9 Feb 2016 00:13:25 +0000 (11:13 +1100)
committerDave Chinner <david@fromorbit.com>
Tue, 9 Feb 2016 00:13:25 +0000 (11:13 +1100)
commit0a7942b3821527fd5d643615a6ece510de9a3117
treedcda769f41bd550907e0bbe23762dd463ad97e6f
parent4280e59dcbc4cd8e01585efe788a68eb378048e8
libxfs: don't discard dirty buffers

When we release a buffer from the cache, if it is dirty we wite it
to disk then put the buffer on the free list for recycling. However,
if the write fails (e.g. verifier failure due unfixed corruption) we
effectively throw the buffer and it contents away. This causes all
sorts of problems for xfs_repair as it then re-reads the buffer from
disk on the next access and hence loses all the corrections that had
previously been made, resulting in tripping over corruptions in code
that assumes the corruptions have already been fixed/flagged in the
buffer it receives.

TO fix this, we have to make the cache aware that writes can fail,
and keep the buffer in cache when writes fail. Hence we have to add
an explicit error notification to the flush operation, and we need
to do that before we release the buffer to the free list. This also
means that we need to remove the writeback code from the release
mechanisms, instead replacing them with assertions that the buffers
are already clean.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Dave Chinner <david@fromorbit.com>
include/cache.h
libxfs/cache.c
libxfs/rdwr.c