浏览代码

fscache: Detect multiple relinquishment of a cookie

Report if an fscache cookie is relinquished multiple times by the netfs.

Signed-off-by: David <dhowells@redhat.com>
David Howells 7 年之前
父节点
当前提交
d0fb31ecda
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      fs/fscache/cookie.c

+ 2 - 1
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);