Linux NFS development
 help / color / mirror / Atom feed
From: Greg Banks <gnb-cP1dWloDopni96+mSzHFpQC/G2K4zDHf@public.gmane.org>
To: Neil Brown <neilb@suse.de>
Cc: Jeff Layton <jlayton@redhat.com>,
	linux-nfs@vger.kernel.org, nfsv4@linux-nfs.org
Subject: Re: [PATCH 0/3] [RFC] knfsd: convert to kthread API and remove	signaling for shutdown
Date: Tue, 20 May 2008 13:26:47 -0700	[thread overview]
Message-ID: <48333407.8020007@melbourne.sgi.com> (raw)
In-Reply-To: <18482.16837.381955.636390-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>

Neil Brown wrote:
>
> Fair question.
> The new nfsd_mutex primarily protects "nfsd_serv", both the pointer
> itself and various members of the structure that it sometimes points
> to.
> In particular, ->sv_nrthreads but also to some extent sv_temp_socks
> and sv_permsocks.
>   
Those two fields should be guarded by svc_serv->sv_lock only.  In fact
IIRC the only field of svc_serv guarded by the global mutex is
sv_nrthreads in it's role as pseudo-refcount.

> Having said all that, I think I see a race.
> When a new rqst is created at put on sp_all_threads, ->rq_task it not
> set and doesn't get set until the thread runs and gets the mutex.  So
> there is a brief hole when ->rq_task isn't set.  I don't know if that
> can cause a problem, but it feels wrong.
> When you switch to kthreads, you use the fact that kthread_create
> returns a task_struct, and assign that to ->rq_task in
> __svc_create_thread instead of nfsd, which will close that hole.
>   
Yes, that aspect of Jeff's patch is a definite improvement.
> If you look in nfsctl.c, you will probably be able to find plenty of
> places where nfsd_serv is dereferenced without any locking.  These are
> all wrong and need fixing.
>   
Agreed!

-- 
Greg Banks, P.Engineer, SGI Australian Software Group.
The cake is *not* a lie.
I don't speak for SGI.


  parent reply	other threads:[~2008-05-20 20:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-18  2:35 [PATCH 0/3] [RFC] knfsd: convert to kthread API and remove signaling for shutdown Jeff Layton
2008-05-18  2:35 ` [PATCH 1/3] [RFC] knfsd: convert knfsd to kthread API Jeff Layton
2008-05-18  2:35   ` [PATCH 2/3] [RFC] sunrpc: remove unneeded fields from svc_serv struct Jeff Layton
2008-05-18  2:35     ` [PATCH 3/3] [RFC] knfsd: remove signal defines and extraneous variables Jeff Layton
2008-05-19  6:07 ` [PATCH 0/3] [RFC] knfsd: convert to kthread API and remove signaling for shutdown Neil Brown
     [not found]   ` <18481.6416.571430.593722-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-05-19 21:01     ` Jeff Layton
2008-05-19 22:00     ` Greg Banks
2008-05-19 23:52       ` Neil Brown
     [not found]         ` <18482.4782.858347.981553-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-05-20  2:04           ` Greg Banks
2008-05-20  2:24         ` Jeff Layton
     [not found]           ` <20080519222457.6f24daa5-PC62bkCOHzGdMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2008-05-20  2:34             ` Greg Banks
2008-05-20 11:05               ` Jeff Layton
     [not found]             ` <483238B3.4010702-cP1dWloDopni96+mSzHFpQC/G2K4zDHf@public.gmane.org>
2008-05-20 13:33               ` Talpey, Thomas
2008-05-20  3:13           ` Neil Brown
2008-05-20 11:13             ` Jeff Layton
     [not found]             ` <18482.16837.381955.636390-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-05-20 20:26               ` Greg Banks [this message]
2008-05-20 20:36       ` Greg Banks
     [not found]         ` <4833364A.4010803-cP1dWloDopni96+mSzHFpQC/G2K4zDHf@public.gmane.org>
2008-05-21  1:48           ` Jeff Layton
     [not found]             ` <20080520214823.576ad7a7-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-05-21  3:29               ` Greg Banks
     [not found]                 ` <48339730.3060206-cP1dWloDopni96+mSzHFpQC/G2K4zDHf@public.gmane.org>
2008-05-30 16:25                   ` Jeff Layton
     [not found]                     ` <20080530122517.4f18c48e-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-05-30 18:46                       ` J. Bruce Fields
2008-05-30 20:59                         ` Jeff Layton
2008-06-02  5:51                       ` Greg Banks
     [not found]                         ` <48438A76.6000400-cP1dWloDopni96+mSzHFpQC/G2K4zDHf@public.gmane.org>
2008-06-02 10:41                           ` Jeff Layton
     [not found]                             ` <20080602064132.10c69c88-RtJpwOs3+0O+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2008-06-03  3:27                               ` Greg Banks
     [not found]                                 ` <4844BA3C.3010605-cP1dWloDopni96+mSzHFpQC/G2K4zDHf@public.gmane.org>
2008-06-03 10:51                                   ` 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=48333407.8020007@melbourne.sgi.com \
    --to=gnb-cp1dwlodopni96+mszhfpqc/g2k4zdhf@public.gmane.org \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=nfsv4@linux-nfs.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