lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210409025131.4114078-8-willy@infradead.org>
Date:   Fri,  9 Apr 2021 03:51:21 +0100
From:   "Matthew Wilcox (Oracle)" <willy@...radead.org>
To:     neilb@...e.de, peterz@...radead.org, mingo@...hat.com,
        will@...nel.org, longman@...hat.com, boqun.feng@...il.com,
        tglx@...utronix.de, bigeasy@...utronix.de
Cc:     "Matthew Wilcox (Oracle)" <willy@...radead.org>,
        linux-kernel@...r.kernel.org
Subject: [PATCH 07/17] fscache: Add cookie_hash_lock

Allow lockdep to track the fscache cookie hash bit spin locks.

Signed-off-by: Matthew Wilcox (Oracle) <willy@...radead.org>
---
 fs/fscache/cookie.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/fs/fscache/cookie.c b/fs/fscache/cookie.c
index 751bc5b1cddf..65d514d12592 100644
--- a/fs/fscache/cookie.c
+++ b/fs/fscache/cookie.c
@@ -17,6 +17,7 @@ struct kmem_cache *fscache_cookie_jar;
 
 static atomic_t fscache_object_debug_id = ATOMIC_INIT(0);
 
+static DEFINE_SPLIT_LOCK(cookie_hash_lock);
 #define fscache_cookie_hash_shift 15
 static struct hlist_bl_head fscache_cookie_hash[1 << fscache_cookie_hash_shift];
 
@@ -202,7 +203,7 @@ struct fscache_cookie *fscache_hash_cookie(struct fscache_cookie *candidate)
 	bucket = candidate->key_hash & (ARRAY_SIZE(fscache_cookie_hash) - 1);
 	h = &fscache_cookie_hash[bucket];
 
-	hlist_bl_lock(h);
+	hlist_bl_lock(h, &cookie_hash_lock);
 	hlist_bl_for_each_entry(cursor, p, h, hash_link) {
 		if (fscache_compare_cookie(candidate, cursor) == 0)
 			goto collision;
@@ -212,7 +213,7 @@ struct fscache_cookie *fscache_hash_cookie(struct fscache_cookie *candidate)
 	fscache_cookie_get(candidate->parent, fscache_cookie_get_acquire_parent);
 	atomic_inc(&candidate->parent->n_children);
 	hlist_bl_add_head(&candidate->hash_link, h);
-	hlist_bl_unlock(h);
+	hlist_bl_unlock(h, &cookie_hash_lock);
 	return candidate;
 
 collision:
@@ -222,12 +223,12 @@ struct fscache_cookie *fscache_hash_cookie(struct fscache_cookie *candidate)
 		pr_err("Duplicate cookie detected\n");
 		fscache_print_cookie(cursor, 'O');
 		fscache_print_cookie(candidate, 'N');
-		hlist_bl_unlock(h);
+		hlist_bl_unlock(h, &cookie_hash_lock);
 		return NULL;
 	}
 
 	fscache_cookie_get(cursor, fscache_cookie_get_reacquire);
-	hlist_bl_unlock(h);
+	hlist_bl_unlock(h, &cookie_hash_lock);
 	return cursor;
 }
 
@@ -845,9 +846,9 @@ static void fscache_unhash_cookie(struct fscache_cookie *cookie)
 	bucket = cookie->key_hash & (ARRAY_SIZE(fscache_cookie_hash) - 1);
 	h = &fscache_cookie_hash[bucket];
 
-	hlist_bl_lock(h);
+	hlist_bl_lock(h, &cookie_hash_lock);
 	hlist_bl_del(&cookie->hash_link);
-	hlist_bl_unlock(h);
+	hlist_bl_unlock(h, &cookie_hash_lock);
 }
 
 /*
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ