Re: [PATCH 4.19 13/47] afs: Fix uninitialised spinlock afs_volume::cb_break_lock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux