diff options
author | Dave Chinner <dchinner@redhat.com> | 2012-11-12 11:09:45 (GMT) |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-11-17 15:35:42 (GMT) |
commit | 3daed8bc3e49b9695ae931b9f472b5b90d1965b3 (patch) | |
tree | f4e200fbc76f06450787bc0349b0eb65390b99d8 /fs/hostfs/Makefile | |
parent | 42e2976f131d65555d5c1d6c3d47facc63577814 (diff) | |
download | linux-3daed8bc3e49b9695ae931b9f472b5b90d1965b3.tar.xz |
xfs: fix broken error handling in xfs_vm_writepage
When we shut down the filesystem, it might first be detected in
writeback when we are allocating a inode size transaction. This
happens after we have moved all the pages into the writeback state
and unlocked them. Unfortunately, if we fail to set up the
transaction we then abort writeback and try to invalidate the
current page. This then triggers are BUG() in block_invalidatepage()
because we are trying to invalidate an unlocked page.
Fixing this is a bit of a chicken and egg problem - we can't
allocate the transaction until we've clustered all the pages into
the IO and we know the size of it (i.e. whether the last block of
the IO is beyond the current EOF or not). However, we don't want to
hold pages locked for long periods of time, especially while we lock
other pages to cluster them into the write.
To fix this, we need to make a clear delineation in writeback where
errors can only be handled by IO completion processing. That is,
once we have marked a page for writeback and unlocked it, we have to
report errors via IO completion because we've already started the
IO. We may not have submitted any IO, but we've changed the page
state to indicate that it is under IO so we must now use the IO
completion path to report errors.
To do this, add an error field to xfs_submit_ioend() to pass it the
error that occurred during the building on the ioend chain. When
this is non-zero, mark each ioend with the error and call
xfs_finish_ioend() directly rather than building bios. This will
immediately push the ioends through completion processing with the
error that has occurred.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Mark Tinguely <tinguely@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/hostfs/Makefile')
0 files changed, 0 insertions, 0 deletions