Re: [PATCH] Btrfs: fix compressed write corruption on enospc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Donnerstag, 24. Juli 2014, 22:48:05 schrieben Sie:
> When failing to allocate space for the whole compressed extent, we'll
> fallback to uncompressed IO, but we've forgotten to redirty the pages
> which belong to this compressed extent, and these 'clean' pages will
> simply skip 'submit' part and go to endio directly, at last we got data
> corruption as we write nothing.
> 
> Signed-off-by: Liu Bo <bo.li.liu@xxxxxxxxxx>
> ---
>  fs/btrfs/inode.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
> 
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 3668048..8ea7610 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -709,6 +709,18 @@ retry:
>  				unlock_extent(io_tree, async_extent->start,
>  					      async_extent->start +
>  					      async_extent->ram_size - 1);
> +
> +				/*
> +				 * we need to redirty the pages if we decide to
> +				 * fallback to uncompressed IO, otherwise we
> +				 * will not submit these pages down to lower
> +				 * layers.
> +				 */
> +				extent_range_redirty_for_io(inode,
> +						async_extent->start,
> +						async_extent->start +
> +						async_extent->ram_size - 1);
> +
>  				goto retry;
>  			}
>  			goto out_free;

I am testing this currently. So far no lockup. Lets see. Still has not filled 
the the block device with trees completely after I balanced them:

Label: 'home'  uuid: […]
        Total devices 2 FS bytes used 125.57GiB
        devid    1 size 160.00GiB used 153.00GiB path /dev/dm-0
        devid    2 size 160.00GiB used 153.00GiB path /dev/mapper/sata-home

I believe the lockups happen more easily if the trees occupy all of disk 
space. Well I will do some compiling of some KDE components which may let 
BTRFS fill all space again.

This patch will mean it when it can´t make enough free space in the 
(fragmented) tree it will write uncompressed?

This would mean that one would have a defragment trees regularily to allow for 
writes to happen compressed at all times.

Well… of course still better than lockup or corruption.

Ciao,
-- 
Martin 'Helios' Steigerwald - http://www.Lichtvoll.de
GPG: 03B0 0D6C 0040 0710 4AFA  B82F 991B EAAC A599 84C7
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux