public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Chuck Lever <chuck.lever@oracle.com>
To: Jeff Layton <jlayton@redhat.com>
Cc: Mi Jinlong <mijinlong@cn.fujitsu.com>,
	"Trond.Myklebust" <trond.myklebust@fys.uio.no>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	NFSv3 list <linux-nfs@vger.kernel.org>
Subject: Re: [RFC] After nfs restart, locks can't be recovered which record by lockd before
Date: Wed, 13 Jan 2010 13:53:55 -0500	[thread overview]
Message-ID: <4B4E16C3.4050206@oracle.com> (raw)
In-Reply-To: <20100113075155.5c409567-xSBYVWDuneFaJnirhKH9O4GKTjYczspe@public.gmane.org>

On 01/13/2010 07:51 AM, Jeff Layton wrote:
> On Wed, 13 Jan 2010 17:51:25 +0800
> Mi Jinlong<mijinlong@cn.fujitsu.com>  wrote:
>
>> Hi,
>>
>> When testing the nfs's lock at NFSv3, I get a problem.
>> So I want someone help me, thanks!
>>
>> Test Process:
>>    Step1, ClientA get an exclusive lock success.
>>    Step2, Using command "service nfs restart" to restart server's nf=
s service.
>
> "service nfs restart" on an RH-derived distro is the same as running
> "/etc/init.d/nfs restart". Init scripts vary between distros (and eve=
n
> between releases on the same distro). Since you're asking this in a
> more generic forum, you should probably be specific about what's
> actually being restarted (and in what order). Understanding that may
> also help you answer your own question here.
>
>>    Step3. ClientB get lock should fail, but success.
>>
>> I think after step2 (nfs service restart), clientA's lock should be =
recovered.
>> But like above, clientA's lock doesn=E2=80=99t be recovered.
>>
>> When tracing the kernel, I find nfsd will cause lockd stop when it s=
top.
>> When lockd stop, all locks will be release which is record before at=
 lockd.
>>
>> When nfsd start, the lockd will start also, but the statd don't know=
 what happened
>>   at kernel, so after that, locks will be lost.
>>
>> Is it right when nfs stop, the lockd will stop too?
>> If it's right, should locks be recovered after lockd start?
>>
>
> Assuming you're using a RH-derived distro like Fedora or RHEL, then n=
o.
> statd is controlled by a separate init script (nfslock) and when you
> run "service nfs restart" you're not restarting it. NSM notifications
> are not sent and clients generally won't reclaim their locks.
>
> IOW, "you're doing it wrong". If you want locks to be reclaimed then
> you probably need to restart the nfslock service too.

Mi Jinlong is exercising another case we know doesn't work right, but w=
e=20
don't expect admins will ever perform this kind of "down-up" on a norma=
l=20
production server.  In other words, we expect it to work this way, and=20
it's been good enough, so far.

As Jeff points out, the "nfs" and the "nfslock" services are separate.=20
This is because "nfslock" is required for both client and server side=20
NFS, but "nfs" is required only on the server.  This split also dictate=
s=20
the way sm-notify works, since it has to behave differently on NFS=20
clients and servers.

Two other points:

   + lockd would not restart itself in this case if there happened to b=
e=20
NFS mounts on that system

   + lockd doesn't currently poke statd when it restarts to tell it to=20
send reboot notifications, but it probably should

We know that lockd will start up when someone mounts the first NFS=20
share, or when the NFS server is started.  If lockd sent statd an=20
SM_SIMU_CRASH (or something like it) every time it cold started, statd=20
could send reboot notifications at the right time on both servers and=20
clients without extra logic in the init scripts, and we wouldn't need=20
that kludge in sm-notify to know when a machine has rebooted.

--=20
chuck[dot]lever[at]oracle[dot]com

  parent reply	other threads:[~2010-01-13 18:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13  9:51 [RFC] After nfs restart, locks can't be recovered which record by lockd before Mi Jinlong
2010-01-13 12:51 ` Jeff Layton
     [not found]   ` <20100113075155.5c409567-xSBYVWDuneFaJnirhKH9O4GKTjYczspe@public.gmane.org>
2010-01-13 18:53     ` Chuck Lever [this message]
2010-01-14 10:06       ` Mi Jinlong
2010-01-14 16:13         ` Chuck Lever
2010-01-15  9:35           ` Mi Jinlong
2010-01-15 16:12             ` Chuck Lever
2010-01-18 10:51               ` Mi Jinlong
2010-01-18 16:17                 ` Chuck Lever
2010-01-19 10:36                   ` Mi Jinlong
2010-01-14  9:41     ` Mi Jinlong
2010-01-14 12:10       ` Jeff Layton
     [not found]         ` <20100114071036.09583f4a-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-01-15  9:28           ` Mi Jinlong

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=4B4E16C3.4050206@oracle.com \
    --to=chuck.lever@oracle.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mijinlong@cn.fujitsu.com \
    --cc=trond.myklebust@fys.uio.no \
    /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