From: David Howells Date: Wed, 4 Apr 2018 12:41:26 +0000 (+0100) Subject: fscache: Detect multiple relinquishment of a cookie X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d0fb31ecda2c3c6092d0c2a46a6a72653e7dcabb;p=linux.git fscache: Detect multiple relinquishment of a cookie Report if an fscache cookie is relinquished multiple times by the netfs. Signed-off-by: David --- diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c index d705125665f07..98d22f495cd8f 100644 --- a/fs/fscache/cookie.c +++ b/fs/fscache/cookie.c @@ -602,7 +602,8 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire) atomic_read(&cookie->n_active), retire); /* No further netfs-accessing operations on this cookie permitted */ - set_bit(FSCACHE_COOKIE_RELINQUISHED, &cookie->flags); + if (test_and_set_bit(FSCACHE_COOKIE_RELINQUISHED, &cookie->flags)) + BUG(); __fscache_disable_cookie(cookie, retire);