Skip to contentSkip to conversation

a suspected bug in nfs_free_seqid()

DISCUSSION 홍신 shin hong 2 participants 2 messages Jan 15, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi. I found a suspected bug while I review nfs_free_seqid() in nfs4state.c

It seems that nfs_free_seqid() tried to use "test and test-set" idiom (double checked locking)
but the second "test" is missed so that It may occur data race when other thread makes
&seqid->list not empty before the thread executiong nfs_free_seqid() holds spin_lock(&sequence->lock) after checking !list_empty(&seqid->list).

I do not have much background for nfs so that it might not be a real bug so please review the code and let me know whether it is real one or not. Thanks.

Sincerely,
Shin Hong

A message that is not in the archive (sent off-list or not yet received): 2014bcab0901150253p6941a323g5809c98c21e31122-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#2 lore raw
Quoted 1 line · On Thu, 2009-01-15 at 19:53 +0900, =ED=99=8D=EC=8B=A0 shin hong wrote:

Hi. I found a suspected bug while I review nfs_free_seqid() in nfs4st=

ate.c

Quoted 7 lines

=20
It seems that nfs_free_seqid() tried to use "test and test-set" idiom (double checked locking)
but the second "test" is missed so that It may occur data race when other thread makes
&seqid->list not empty before the thread executiong nfs_free_seqid() holds spin_lock(&sequence->lock) after checking !list_empty(&seqid->l=

ist).

Quoted 2 lines

=20
I do not have much background for nfs so that it might not be a real =

bug

Quoted 1 line

so please review the code and let me know whether it is real one or n=

ot.

Quoted 1 line

Thanks.

Hi,

Unlike the struct rpc_sequence, the struct nfs_seqid is always owned by a single process, so there is no race here.

Cheers
Trond