All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: pshilov@microsoft.com
Cc: stable@vger.kernel.org, stable-commits@vger.kernel.org
Subject: Re: Patch "CIFS: Fix splice read for non-cached files" has been added to the 4.4-stable tree
Date: Wed, 8 Mar 2017 15:17:29 +0100	[thread overview]
Message-ID: <20170308141729.GA3790@kroah.com> (raw)
In-Reply-To: <148896884212936@kroah.com>

On Wed, Mar 08, 2017 at 11:27:22AM +0100, gregkh@linuxfoundation.org wrote:
> 
> This is a note to let you know that I've just added the patch titled
> 
>     CIFS: Fix splice read for non-cached files
> 
> to the 4.4-stable tree which can be found at:
>     http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
> 
> The filename of the patch is:
>      cifs-fix-splice-read-for-non-cached-files.patch
> and it can be found in the queue-4.4 subdirectory.
> 
> If you, or anyone else, feels it should not be added to the stable tree,
> please let <stable@vger.kernel.org> know about it.

Oops, nope, this breaks the build on 4.4-stable.  If it belongs there,
please send a properly backported version to me.

thanks,

greg k-h


> >From 9c25702cee1405099f982894c865c163de7909a8 Mon Sep 17 00:00:00 2001
> From: Pavel Shilovsky <pshilov@microsoft.com>
> Date: Thu, 19 Jan 2017 13:53:15 -0800
> Subject: CIFS: Fix splice read for non-cached files
> 
> From: Pavel Shilovsky <pshilov@microsoft.com>
> 
> commit 9c25702cee1405099f982894c865c163de7909a8 upstream.
> 
> Currently we call copy_page_to_iter() for uncached reading into a pipe.
> This is wrong because it treats pages as VFS cache pages and copies references
> rather than actual data. When we are trying to read from the pipe we end up
> calling page_cache_pipe_buf_confirm() which returns -ENODATA. This error
> is translated into 0 which is returned to a user.
> 
> This issue is reproduced by running xfs-tests suite (generic test #249)
> against mount points with "cache=none". Fix it by mapping pages manually
> and calling copy_to_iter() that copies data into the pipe.
> 
> Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> ---
>  fs/cifs/file.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -2840,7 +2840,15 @@ cifs_readdata_to_iov(struct cifs_readdat
>  	for (i = 0; i < rdata->nr_pages; i++) {
>  		struct page *page = rdata->pages[i];
>  		size_t copy = min_t(size_t, remaining, PAGE_SIZE);
> -		size_t written = copy_page_to_iter(page, 0, copy, iter);
> +		size_t written;
> +
> +		if (unlikely(iter->type & ITER_PIPE)) {
> +			void *addr = kmap_atomic(page);
> +
> +			written = copy_to_iter(addr, copy, iter);
> +			kunmap_atomic(addr);
> +		} else
> +			written = copy_page_to_iter(page, 0, copy, iter);
>  		remaining -= written;
>  		if (written < copy && iov_iter_count(iter) > 0)
>  			break;
> 
> 
> Patches currently in stable-queue which might be from pshilov@microsoft.com are
> 
> queue-4.4/cifs-fix-splice-read-for-non-cached-files.patch

      reply	other threads:[~2017-03-08 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-08 10:27 Patch "CIFS: Fix splice read for non-cached files" has been added to the 4.4-stable tree gregkh
2017-03-08 14:17 ` Greg KH [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170308141729.GA3790@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=pshilov@microsoft.com \
    --cc=stable-commits@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.