client cannot get lock after other client got lock occur network partition.
Subsystems (2)
RFC PATCH 1/1 client cannot get lock after other client got lock occur network partition.
Hi Trond et all
There is a bug, when i test NFSv3 file's lock as followed:
Step1: ClientA and ClientB open a same nfs file;
Step2: ClientA locks file with write lock, it's ok;
Step3: Cut off the network between ClientA and Server;
Step4: ClientB can not acquire for write lock successful forever, even though
the network partition larger than NLM_HOST_EXPIRE.
As i know, If use NFSv4, step4 can success after LEASE_TIME.
Is it necessary to fix NFSv3 ?
The attached patch can make this case OK, but i am not sure it's good.
--- fs/lockd/host.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
fs/lockd/host.c +3 -2
@@ -550,8 +550,8 @@ nlm_gc_hosts(void)for (chain = nlm_hosts; chain < nlm_hosts +NLM_HOST_NRHASH ; ++chain) {hlist_for_each_entry_safe (host, pos, next, chain, h_hash) { -if (atomic_read (&host->h_count) || host->h_inuse - ||time_before (jiffies, host->h_expires)) { +if (time_before (jiffies, host->h_expires) + && (atomic_read (&host->h_count) || host->h_inuse))dprintk ("nlm_gc_hosts skipping %s (cnt %d use %d exp %ld)\n" , host->h_name,atomic_read (&host->h_count), host->h_inuse, host->h_expires);
@@ -560,6 +560,7 @@ nlm_gc_hosts(void)dprintk ("lockd: delete host %s\n" , host->h_name);hlist_del_init (&host->h_hash); +nlmsvc_free_host_resources (host);nlm_destroy_host (host); nrhosts--; }
---
thanks,
Mi Jinlong
Quoted 10 lines · Mi Jinlong
Hi Trond et all
There is a bug, when i test NFSv3 file's lock as followed:
Step1: ClientA and ClientB open a same nfs file;
Step2: ClientA locks file with write lock, it's ok;
Step3: Cut off the network between ClientA and Server;
Step4: ClientB can not acquire for write lock successful forever, even though
the network partition larger thanNLM_HOST_EXPIRE.
Quoted 5 lines
As i know, If use NFSv4, step4 can success after
LEASE_TIME.Is it necessary to fix NFSv3 ?
The attached patch can make this case OK, but i am not sure it's good.
Unfortunately, NLM (the NFSv2 and v3 locking protocol) is not lease based, so the above scenario is truly an unfixable one.
The problem with applying your patch is, in essence, that we risk breaking another scenario where a client grabs a lock, and then holds it for a while.
The reason this breaks is that there is no equivalent in the NLM protocol of the NFSv4 RENEW operation to tell the server that "This client is still alive and wants you to keep its state".
Cheers,
Trond
A message that is not in the archive (sent off-list or not yet received): 1257772609.3754.11.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org
Hi Trond
Trond Myklebust =8E=CA=93=B9:
Quoted 9 lines · Mi Jinlong
Quoted 8 lines
Hi Trond et all
There is a bug, when i test NFSv3 file's lock as followed:
Step1: ClientA and ClientB open a same nfs file;
Step2: ClientA locks file with write lock, it's ok;
Step3: Cut off the network between ClientA and Server;
Step4: ClientB can not acquire for write lock successful forever, ev=
en though
Quoted 7 lines
Quoted 7 lines
the network partition larger than
NLM_HOST_EXPIRE.As i know, If use NFSv4, step4 can success after
LEASE_TIME.Is it necessary to fix NFSv3 ?=20
The attached patch can make this case OK, but i am not sure it's goo=
d.
Quoted 6 lines
=20
Unfortunately, NLM (the NFSv2 and v3 locking protocol) is not lease based, so the above scenario is truly an unfixable one.
=20
The problem with applying your patch is, in essence, that we risk breaking another scenario where a client grabs a lock, and then holds=
it
Quoted 4 lines
for a while.
The reason this breaks is that there is no equivalent in the NLM protocol of the NFSv4 RENEW operation to tell the server that "This client is still alive and wants you to keep its state".
Thanks for your answer!
This bug seems serious, shouldn't we fix it?
thanks,
Mi Jinlong
Quoted 12 lines · Mi Jinlong
Hi Trond
=20
Trond Myklebust =E5=86=99=E9=81=93:Quoted 9 lines · Mi Jinlong
Quoted 8 lines
Hi Trond et all
There is a bug, when i test NFSv3 file's lock as followed:
Step1: ClientA and ClientB open a same nfs file;
Step2: ClientA locks file with write lock, it's ok;
Step3: Cut off the network between ClientA and Server;
Step4: ClientB can not acquire for write lock successful forever, =
even though
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
the network partition larger than
NLM_HOST_EXPIRE.As i know, If use NFSv4, step4 can success after
LEASE_TIME.Is it necessary to fix NFSv3 ?=20
The attached patch can make this case OK, but i am not sure it's g=
ood.
Quoted 6 lines
Quoted 6 lines
=20
Unfortunately, NLM (the NFSv2 and v3 locking protocol) is not lease based, so the above scenario is truly an unfixable one. =20
The problem with applying your patch is, in essence, that we risk breaking another scenario where a client grabs a lock, and then hol=
ds it
Quoted 8 lines
Quoted 4 lines
for a while.
The reason this breaks is that there is no equivalent in the NLM protocol of the NFSv4 RENEW operation to tell the server that "This client is still alive and wants you to keep its state".=20
Thanks for your answer!
=20
This bug seems serious, shouldn't we fix it?
Unless you can think of a fix which works with the current NLM protocol= ,
I'd suggest simply encouraging people to move to a protocol with lease based locks: i.e. NFSv4...
Cheers
Trond
A message that is not in the archive (sent off-list or not yet received): 1257856550.3046.6.camel-rJ7iovZKK19ZJLDQqaL3InhyD016LWXt@public.gmane.org
Hi Trond
Trond Myklebust =E5=86=99=E9=81=93:
Quoted 5 lines · Mi Jinlong
Quoted 4 lines
Hi Trond
Trond Myklebust =E5=86=99=E9=81=93:
Quoted 1 line · Mi Jinlong
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Hi Trond et all
There is a bug, when i test NFSv3 file's lock as followed:
Step1: ClientA and ClientB open a same nfs file;
Step2: ClientA locks file with write lock, it's ok;
Step3: Cut off the network between ClientA and Server;
Step4: ClientB can not acquire for write lock successful forever, =
even though
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
the network partition larger than
NLM_HOST_EXPIRE.As i know, If use NFSv4, step4 can success after
LEASE_TIME.Is it necessary to fix NFSv3 ?=20
The attached patch can make this case OK, but i am not sure it's g=
ood.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Unfortunately, NLM (the NFSv2 and v3 locking protocol) is not lease based, so the above scenario is truly an unfixable one.
The problem with applying your patch is, in essence, that we risk breaking another scenario where a client grabs a lock, and then hol=
ds it
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
for a while.
The reason this breaks is that there is no equivalent in the NLM protocol of the NFSv4 RENEW operation to tell the server that "This client is still alive and wants you to keep its state".Thanks for your answer!
This bug seems serious, shouldn't we fix it?
=20
Unless you can think of a fix which works with the current NLM protoc=
ol,
Quoted 1 line
I'd suggest simply encouraging people to move to a protocol with leas=
e
Quoted 1 line
based locks: i.e. NFSv4...
Can we add a process(like NFSv4's nfsd4) to call the nlm_gc_hosts() per= iodically?
At nlm_gc_hosts, then call rpc_ping() to check whether network is OK, i= f not,
its resource will be release.
thanks,
Mi Jinlong
Quoted 16 lines · Mi Jinlong
Hi Trond
=20
Trond Myklebust =E5=86=99=E9=81=93:Quoted 13 lines · Mi Jinlong
Quoted 12 lines
Hi Trond
Trond Myklebust =E5=86=99=E9=81=93:
Quoted 9 lines · Mi Jinlong
Quoted 8 lines
Hi Trond et all
There is a bug, when i test NFSv3 file's lock as followed:
Step1: ClientA and ClientB open a same nfs file;
Step2: ClientA locks file with write lock, it's ok;
Step3: Cut off the network between ClientA and Server;
Step4: ClientB can not acquire for write lock successful forever,=
even though
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
the network partition larger than
NLM_HOST_EXPIRE.As i know, If use NFSv4, step4 can success after
LEASE_TIME.Is it necessary to fix NFSv3 ?=20
The attached patch can make this case OK, but i am not sure it's =
good.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Unfortunately, NLM (the NFSv2 and v3 locking protocol) is not leas=
e
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
based, so the above scenario is truly an unfixable one.
The problem with applying your patch is, in essence, that we risk breaking another scenario where a client grabs a lock, and then ho=
lds it
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
for a while.
The reason this breaks is that there is no equivalent in the NLM protocol of the NFSv4 RENEW operation to tell the server that "Thi=
s
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
client is still alive and wants you to keep its state".
Thanks for your answer!
This bug seems serious, shouldn't we fix it?
Unless you can think of a fix which works with the current NLM proto=
col,
Quoted 1 line
Quoted 1 line
I'd suggest simply encouraging people to move to a protocol with lea=
se
Quoted 3 lines
Quoted 1 line
based locks: i.e. NFSv4...
=20
Can we add a process(like NFSv4's nfsd4) to call thenlm_gc_hosts()p=
eriodically?
Quoted 1 line
At
nlm_gc_hosts, then callrpc_ping()to check whether network is OK,=
if not,
Quoted 2 lines
its resource will be release.
=20
This would also violate the semantics that the current NLM has. If, while holding the lock, the client does not need to contact the server, it may not even notice the network partition and will continue to expect that it holds the lock.
It might have been interesting to fix this problem about 20 years ago. However, nowadays, we just live with it. If it is a real problem, then using NFSv4 can be a good solution.
ps