Re: [PATCH] iomap: iomap_write_end cleanup

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

 



On Tue, May 03, 2022 at 11:37:27PM +0200, Andreas Gruenbacher wrote:
> In iomap_write_end(), only call iomap_write_failed() on the byte range
> that has failed.  This should improve code readability, but doesn't fix
> an actual bug because iomap_write_failed() is called after updating the
> file size here and it only affects the memory beyond the end of the
> file.

I can't find a way to set 'ret' to anything other than 0 or len.  I know
the code is written to make it look like we can return a short write,
but I can't see a way to do it.

> Signed-off-by: Andreas Gruenbacher <agruenba@xxxxxxxxxx>
> ---
>  fs/iomap/buffered-io.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
> index 358ee1fb6f0d..8fb9b2797fc5 100644
> --- a/fs/iomap/buffered-io.c
> +++ b/fs/iomap/buffered-io.c
> @@ -734,7 +734,7 @@ static size_t iomap_write_end(struct iomap_iter *iter, loff_t pos, size_t len,
>  	folio_put(folio);
>  
>  	if (ret < len)
> -		iomap_write_failed(iter->inode, pos, len);
> +		iomap_write_failed(iter->inode, pos + ret, len - ret);
>  	return ret;
>  }
>  
> -- 
> 2.35.1
> 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux