Re: [PATCH 1/2] target/file: fix backend if highmem is enabled.

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

 



On Wed, 2012-12-05 at 12:08 +0100, Sebastian Andrzej Siewior wrote:
> Since commit 8f9f44f ("tcm_loop: Convert I/O path to use
> target_submit_cmd_map_sgls") the file backend is broken if highmem is
> enabled. This patch uses kmap() so we get the proper memory.
> 

Changing the commit log here to drop the commit 8f9f44f reference, as I
still don't see how that change effects the underlying issue with
highmem.  ;)

> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
> ---

<SNIP>

Ahh yes, first patch was missing sg->offset.  Grrr, should have noticed
that myself..

Applied to for-next w/ a CC to stable.

Thanks for taking care of this one Sebastian !

--nab

> 
>  drivers/target/target_core_file.c |    9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c
> index 0360383..c639b42 100644
> --- a/drivers/target/target_core_file.c
> +++ b/drivers/target/target_core_file.c
> @@ -260,7 +260,7 @@ static int fd_do_readv(struct se_cmd *cmd, struct scatterlist *sgl,
>  
>  	for_each_sg(sgl, sg, sgl_nents, i) {
>  		iov[i].iov_len = sg->length;
> -		iov[i].iov_base = sg_virt(sg);
> +		iov[i].iov_base = kmap(sg_page(sg)) + sg->offset;
>  	}
>  
>  	old_fs = get_fs();
> @@ -268,6 +268,8 @@ static int fd_do_readv(struct se_cmd *cmd, struct scatterlist *sgl,
>  	ret = vfs_readv(fd, &iov[0], sgl_nents, &pos);
>  	set_fs(old_fs);
>  
> +	for_each_sg(sgl, sg, sgl_nents, i)
> +		kunmap(sg_page(sg));
>  	kfree(iov);
>  	/*
>  	 * Return zeros and GOOD status even if the READ did not return
> @@ -313,7 +315,7 @@ static int fd_do_writev(struct se_cmd *cmd, struct scatterlist *sgl,
>  
>  	for_each_sg(sgl, sg, sgl_nents, i) {
>  		iov[i].iov_len = sg->length;
> -		iov[i].iov_base = sg_virt(sg);
> +		iov[i].iov_base = kmap(sg_page(sg)) + sg->offset;
>  	}
>  
>  	old_fs = get_fs();
> @@ -321,6 +323,9 @@ static int fd_do_writev(struct se_cmd *cmd, struct scatterlist *sgl,
>  	ret = vfs_writev(fd, &iov[0], sgl_nents, &pos);
>  	set_fs(old_fs);
>  
> +	for_each_sg(sgl, sg, sgl_nents, i)
> +		kunmap(sg_page(sg));
> +
>  	kfree(iov);
>  
>  	if (ret < 0 || ret != cmd->data_length) {


--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux