Skip to content

Commit d0fb31e

Browse files
committed
fscache: Detect multiple relinquishment of a cookie
Report if an fscache cookie is relinquished multiple times by the netfs. Signed-off-by: David <[email protected]>
1 parent b27ddd4 commit d0fb31e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/fscache/cookie.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire)
602602
atomic_read(&cookie->n_active), retire);
603603

604604
/* No further netfs-accessing operations on this cookie permitted */
605-
set_bit(FSCACHE_COOKIE_RELINQUISHED, &cookie->flags);
605+
if (test_and_set_bit(FSCACHE_COOKIE_RELINQUISHED, &cookie->flags))
606+
BUG();
606607

607608
__fscache_disable_cookie(cookie, retire);
608609

0 commit comments

Comments
 (0)