Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Suresh Jayaraman <sjayaraman-IBi9RG/b67k@public.gmane.org>,
	linux-cifs <linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [RFC] [PATCH] cifs: retry kernel_sendmsg only in case of -EAGAIN
Date: Mon, 1 Oct 2012 21:50:30 -0400	[thread overview]
Message-ID: <20121001215030.5487c930@corrin.poochiereds.net> (raw)
In-Reply-To: <CAH2r5msunor+xKU5tjgyuD+y3Qfist8kAHze7DwcC0SkAOe5tg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Mon, 1 Oct 2012 20:46:01 -0500
Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

> How can we be certain that ENOSPC is no longer returned? When it was
> returned then the obvious thing was to block briefly and retry.
> 
> Does it do any harm?
> 

Can you explain the situation that caused it to return -ENOSPC in the
first place? Why that and not -EAGAIN? Or -ENOBUFS?

> On Mon, Oct 1, 2012 at 8:40 PM, Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > On Mon, 01 Oct 2012 13:10:45 +0530
> > Suresh Jayaraman <sjayaraman-IBi9RG/b67k@public.gmane.org> wrote:
> >
> >> In smb_sendv(), we seem to retry if kernel_sendmsg() returned either
> >> -ENOSPC or -EAGAIN. In either case after multiple attempts, we set the
> >> error to -EAGAIN before breaking out of the loop.
> >>
> >> First, it is not clear to me when kernel_sendmsg() can return -ENOSPC,
> >> and what it would mean and why should we retry. It makes me wonder
> >> whether this check is part of some old code. Also, there seem to be no
> >> need to set the error back to -EAGAIN before we break out the loop.
> >> Fix this by making cifs retry only if kernel_sendmsg() returns -EAGAIN.
> >>
> >> If the above discussion make sense, here is a patch to fix this.
> >> ---
> >>
> >> Retry kernel_sendmsg() only in case of -EAGAIN and remove redundant
> >> error assignment.
> >>
> >>
> >> Signed-off-by: Suresh Jayaraman <sjayaraman-IBi9RG/b67k@public.gmane.org>
> >> ---
> >> diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
> >> index d9b639b..a33db4c 100644
> >> --- a/fs/cifs/transport.c
> >> +++ b/fs/cifs/transport.c
> >> @@ -154,7 +154,7 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
> >>       while (total_len) {
> >>               rc = kernel_sendmsg(ssocket, &smb_msg, &iov[first_vec],
> >>                                   n_vec - first_vec, total_len);
> >> -             if ((rc == -ENOSPC) || (rc == -EAGAIN)) {
> >> +             if (rc == -EAGAIN) {
> >>                       i++;
> >>                       /*
> >>                        * If blocking send we try 3 times, since each can block
> >> @@ -177,7 +177,6 @@ smb_sendv(struct TCP_Server_Info *server, struct kvec *iov, int n_vec)
> >>                       if ((i >= 14) || (!server->noblocksnd && (i > 2))) {
> >>                               cERROR(1, "sends on sock %p stuck for 15 seconds",
> >>                                   ssocket);
> >> -                             rc = -EAGAIN;
> >>                               break;
> >>                       }
> >>                       msleep(1 << i);
> >> --
> >> 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
> >
> > That ENOSPC has been there a long time, and I think you're correct that
> > it's of questionable value.
> >
> > Acked-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> 
> 
> 


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

  parent reply	other threads:[~2012-10-02  1:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-01  7:40 [RFC] [PATCH] cifs: retry kernel_sendmsg only in case of -EAGAIN Suresh Jayaraman
     [not found] ` <506948FD.3090602-IBi9RG/b67k@public.gmane.org>
2012-10-02  1:40   ` Jeff Layton
     [not found]     ` <20121001214017.60f41311-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2012-10-02  1:46       ` Steve French
     [not found]         ` <CAH2r5msunor+xKU5tjgyuD+y3Qfist8kAHze7DwcC0SkAOe5tg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-02  1:50           ` Jeff Layton [this message]
     [not found]             ` <20121001215030.5487c930-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2012-10-02 10:22               ` Suresh Jayaraman
     [not found]                 ` <506AC06A.1030009-IBi9RG/b67k@public.gmane.org>
2012-10-02 11:12                   ` Jeff Layton
     [not found]                     ` <20121002071229.2b406a40-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2012-10-02 16:08                       ` 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=20121001215030.5487c930@corrin.poochiereds.net \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sjayaraman-IBi9RG/b67k@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox