[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190719223319.GA32199@amd>
Date: Sat, 20 Jul 2019 00:33:19 +0200
From: Pavel Machek <pavel@...x.de>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
David Howells <dhowells@...hat.com>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [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
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists