On Thu, Aug 29, 2019 at 04:09:29PM +0300, Jarkko Sakkinen wrote: > On Tue, Aug 27, 2019 at 12:27:13PM -0700, Sean Christopherson wrote: > > @@ -77,7 +78,7 @@ static int sgx_release(struct inode *inode, struct file *file) > > }; > > > > mutex_lock(&encl->lock); > > - encl->flags |= SGX_ENCL_DEAD; > > + atomic_or(SGX_ENCL_DEAD, &encl->flags); > > mutex_unlock(&encl->lock); > > Had a couple of checkpatch.pl errors (not a biggie, just a remark). > > Is there reason to keep lock there? Yes, I couldn't convince myself the reclaim flows would work correctly if SGX_ENCL_DEAD could be set while the reclaimer held encl->lock. But I'm also not 100% certain holding encl->lock is strictly necessary in this case, so I didn't add a comment either.