2003-03-22 09:59:29

by Dawson Engler

[permalink] [raw]
Subject: [CHECKER] deadlock in 2.5.62/fs/lockd/svc*.c?

Hi All,

here's a more interesting potential deadlock in the
2.5.62/fs/lockd/svc*.c
code that requires the miscordination of three threads. It might be
a false because of
1. infeasible callchain path or

2. the two struct nlm_file.f_sema pointers cannot actually point
to the same object.

It requires three threads:
thread 1: acquires nlm_file_sema then tries to get file->f_sema
thread 2: acquires file->f_sema and tries to get nlm_host_sema
thread 3: acquires nlm_host_sema and tries to get nlm_file_sema

Any feedback on this one would be great.

Dawson


BUG: ERROR: 3 thread global-global deadlock.
<&nlm_file_sema>-><&nlm_host_sema> occurred 4 times
<&nlm_host_sema>-><&nlm_file_sema> occurred 5 times


Plausible chain
thread 1: <&nlm_file_sema,struct nlm_file.f_sema>
depth = 3:
2.5.62/fs/lockd/svcsubs.c:nlm_traverse_files:218

down(&nlm_file_sema);

->2.5.62/fs/lockd/svcsubs.c:nlm_traverse_files:218
->nlm_traverse_files:224
->nlm_inspect_file:202
->end=fs/lockd/svclock.c:nlmsvc_traverse_blocks:274:down

down(&file->f_sema);

Seems like a plausible chain.
thread 2: <struct nlm_file.f_sema,&nlm_host_sema>
depth = 4:
2.5.62/fs/lockd/svclock.c:nlmsvc_lock:309

/* Lock file against concurrent access */
down(&file->f_sema);


->2.5.62/fs/lockd/svclock.c:nlmsvc_lock:309
->nlmsvc_lock:351
->nlmsvc_create_block:179
->2.5.62/fs/lockd/host.c:nlmclnt_lookup_host:44
->end=nlm_lookup_host:74:down

/* Lock hash table */
down(&nlm_host_sema);

Seems reasonable.
<&nlm_host_sema>-><&nlm_file_sema> =
depth = 4:
2.5.62/fs/lockd/host.c:nlm_lookup_host:74
/* Lock hash table */
down(&nlm_host_sema);

->2.5.62/fs/lockd/host.c:nlm_lookup_host:74
->nlm_lookup_host:77
->nlm_gc_hosts:319
->/u2/engler/mc/oses/linux/linux-2.5.62/fs/lockd/svcsubs.c:nlmsvc_mark_resources:279
->end=nlm_traverse_files:218:down
->2.5.62/fs/lockd/svcsubs.c:nlm_traverse_files:218

down(&nlm_file_sema);