All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CIFS: Fix readpages retrying on reconnects
@ 2014-10-02 16:13 Pavel Shilovsky
       [not found] ` <1412266416-9172-1-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Shilovsky @ 2014-10-02 16:13 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA; +Cc: Pavel Shilovsky

From: Pavel Shilovsky <pshilovsky-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>

If we got a reconnect error from async readv we re-add pages back
to page_list and continue loop. That is wrong because these pages
have been already added to the pagecache but page_list has pages that
have not been added to the pagecache yet. This ends up with a general
protection fault in put_pages after readpages. Fix it by not retrying
the read of these pages and falling back to readpage instead.

Signed-off-by: Pavel Shilovsky <pshilovsky-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
---
 fs/cifs/file.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 7c018a1..5f29354 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3568,15 +3568,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
 				lru_cache_add_file(page);
 				unlock_page(page);
 				page_cache_release(page);
-				if (rc == -EAGAIN)
-					list_add_tail(&page->lru, &tmplist);
 			}
+			/* Fallback to the readpage in error/reconnect cases */
 			kref_put(&rdata->refcount, cifs_readdata_release);
-			if (rc == -EAGAIN) {
-				/* Re-add pages to the page_list and retry */
-				list_splice(&tmplist, page_list);
-				continue;
-			}
 			break;
 		}
 
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] CIFS: Fix readpages retrying on reconnects
  2014-10-02 16:13 [PATCH] CIFS: Fix readpages retrying on reconnects Pavel Shilovsky
@ 2014-10-02 19:24     ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2014-10-02 19:24 UTC (permalink / raw)
  To: Pavel Shilovsky
  Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA, Pavel Shilovsky, linux-fsdevel, LKML

Merged into cifs-2.6.git for-next (and for-linus)

I would like to get this and also
http://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=19e81573fca7b87ced7701e01ba164b968d929bd
upstream ASAP but timing is getting tight, will need to wait at least
a day for the normal linux-next build processes to complete and any
additional test results.

On Thu, Oct 2, 2014 at 11:13 AM, Pavel Shilovsky <piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org> wrote:
> From: Pavel Shilovsky <pshilovsky-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
>
> If we got a reconnect error from async readv we re-add pages back
> to page_list and continue loop. That is wrong because these pages
> have been already added to the pagecache but page_list has pages that
> have not been added to the pagecache yet. This ends up with a general
> protection fault in put_pages after readpages. Fix it by not retrying
> the read of these pages and falling back to readpage instead.
>
> Signed-off-by: Pavel Shilovsky <pshilovsky-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>
> ---
>  fs/cifs/file.c |    8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 7c018a1..5f29354 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -3568,15 +3568,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
>                                 lru_cache_add_file(page);
>                                 unlock_page(page);
>                                 page_cache_release(page);
> -                               if (rc == -EAGAIN)
> -                                       list_add_tail(&page->lru, &tmplist);
>                         }
> +                       /* Fallback to the readpage in error/reconnect cases */
>                         kref_put(&rdata->refcount, cifs_readdata_release);
> -                       if (rc == -EAGAIN) {
> -                               /* Re-add pages to the page_list and retry */
> -                               list_splice(&tmplist, page_list);
> -                               continue;
> -                       }
>                         break;
>                 }
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] CIFS: Fix readpages retrying on reconnects
@ 2014-10-02 19:24     ` Steve French
  0 siblings, 0 replies; 3+ messages in thread
From: Steve French @ 2014-10-02 19:24 UTC (permalink / raw)
  To: Pavel Shilovsky; +Cc: linux-cifs, Pavel Shilovsky, linux-fsdevel, LKML

Merged into cifs-2.6.git for-next (and for-linus)

I would like to get this and also
http://git.samba.org/?p=sfrench/cifs-2.6.git;a=commit;h=19e81573fca7b87ced7701e01ba164b968d929bd
upstream ASAP but timing is getting tight, will need to wait at least
a day for the normal linux-next build processes to complete and any
additional test results.

On Thu, Oct 2, 2014 at 11:13 AM, Pavel Shilovsky <piastry@etersoft.ru> wrote:
> From: Pavel Shilovsky <pshilovsky@samba.org>
>
> If we got a reconnect error from async readv we re-add pages back
> to page_list and continue loop. That is wrong because these pages
> have been already added to the pagecache but page_list has pages that
> have not been added to the pagecache yet. This ends up with a general
> protection fault in put_pages after readpages. Fix it by not retrying
> the read of these pages and falling back to readpage instead.
>
> Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org>
> ---
>  fs/cifs/file.c |    8 +-------
>  1 file changed, 1 insertion(+), 7 deletions(-)
>
> diff --git a/fs/cifs/file.c b/fs/cifs/file.c
> index 7c018a1..5f29354 100644
> --- a/fs/cifs/file.c
> +++ b/fs/cifs/file.c
> @@ -3568,15 +3568,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
>                                 lru_cache_add_file(page);
>                                 unlock_page(page);
>                                 page_cache_release(page);
> -                               if (rc == -EAGAIN)
> -                                       list_add_tail(&page->lru, &tmplist);
>                         }
> +                       /* Fallback to the readpage in error/reconnect cases */
>                         kref_put(&rdata->refcount, cifs_readdata_release);
> -                       if (rc == -EAGAIN) {
> -                               /* Re-add pages to the page_list and retry */
> -                               list_splice(&tmplist, page_list);
> -                               continue;
> -                       }
>                         break;
>                 }
>
> --
> 1.7.10.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Thanks,

Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-10-02 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-02 16:13 [PATCH] CIFS: Fix readpages retrying on reconnects Pavel Shilovsky
     [not found] ` <1412266416-9172-1-git-send-email-piastry-7qunaywFIewox3rIn2DAYQ@public.gmane.org>
2014-10-02 19:24   ` Steve French
2014-10-02 19:24     ` Steve French

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.