From: NeilBrown Date: Tue, 17 Oct 2006 07:10:17 +0000 (-0700) Subject: [PATCH] knfsd: Fix bug in recent lockd patches that can cause reclaim to fail X-Git-Tag: v3.12-rc1~31920^2~47^2~138 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4481d1038f4116f3f5c307d919e6dc815a3acbb9;p=kernel%2Fkernel-generic.git [PATCH] knfsd: Fix bug in recent lockd patches that can cause reclaim to fail When an nfs server shuts down, lockd needs to release all the locks even though the client still holds them. It should therefore not 'unmonitor' the clients, so that the files in nfs/sm will still be there when the nfs server restarts, so that those clients will be told to reclaim their locks. However the hosts are fully unmonitored, so statd may well remove the files. lockd has a test for 'sm_sticky' and avoid the unmonitor call if it is set, but it is currently not set. So set it when tearing down lockd. Signed-off-by: Neil Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c index 514f5f2..c5f9113 100644 --- a/fs/lockd/svcsubs.c +++ b/fs/lockd/svcsubs.c @@ -324,7 +324,16 @@ nlmsvc_same_host(struct nlm_host *host, struct nlm_host *other) static int nlmsvc_is_client(struct nlm_host *host, struct nlm_host *dummy) { - return host->h_server; + if (host->h_server) { + /* we are destroying locks even though the client + * hasn't asked us too, so don't unmonitor the + * client + */ + if (host->h_nsmhandle) + host->h_nsmhandle->sm_sticky = 1; + return 1; + } else + return 0; } /*