lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210726134138.GE20621@quack2.suse.cz>
Date:   Mon, 26 Jul 2021 15:41:38 +0200
From:   Jan Kara <jack@...e.cz>
To:     Christoph Hellwig <hch@....de>
Cc:     Jan Kara <jack@...e.com>,
        Mikulas Patocka <mikulas@...ax.karlin.mff.cuni.cz>,
        linux-ext4@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH 2/4] ext2: use iomap_fiemap to implement ->fiemap

On Tue 20-07-21 15:33:39, Christoph Hellwig wrote:
> Switch from generic_block_fiemap to use the iomap version.  The only
> interesting part is that ext2_get_blocks gets confused when being
> asked for overly long ranges, so copy over the limit to the inode
> size from generic_block_fiemap into ext2_fiemap.
> 
> Signed-off-by: Christoph Hellwig <hch@....de>

Looks good. I'm a bit wondering about the problem with long ranges... I
guess these are larger than s_maxbytes, aren't they? Anyway the solution
you've picked makes sense to me. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.cz>

								Honza

> ---
>  fs/ext2/inode.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext2/inode.c b/fs/ext2/inode.c
> index 3e9a04770f49..04f0def0f5eb 100644
> --- a/fs/ext2/inode.c
> +++ b/fs/ext2/inode.c
> @@ -855,8 +855,14 @@ const struct iomap_ops ext2_iomap_ops = {
>  int ext2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
>  		u64 start, u64 len)
>  {
> -	return generic_block_fiemap(inode, fieinfo, start, len,
> -				    ext2_get_block);
> +	int ret;
> +
> +	inode_lock(inode);
> +	len = min_t(u64, len, i_size_read(inode));
> +	ret = iomap_fiemap(inode, fieinfo, start, len, &ext2_iomap_ops);
> +	inode_unlock(inode);
> +
> +	return ret;
>  }
>  
>  static int ext2_writepage(struct page *page, struct writeback_control *wbc)
> -- 
> 2.30.2
> 
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ