fscache: Detect multiple relinquishment of a cookie
authorDavid Howells <dhowells@redhat.com>
Wed, 4 Apr 2018 12:41:26 +0000 (13:41 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 4 Apr 2018 12:41:26 +0000 (13:41 +0100)
Report if an fscache cookie is relinquished multiple times by the netfs.

Signed-off-by: David <dhowells@redhat.com>
fs/fscache/cookie.c

index d705125..98d22f4 100644 (file)
@@ -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);