Commit 47446d7
nfsd4: add refcount for nfsd4_blocked_lock
nbl allocated in nfsd4_lock can be released by a several ways:
directly in nfsd4_lock(), via nfs4_laundromat(), via another nfs
command RELEASE_LOCKOWNER or via nfsd4_callback.
This structure should be refcounted to be used and released correctly
in all these cases.
Refcount is initialized to 1 during allocation and is incremented
when nbl is added into nbl_list/nbl_lru lists.
Usually nbl is linked into both lists together, so only one refcount
is used for both lists.
However nfsd4_lock() should keep in mind that nbl can be present
in one of lists only. This can happen if nbl was handled already
by nfs4_laundromat/nfsd4_callback/etc.
Refcount is decremented if vfs_lock_file() returns FILE_LOCK_DEFERRED,
because nbl can be handled already by nfs4_laundromat/nfsd4_callback/etc.
Refcount is not changed in find_blocked_lock() because of it reuses counter
released after removing nbl from lists.
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>1 parent 40595cd commit 47446d7
2 files changed
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
| 249 | + | |
249 | 250 | | |
250 | 251 | | |
251 | 252 | | |
| |||
271 | 272 | | |
272 | 273 | | |
273 | 274 | | |
| 275 | + | |
274 | 276 | | |
275 | 277 | | |
276 | 278 | | |
| |||
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
282 | 293 | | |
283 | 294 | | |
284 | 295 | | |
285 | 296 | | |
286 | 297 | | |
287 | | - | |
| 298 | + | |
288 | 299 | | |
289 | 300 | | |
290 | 301 | | |
| |||
302 | 313 | | |
303 | 314 | | |
304 | 315 | | |
| 316 | + | |
305 | 317 | | |
306 | 318 | | |
307 | 319 | | |
| |||
6987 | 6999 | | |
6988 | 7000 | | |
6989 | 7001 | | |
| 7002 | + | |
6990 | 7003 | | |
6991 | 7004 | | |
6992 | 7005 | | |
| |||
6999 | 7012 | | |
7000 | 7013 | | |
7001 | 7014 | | |
| 7015 | + | |
7002 | 7016 | | |
7003 | 7017 | | |
7004 | 7018 | | |
| |||
7019 | 7033 | | |
7020 | 7034 | | |
7021 | 7035 | | |
7022 | | - | |
7023 | | - | |
| 7036 | + | |
| 7037 | + | |
| 7038 | + | |
| 7039 | + | |
| 7040 | + | |
| 7041 | + | |
| 7042 | + | |
7024 | 7043 | | |
7025 | 7044 | | |
7026 | 7045 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
633 | 633 | | |
634 | 634 | | |
635 | 635 | | |
| 636 | + | |
636 | 637 | | |
637 | 638 | | |
638 | 639 | | |
| |||
0 commit comments