* Request 5c6863019e45 ("cancel the setfilesize transation when io error happen") for 3.12 stable inclusion
@ 2017-03-23 15:19 Nikolay Borisov
2017-03-24 10:31 ` Christoph Hellwig
2017-03-27 8:15 ` Jiri Slaby
0 siblings, 2 replies; 3+ messages in thread
From: Nikolay Borisov @ 2017-03-23 15:19 UTC (permalink / raw)
To: stable; +Cc: linux-xfs, darrick.wong, bfoster, david
[-- Attachment #1: Type: text/plain, Size: 220 bytes --]
Hello,
I'd like to request the above patch be included into the 3.12 stable
tree. I've attached a backport and have run xfstest and no regressions
were observed. This fixes hang in generic/361 test.
Regards,
Nikolay
[-- Attachment #2: 0001-cancel-the-setfilesize-transation-when-io-error-happ.patch --]
[-- Type: text/x-patch, Size: 2471 bytes --]
>From 5c6863019e453bee3ac6dbdf1fbf0d9125942c3b Mon Sep 17 00:00:00 2001
From: Zhaohongjiang <zhaohongjiang@huawei.com>
Date: Mon, 12 Oct 2015 15:28:39 +1100
Subject: [PATCH] cancel the setfilesize transation when io error happen
When I ran xfstest/073 case, the remount process was blocked to wait
transactions to be zero. I found there was a io error happened, and
the setfilesize transaction was not released properly. We should add
the changes to cancel the io error in this case.
Reproduction steps:
1. dd if=/dev/zero of=xfs1.img bs=1M count=2048
2. mkfs.xfs xfs1.img
3. losetup -f ./xfs1.img /dev/loop0
4. mount -t xfs /dev/loop0 /home/test_dir/
5. mkdir /home/test_dir/test
6. mkfs.xfs -dfile,name=image,size=2g
7. mount -t xfs -o loop image /home/test_dir/test
8. cp a file bigger than 2g to /home/test_dir/test
9. mount -t xfs -o remount,ro /home/test_dir/test
[ dchinner: moved io error detection to xfs_setfilesize_ioend() after
transaction context restoration. ]
[ nborisov: Adjusted context for 3.12 ]
Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
fs/xfs/xfs_aops.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index ab28ad576b16..6394e3f51553 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -150,6 +150,12 @@ xfs_setfilesize(
rwsem_acquire_read(&VFS_I(ip)->i_sb->s_writers.lock_map[SB_FREEZE_FS-1],
0, 1, _THIS_IP_);
+ /* we abort the update if there was an IO error */
+ if (ioend->io_error) {
+ xfs_trans_cancel(tp, 0);
+ return ioend->io_error;
+ }
+
xfs_ilock(ip, XFS_ILOCK_EXCL);
isize = xfs_new_eof(ip, ioend->io_offset + ioend->io_size);
if (!isize) {
@@ -205,14 +211,17 @@ xfs_end_io(
ioend->io_error = -EIO;
goto done;
}
- if (ioend->io_error)
- goto done;
/*
* For unwritten extents we need to issue transactions to convert a
* range to normal written extens after the data I/O has finished.
+ * Detecting and handling completion IO errors is done individually
+ * for each case as different cleanup operations need to be performed
+ * on error.
*/
if (ioend->io_type == XFS_IO_UNWRITTEN) {
+ if (ioend->io_error)
+ goto done;
error = xfs_iomap_write_unwritten(ip, ioend->io_offset,
ioend->io_size);
} else if (ioend->io_isdirect && xfs_ioend_is_append(ioend)) {
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Request 5c6863019e45 ("cancel the setfilesize transation when io error happen") for 3.12 stable inclusion
2017-03-23 15:19 Request 5c6863019e45 ("cancel the setfilesize transation when io error happen") for 3.12 stable inclusion Nikolay Borisov
@ 2017-03-24 10:31 ` Christoph Hellwig
2017-03-27 8:15 ` Jiri Slaby
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2017-03-24 10:31 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: stable, linux-xfs, darrick.wong, bfoster, david
On Thu, Mar 23, 2017 at 05:19:56PM +0200, Nikolay Borisov wrote:
> Hello,
>
>
> I'd like to request the above patch be included into the 3.12 stable
> tree. I've attached a backport and have run xfstest and no regressions
> were observed. This fixes hang in generic/361 test.
The backport looks fine to me:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Request 5c6863019e45 ("cancel the setfilesize transation when io error happen") for 3.12 stable inclusion
2017-03-23 15:19 Request 5c6863019e45 ("cancel the setfilesize transation when io error happen") for 3.12 stable inclusion Nikolay Borisov
2017-03-24 10:31 ` Christoph Hellwig
@ 2017-03-27 8:15 ` Jiri Slaby
1 sibling, 0 replies; 3+ messages in thread
From: Jiri Slaby @ 2017-03-27 8:15 UTC (permalink / raw)
To: Nikolay Borisov, stable; +Cc: linux-xfs, darrick.wong, bfoster, david
On 03/23/2017, 04:19 PM, Nikolay Borisov wrote:
> Hello,
>
>
> I'd like to request the above patch be included into the 3.12 stable
> tree. I've attached a backport and have run xfstest and no regressions
> were observed. This fixes hang in generic/361 test.
So this is actually 5cb13dcd0fac071b45c4bebe1801a08ff0d89cad, not
5c6863019e45, right? Applied as the former. Thanks.
> 0001-cancel-the-setfilesize-transation-when-io-error-happ.patch
>
>
> From 5c6863019e453bee3ac6dbdf1fbf0d9125942c3b Mon Sep 17 00:00:00 2001
> From: Zhaohongjiang <zhaohongjiang@huawei.com>
> Date: Mon, 12 Oct 2015 15:28:39 +1100
> Subject: [PATCH] cancel the setfilesize transation when io error happen
>
> When I ran xfstest/073 case, the remount process was blocked to wait
> transactions to be zero. I found there was a io error happened, and
> the setfilesize transaction was not released properly. We should add
> the changes to cancel the io error in this case.
>
> Reproduction steps:
> 1. dd if=/dev/zero of=xfs1.img bs=1M count=2048
> 2. mkfs.xfs xfs1.img
> 3. losetup -f ./xfs1.img /dev/loop0
> 4. mount -t xfs /dev/loop0 /home/test_dir/
> 5. mkdir /home/test_dir/test
> 6. mkfs.xfs -dfile,name=image,size=2g
> 7. mount -t xfs -o loop image /home/test_dir/test
> 8. cp a file bigger than 2g to /home/test_dir/test
> 9. mount -t xfs -o remount,ro /home/test_dir/test
>
> [ dchinner: moved io error detection to xfs_setfilesize_ioend() after
> transaction context restoration. ]
>
> [ nborisov: Adjusted context for 3.12 ]
>
> Signed-off-by: Zhao Hongjiang <zhaohongjiang@huawei.com>
> Signed-off-by: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/xfs/xfs_aops.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
> index ab28ad576b16..6394e3f51553 100644
> --- a/fs/xfs/xfs_aops.c
> +++ b/fs/xfs/xfs_aops.c
> @@ -150,6 +150,12 @@ xfs_setfilesize(
> rwsem_acquire_read(&VFS_I(ip)->i_sb->s_writers.lock_map[SB_FREEZE_FS-1],
> 0, 1, _THIS_IP_);
>
> + /* we abort the update if there was an IO error */
> + if (ioend->io_error) {
> + xfs_trans_cancel(tp, 0);
> + return ioend->io_error;
> + }
> +
> xfs_ilock(ip, XFS_ILOCK_EXCL);
> isize = xfs_new_eof(ip, ioend->io_offset + ioend->io_size);
> if (!isize) {
> @@ -205,14 +211,17 @@ xfs_end_io(
> ioend->io_error = -EIO;
> goto done;
> }
> - if (ioend->io_error)
> - goto done;
>
> /*
> * For unwritten extents we need to issue transactions to convert a
> * range to normal written extens after the data I/O has finished.
> + * Detecting and handling completion IO errors is done individually
> + * for each case as different cleanup operations need to be performed
> + * on error.
> */
> if (ioend->io_type == XFS_IO_UNWRITTEN) {
> + if (ioend->io_error)
> + goto done;
> error = xfs_iomap_write_unwritten(ip, ioend->io_offset,
> ioend->io_size);
> } else if (ioend->io_isdirect && xfs_ioend_is_append(ioend)) {
> -- 2.7.4
>
--
js
suse labs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-27 8:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-23 15:19 Request 5c6863019e45 ("cancel the setfilesize transation when io error happen") for 3.12 stable inclusion Nikolay Borisov
2017-03-24 10:31 ` Christoph Hellwig
2017-03-27 8:15 ` Jiri Slaby
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.