lkml.org 
[lkml]   [2019]   [Jul]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4.19 13/47] afs: Fix uninitialised spinlock afs_volume::cb_break_lock
Hi!

> Without this, the following trace may be observed when a volume-break
> callback is received:
>
> INFO: trying to register non-static key.
> the code is fine but needs lockdep annotation.

I'm sure this fixes the warning...

> diff --git a/fs/afs/callback.c b/fs/afs/callback.c
> index 5f261fbf2182..4ad701250299 100644
> --- a/fs/afs/callback.c
> +++ b/fs/afs/callback.c
> @@ -276,9 +276,9 @@ static void afs_break_one_callback(struct afs_server *server,
> struct afs_super_info *as = AFS_FS_S(cbi->sb);
> struct afs_volume *volume = as->volume;
>
> - write_lock(&volume->cb_break_lock);
> + write_lock(&volume->cb_v_break_lock);
> volume->cb_v_break++;
> - write_unlock(&volume->cb_break_lock);
> + write_unlock(&volume->cb_v_break_lock);
> } else {
> data.volume = NULL;
> data.fid = *fid;

But this is the only use of the lock.

Which is strange: we have read/write lock, but we only use the write
side. Readers don't take the lock, so it does not offer any protection
for them.

Is that correct? Does this need to be rwlock, or would plain spinlock
be enough? atomic_t?

(Problem exists in the mainline, nothing stable specific here).

Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2019-07-20 00:34    [W:0.392 / U:0.212 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site