Re: block: sleeping in atomic warnings

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

 



On Tue, Feb 07, 2023 at 10:24:45AM -0800, Linus Torvalds wrote:
> On Tue, Feb 7, 2023 at 9:53 AM Eric Biggers <ebiggers@xxxxxxxxxx> wrote:
> >
> > It's a false positive.  See the comment above fscrypt_destroy_keyring()
> 
> Hmm. Ok. Unfortunate.
> 
> >  If the filesystem has not been mounted, then the call from __put_super()
> > is needed, but blk_crypto_evict_key() can never be executed in that case.
> 
> It's not all that clear that some *other* error might not have
> happened to keep the mount from actually succeeding, but after the
> keys have been instantiated?
> 
> IOW, what's the thing that makes "blk_crypto_evict_key() can never be
> executed in that case" be obvious?
> 
> I think _that_ is what might want a comment, about how we always call
> generic_shutdown_super() before the last put_super() happens.
> 
> It does seem like Dan's automated checks could be useful, but if
> there's no sane way to avoid the false positives, it's always going to
> be a lot of noise ;(
> 

blk_crypto_evict_key() only runs if a key was prepared for inline encryption,
which can only happen if a user does I/O to an encrypted file.  That can only
happen after the filesystem was successfully mounted.

Also note that keys are normally added using an ioctl, which can only be
executed after the filesystem was mounted.  The only exception is the key
associated with the "test_dummy_encryption" mount option.

By the way, the following code is in generic_shutdown_super(), and not in
__put_super(), for a very similar reason:

                if (sb->s_dio_done_wq) {
                        destroy_workqueue(sb->s_dio_done_wq);
                        sb->s_dio_done_wq = NULL;
                }

That code is only needed if there has been user I/O to the filesystem, which
again can only have happened if the filesystem was successfully mounted.

- Eric



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux