All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 2/5] cifs: add cifs_async_readv
Date: Wed, 19 Oct 2011 14:01:48 +0400	[thread overview]
Message-ID: <CAKywueR=sXusGdOuAvJHTk1FGURHuDXjj6gz4iJRYeu=Zgkfpg@mail.gmail.com> (raw)
In-Reply-To: <1318336527-13648-3-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

2011/10/11 Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>:
...
> +
> +static void
> +cifs_readv_complete(struct work_struct *work)
> +{
> +       struct cifs_readdata *rdata = container_of(work,
> +                                               struct cifs_readdata, work);
> +       struct page *page, *tpage;
> +
> +       list_for_each_entry_safe(page, tpage, &rdata->pages, lru) {
> +               list_del(&page->lru);
> +               lru_cache_add_file(page);
> +
> +               if (rdata->result == 0) {
> +                       kunmap(page);
> +                       flush_dcache_page(page);
> +                       SetPageUptodate(page);
> +                       unlock_page(page);
> +                       cifs_readpage_to_fscache(rdata->mapping->host, page);
> +               }

It seems that we should to kunmap and unlock_page for error case too.
This change works to me (applied on top of this patch):

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 99ab419..a0e23d6 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -1619,15 +1619,18 @@ cifs_readv_complete(struct work_struct *work)
        list_for_each_entry_safe(page, tpage, &rdata->pages, lru) {
                list_del(&page->lru);
                lru_cache_add_file(page);
+               kunmap(page);

                if (rdata->result == 0) {
-                       kunmap(page);
                        flush_dcache_page(page);
                        SetPageUptodate(page);
-                       unlock_page(page);
-                       cifs_readpage_to_fscache(rdata->mapping->host, page);
                }

+               unlock_page(page);
+
+               if (rdata->result == 0)
+                       cifs_readpage_to_fscache(rdata->mapping->host, page);
+
                page_cache_release(page);
        }
        cifs_readdata_free(rdata);

> +
> +               page_cache_release(page);
> +       }
> +       cifs_readdata_free(rdata);
> +}
> +

-- 
Best regards,
Pavel Shilovsky.

  parent reply	other threads:[~2011-10-19 10:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 12:35 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #6) Jeff Layton
     [not found] ` <1318336527-13648-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-11 12:35   ` [PATCH 1/5] cifs: fix protocol definition for READ_RSP Jeff Layton
2011-10-11 12:35   ` [PATCH 2/5] cifs: add cifs_async_readv Jeff Layton
     [not found]     ` <1318336527-13648-3-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-19 10:01       ` Pavel Shilovsky [this message]
     [not found]         ` <CAKywueR=sXusGdOuAvJHTk1FGURHuDXjj6gz4iJRYeu=Zgkfpg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-19 10:59           ` Jeff Layton
2011-10-11 12:35   ` [PATCH 3/5] cifs: convert cifs_readpages to use async reads Jeff Layton
2011-10-11 12:35   ` [PATCH 4/5] cifs: allow for larger rsize= options and change defaults Jeff Layton
     [not found]     ` <1318336527-13648-5-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-12 12:22       ` Pavel Shilovsky
     [not found]         ` <CAKywueRHKSrYLmebgSvcfOrrZ=jRC8ELL+Vt0j91orHMLtUVvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-12 12:31           ` Jeff Layton
2011-10-11 12:35   ` [PATCH 5/5] cifs: tune bdi.ra_pages in accordance with the rsize Jeff Layton
  -- strict thread matches above, loose matches on Subject: below --
2011-10-19 13:24 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #7) Jeff Layton
     [not found] ` <1319030695-4115-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-19 13:24   ` [PATCH 2/5] cifs: add cifs_async_readv Jeff Layton
2011-09-06 14:27 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #5) Jeff Layton
     [not found] ` <1315319241-21637-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-09-06 14:27   ` [PATCH 2/5] cifs: add cifs_async_readv Jeff Layton
     [not found]     ` <1315319241-21637-3-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-10-11  9:30       ` Pavel Shilovsky
     [not found]         ` <CAKywueRSTX8BT3BJymT+PdCEkVbzCEd+mV=UZa0e3-PZLej7qw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-10-11 10:26           ` Jeff Layton
     [not found]             ` <20111011062617.25376724-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2011-10-11 10:51               ` Pavel Shilovsky
2011-09-01 21:29 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #4) Jeff Layton
     [not found] ` <1314912588-20435-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-09-01 21:29   ` [PATCH 2/5] cifs: add cifs_async_readv Jeff Layton
2011-08-30 14:46 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously (try #3) Jeff Layton
     [not found] ` <1314715574-23431-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-08-30 14:46   ` [PATCH 2/5] cifs: add cifs_async_readv Jeff Layton
2011-08-26 19:18 [PATCH 0/5] cifs: allow cifs to do readpages larger and asynchronously Jeff Layton
     [not found] ` <1314386298-27424-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2011-08-26 19:18   ` [PATCH 2/5] cifs: add cifs_async_readv Jeff Layton

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='CAKywueR=sXusGdOuAvJHTk1FGURHuDXjj6gz4iJRYeu=Zgkfpg@mail.gmail.com' \
    --to=piastryyy-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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.