Commit 5b26c1c
nfsd4: add refcount for nfsd4_blocked_lock
BugLink: https://bugs.launchpad.net/bugs/2065435
[ Upstream commit 47446d7 ]
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 <[email protected]>
Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
Signed-off-by: Manuel Diewald <[email protected]>
Signed-off-by: Roxana Nicolescu <[email protected]>1 parent c360699 commit 5b26c1c
2 files changed
+23
-3
lines changed| 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 | | |
| |||
7019 | 7031 | | |
7020 | 7032 | | |
7021 | 7033 | | |
| 7034 | + | |
7022 | 7035 | | |
7023 | 7036 | | |
7024 | 7037 | | |
| |||
7031 | 7044 | | |
7032 | 7045 | | |
7033 | 7046 | | |
| 7047 | + | |
7034 | 7048 | | |
7035 | 7049 | | |
7036 | 7050 | | |
| |||
7051 | 7065 | | |
7052 | 7066 | | |
7053 | 7067 | | |
7054 | | - | |
7055 | | - | |
| 7068 | + | |
| 7069 | + | |
| 7070 | + | |
| 7071 | + | |
| 7072 | + | |
| 7073 | + | |
| 7074 | + | |
7056 | 7075 | | |
7057 | 7076 | | |
7058 | 7077 | | |
| |||
| 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