All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] cifs: bugfix for unreclaimed writeback pages in cifs_writev_requeue()
Date: Fri, 1 Mar 2013 18:57:50 -0500	[thread overview]
Message-ID: <20130301185750.66a139ca@tlielax.poochiereds.net> (raw)
In-Reply-To: <CAKywueRidM=aOdnxVsA3r0q33R7QnG1W87Eio6KiFOvTQB-ESQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Fri, 1 Mar 2013 22:08:04 +0400
Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> 2013/2/6 Pavel Shilovsky <piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:
> >> diff -uprN linux-3.8-rc6/fs/cifs/cifssmb.c linux-3.8-rc6_new/fs/cifs/cifssmb.c
> >> --- linux-3.8-rc6/fs/cifs/cifssmb.c        2013-02-01 09:08:14.000000000 +0800
> >> +++ linux-3.8-rc6_new/fs/cifs/cifssmb.c        2013-02-04
> >> 15:44:09.869254397 +0800
> >> @@ -1909,8 +1909,11 @@ cifs_writev_requeue(struct cifs_writedat
> >>          } while (rc == -EAGAIN);
> >>
> >>          for (i = 0; i < wdata->nr_pages; i++) {
> >> -                if (rc != 0)
> >> +                if (rc != 0){
> >>                          SetPageError(wdata->pages[i]);
> >> +                         end_page_writeback(wdata->pages[i]);
> >> +                         page_cache_release(wdata->pages[i]);
> >> +                 }
> >
> > I think we should do end_page_writeback(wdata->pages[i]) and
> > page_cache_release(wdata->pages[i]) regardless whether rc is 0 or not
> > (we are doing the same things in cifs_writev_complete now). Thoughts?
> >
> >>                  unlock_page(wdata->pages[i]);
> >>          }
> >>
> 
> Jeff, what do you think about my comments to this patch
> (http://git.samba.org/?p=sfrench/cifs-2.6.git;a=commitdiff;h=c51bb0ea40ca038da26b1fa7d450f4078124af03)
> ? It doesn't clear to me why we should call
> end_page_writeback(wdata->pages[i]) and
> page_cache_release(wdata->pages[i]) in rc != 0 case only...
> 

It's a good question, so I'll go ahead and cc the mailing list since
there's no need to keep this private:

----------------[snip]---------------
        do {
                server = tlink_tcon(wdata->cfile->tlink)->ses->server;
                rc = server->ops->async_writev(wdata);
        } while (rc == -EAGAIN);

        for (i = 0; i < wdata->nr_pages; i++) {
                if (rc != 0)
                        SetPageError(wdata->pages[i]);
                unlock_page(wdata->pages[i]);
        }
----------------[snip]---------------

rc != 0 there means that resending the write failed with a
non-retryable error. In that case, we need to end the writeback on it
and release the reference we hold on it since the code is "finished"
with the page at that point. We don't expect a reply from the server,
so we need to make sure we clean up properly here.

If rc == 0 however, then there is now a new write request in progress.
The normal async reply handling will take care of it at that point. So
we need to continue to hold on to the page reference, and the writeback
bit still needs to stay set.

-- 
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

  parent reply	other threads:[~2013-03-01 23:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <OF08391DB5.0DFF1FA3-ON48257B0A.002333BE-48257B0A.002372B2@zte.com.cn>
     [not found] ` <OF08391DB5.0DFF1FA3-ON48257B0A.002333BE-48257B0A.002372B2-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
2013-02-06 18:00   ` Fwd: [PATCH] cifs: bugfix for unreclaimed writeback pages in cifs_writev_requeue() Steve French
     [not found]     ` <CAH2r5muZL8voikW6NO_KojjV=N9zVymsqcR_KMf=XgZ4v8oGgQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-02-06 18:26       ` Pavel Shilovsky
     [not found]         ` <OFA5D50D9D.206122F1-ON48257B0B.00139BCC-48257B0B.002214B3@zte.com.cn>
     [not found]           ` <OFA5D50D9D.206122F1-ON48257B0B.00139BCC-48257B0B.002214B3-Th6q7B73Y6EnDS1+zs4M5A@public.gmane.org>
2013-02-07  7:27             ` Pavel Shilovsky
     [not found]         ` <CAKywueRidM=aOdnxVsA3r0q33R7QnG1W87Eio6KiFOvTQB-ESQ@mail.gmail.com>
     [not found]           ` <CAKywueRidM=aOdnxVsA3r0q33R7QnG1W87Eio6KiFOvTQB-ESQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-01 23:57             ` Jeff Layton [this message]
     [not found]               ` <20130301185750.66a139ca-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-03-02  5:53                 ` Pavel Shilovsky
2013-02-07 11:39       ` Jeff Layton
     [not found]         ` <20130207063957.520a40c2-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2013-02-18 16:59           ` Steve French

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=20130301185750.66a139ca@tlielax.poochiereds.net \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=piastryyy-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.