Use proper lock in fscache_objlist_config.
PATCH 1/1 Use proper lock in fscache_objlist_config.
fscache_objlist_config doesn't hold rkey->sem when calling user_key_payload, that can result in a "suspicious RCU usage" warning. It does hold rcu_read_lock, so it either needs to use unprotected rcu_dereference, or take rkey->sem instead of rcu_read_lock.
--- fs/fscache/object-list.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/fscache/object-list.c +2 -2
@@ -327,7 +327,7 @@ static void fscache_objlist_config(struct fscache_objlist_data *data) goto no_config; config =0 ; -rcu_read_lock (); +down_read (&key->sem); confkey =user_key_payload (key); buf = confkey->data;
@@ -349,7 +349,7 @@ static void fscache_objlist_config(struct fscache_objlist_data *data) } } -rcu_read_unlock (); +up_read (&key->sem);key_put (key);if (!(config & (FSCACHE_OBJLIST_CONFIG_COOKIE |FSCACHE_OBJLIST_CONFIG_NOCOOKIE )))
Signature · 1 line
2.7.4
Quoted 4 lines · Artem Savkov
fscache_objlist_configdoesn't holdrkey->semwhen callinguser_key_payload, that can result in a "suspicious RCU usage" warning. It does holdrcu_read_lock, so it either needs to use unprotectedrcu_dereference, or takerkey->seminstead ofrcu_read_lock.
It shouldn't take key->sem. The RCU lock should be necessary as user_key_payload() wraps a call to rcu_dereference().
Did you encounter a lockdep report or did you visually inspect this?
David
Quoted 11 lines · David Howells
Quoted 4 lines · Artem Savkov
fscache_objlist_configdoesn't holdrkey->semwhen callinguser_key_payload, that can result in a "suspicious RCU usage" warning. It does holdrcu_read_lock, so it either needs to use unprotectedrcu_dereference, or takerkey->seminstead ofrcu_read_lock.It shouldn't take
key->sem. The RCU lock should be necessary asuser_key_payload()wraps a call torcu_dereference().Did you encounter a lockdep report or did you visually inspect this?
I didn't see a lockdep report for this one, I just assumed it would be the same as with the nfs_idmap_get_key case.
Signature · 2 lines
Regards, Artem