| Date | Mon, 18 May 2020 23:13:30 +0200 | From | Pavel Machek <> | Subject | Re: [PATCH 4.19 02/80] shmem: fix possible deadlocks on shmlock_user_lock |
| |
Hi!
> This may not risk an actual deadlock, since shmem inodes do not take > part in writeback accounting, but there are several easy ways to avoid > it.
...
> Take info->lock out of the chain and the possibility of deadlock or > lockdep warning goes away.
It is unclear to me if actual possibility of deadlock exists or not, but anyway:
> int retval = -ENOMEM; > > - spin_lock_irq(&info->lock); > + /* > + * What serializes the accesses to info->flags? > + * ipc_lock_object() when called from shmctl_do_lock(), > + * no serialization needed when called from shm_destroy(). > + */ > if (lock && !(info->flags & VM_LOCKED)) { > if (!user_shm_lock(inode->i_size, user)) > goto out_nomem;
Should we have READ_ONCE() here? If it is okay, are concurency sanitizers smart enough to realize that it is okay? Replacing warning with different one would not be exactly a win...
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] |