From: Darrick J. Wong Date: Tue, 5 Dec 2017 00:18:30 +0000 (-0800) Subject: xfs: fix and streamline error handling in xfs_end_io X-Git-Tag: v4.1.12-124.31.3~870 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=b6175ff1fc4474e972df7f3e4d96698a982eb05c;p=users%2Fjedix%2Flinux-maple.git xfs: fix and streamline error handling in xfs_end_io [ Upstream commit 787eb485509f9d58962bd8b4dbc6a5ac6e2034fe ] There are two different cases of buffered I/O errors: - first we can have an already shutdown fs. In that case we should skip any on-disk operations and just clean up the appen transaction if present and destroy the ioend - a real I/O error. In that case we should cleanup any lingering COW blocks. This gets skipped in the current code and is fixed by this patch. Orabug: 27609404 Originally-Signed-off-by: Christoph Hellwig [darrick: heavily modified since we don't support cow in uek4...] Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Reviewed-by: wen.gang.wang@oracle.com Reviewed-by: Allison Henderson --- diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 939abbee0b6c..37e855c1342f 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c @@ -237,15 +237,13 @@ xfs_end_io( goto done; error = xfs_iomap_write_unwritten(ip, ioend->io_offset, ioend->io_size); - } else if (ioend->io_append_trans) { - error = xfs_setfilesize_ioend(ioend); - } else { - ASSERT(!xfs_ioend_is_append(ioend)); } done: if (error) ioend->io_error = error; + if (ioend->io_append_trans) + xfs_setfilesize_ioend(ioend); xfs_destroy_ioend(ioend); }