linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: "J. Bruce Fields" <bfields@redhat.com>,
	linux-nfs@vger.kernel.org,
	Menyhart Zoltan <Zoltan.Menyhart@bull.net>
Subject: Re: [PATCH 4/4] svcrpc: svc_tcp_sendto XTP_DEAD check is redundant
Date: Tue, 26 Oct 2010 10:23:38 +1100	[thread overview]
Message-ID: <20101026102338.25167800@notabene> (raw)
In-Reply-To: <20101025150308.GB3233@fieldses.org>

On Mon, 25 Oct 2010 11:03:08 -0400
"J. Bruce Fields" <bfields@fieldses.org> wrote:

> On Mon, Oct 25, 2010 at 01:10:24PM +1100, Neil Brown wrote:
> > On Sun, 24 Oct 2010 21:21:33 -0400
> > "J. Bruce Fields" <bfields@redhat.com> wrote:
> > 
> > > The only caller (svc_send) has already checked XPT_DEAD.
> > > 
> > > Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> > > ---
> > >  net/sunrpc/svcsock.c |    3 ---
> > >  1 files changed, 0 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
> > > index 1454739..07919e1 100644
> > > --- a/net/sunrpc/svcsock.c
> > > +++ b/net/sunrpc/svcsock.c
> > > @@ -1135,9 +1135,6 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp)
> > >  	reclen = htonl(0x80000000|((xbufp->len ) - 4));
> > >  	memcpy(xbufp->head[0].iov_base, &reclen, 4);
> > >  
> > > -	if (test_bit(XPT_DEAD, &rqstp->rq_xprt->xpt_flags))
> > > -		return -ENOTCONN;
> > > -
> > >  	sent = svc_sendto(rqstp, &rqstp->rq_res);
> > >  	if (sent != xbufp->len) {
> > >  		printk(KERN_NOTICE
> > 
> > 
> > So after removing all these references to XPT_DEAD, do we need XPT_DEAD at
> > all???
> > 
> > I think it is only used in two other places.
> > 
> > 1/ In svc_revisit we don't queue the deferred request to an XPT_DEAD
> >   transport.
> >   We could avoid that but changing the 'owner' of a deferred request from the
> >   service to the xprt, and call cache_clean_deferred in svc_delete_xprt
> 
> That use does seem a bit of a hack to me, so I'd be happy to get rid of
> it.
> 
> > 2/ in svc_send().  I wonder if we need this at all.  There doesn't seem to be
> > any locking to ensure that XPT_DEAD doesn't get set immediately after the
> > test, and the underlying sendto (whether tcp or udp or whatever) should fail
> > if the socket is closed, and if it doesn't it shouldn't really matter??
> 
> Does it make a difference in the case of a half-close?  If the client
> follows a request immediately by a FIN, and if that results in our
> setting DEAD (I think it does, assuming svc_tcp_state_change() is called
> in that case), then the current code may have the effect of preventing
> us from sending the reply.
> 
> I don't know if that's good or bad.
> 
> > So can we get rid of XPT_DEAL altogether?
> 
> OK, I also had another use in mind: for the purposes of 4.1 (which needs
> to know when a connection goes down, e.g. to know that it's no longer
> available for callbacks), I added a list of callbacks to the xprt,
> called on svc_delete_xprt().
> 
> I just noticed that I think my current code allows the 4.1 code to
> register an xprt after svc_delete_xprt() is called.  I could fix that
> race by checking for DEAD after trying to register.
> 
> (That callback code already seems messier than it should be, so maybe
> someone else could suggest a better scheme.  I'm stuck.
> 
> In any case, it wouldn't be so bad if that were the one remaining use of
> DEAD.)

Could you use XPT_CLOSE for that??

NeilBrown


> 
> --b.


  parent reply	other threads:[~2010-10-25 23:23 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-01 12:17 Relocate NFS root FS for maintenance Greg
2010-09-01 17:34 ` J. Bruce Fields
2010-09-01 21:52 ` Tom Haynes
2010-09-02  7:32   ` Greg
2010-09-02 16:06     ` J. Bruce Fields
2010-09-07  6:59       ` Greg
2010-09-02  6:56 ` statfs() gives ESTALE error Menyhart Zoltan
2010-09-07 18:32   ` Trond Myklebust
2010-09-08 13:33 ` Re :statfs() " Menyhart Zoltan
2010-09-08 20:25   ` Trond Myklebust
2010-09-09  8:12 ` Menyhart Zoltan
2010-09-20 12:49 ` Locking question around "...PagePrivate()" Menyhart Zoltan
2010-09-20 13:55   ` Trond Myklebust
2010-10-05  8:22 ` "xprt" reference count drops to 0 Menyhart Zoltan
2010-10-21 20:38   ` J. Bruce Fields
2010-10-22 15:00     ` Menyhart Zoltan
2010-10-22 21:20       ` J. Bruce Fields
2010-10-22 23:01         ` J. Bruce Fields
2010-10-22 23:21           ` J. Bruce Fields
2010-10-23  3:32             ` J. Bruce Fields
2010-10-25  1:09               ` J. Bruce Fields
2010-10-25  1:21                 ` [PATCH 1/4] svcrpc: never clear XPT_BUSY on dead xprt J. Bruce Fields
2010-10-25  1:43                   ` Neil Brown
2010-10-25 20:21                     ` J. Bruce Fields
2010-10-25 22:58                       ` Neil Brown
2010-10-25 23:03                         ` J. Bruce Fields
2010-10-25 23:54                           ` Neil Brown
2010-10-26  0:11                             ` J. Bruce Fields
2010-10-26  0:28                               ` J. Bruce Fields
2010-10-26  0:30                                 ` J. Bruce Fields
2010-10-26  1:28                                   ` Neil Brown
2010-10-26 12:59                                     ` J. Bruce Fields
2010-10-26 16:05                                       ` J. Bruce Fields
2010-11-12 19:00                                         ` J. Bruce Fields
2010-10-25  1:21                 ` [PATCH 2/4] svcrpc: assume svc_delete_xprt() called only once J. Bruce Fields
2010-10-25  1:21                 ` [PATCH 3/4] svcrpc: no need for XPT_DEAD check in svc_xprt_enqueue J. Bruce Fields
2010-10-25  1:21                 ` [PATCH 4/4] svcrpc: svc_tcp_sendto XTP_DEAD check is redundant J. Bruce Fields
2010-10-25  2:10                   ` Neil Brown
2010-10-25 15:03                     ` J. Bruce Fields
2010-10-25 17:46                       ` J. Bruce Fields
2010-10-25 23:08                         ` Neil Brown
2010-10-26  1:33                           ` J. Bruce Fields
2010-10-25 23:23                       ` Neil Brown [this message]
2010-10-26  1:25                         ` J. Bruce Fields
2010-10-25 11:56         ` "xprt" reference count drops to 0 Menyhart Zoltan
2010-10-25 14:36           ` J. Bruce Fields

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=20101026102338.25167800@notabene \
    --to=neilb@suse.de \
    --cc=Zoltan.Menyhart@bull.net \
    --cc=bfields@fieldses.org \
    --cc=bfields@redhat.com \
    --cc=linux-nfs@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).