Skip to contentSkip to conversation

fscache: drop fscache_cookie_put on duplicated cookies in the hash

PATCH In review Luis Henriques 1 participant 2 messages Mar 9, 2020 – Apr 3, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fscache: drop fscache_cookie_put on duplicated cookies in the hash

When there's a collision due to a duplicate cookie, __fscache_register_netfs will do an fscache_cookie_put. This, however, isn't required as fscache_cookie_get hasn't been executed, and will lead to a NULL pointer as fscache_unhash_cookie will be called.

---
 fs/fscache/netfs.c | 1 -
 1 file changed, 1 deletion(-)
fs/fscache/netfs.c +0 -1
index cce92216fa28..07a55371f0a4 100644
@@ -52,7 +52,6 @@ int __fscache_register_netfs(struct fscache_netfs *netfs)
 	return 0;
 
 already_registered:
-	fscache_cookie_put(candidate, fscache_cookie_put_dup_netfs);
 	_leave(" = -EEXIST");
 	return -EEXIST;
 }
#1 lore raw

Ping?

Cheers,
--
Luis

Quoted 22 lines · Luis Henriques

When there's a collision due to a duplicate cookie, __fscache_register_netfs will do an fscache_cookie_put. This, however, isn't required as fscache_cookie_get hasn't been executed, and will lead to a NULL pointer as fscache_unhash_cookie will be called.

---
 fs/fscache/netfs.c | 1 -
 1 file changed, 1 deletion(-)
fs/fscache/netfs.c +0 -1
index cce92216fa28..07a55371f0a4 100644
@@ -52,7 +52,6 @@ int __fscache_register_netfs(struct fscache_netfs *netfs)
 	return 0;
 
 already_registered:
-	fscache_cookie_put(candidate, fscache_cookie_put_dup_netfs);
 	_leave(" = -EEXIST");
 	return -EEXIST;
 }