[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+KaGenaX0lwSy9G@gmail.com>
Date: Tue, 7 Feb 2023 18:36:09 +0000
From: Eric Biggers <ebiggers@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Dan Carpenter <error27@...il.com>, linux-block@...r.kernel.org,
Julia Lawall <julia.lawall@...ia.fr>,
Luis Chamberlain <mcgrof@...nel.org>,
Hongchen Zhang <zhanghongchen@...ngson.cn>,
Alexander Viro <viro@...iv.linux.org.uk>,
Andrew Morton <akpm@...ux-foundation.org>,
"Christian Brauner (Microsoft)" <brauner@...nel.org>,
David Howells <dhowells@...hat.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Eric Dumazet <edumazet@...gle.com>,
"Fabio M. De Francesco" <fmdefrancesco@...il.com>,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
maobibo <maobibo@...ngson.cn>,
Matthew Wilcox <willy@...radead.org>,
Sedat Dilek <sedat.dilek@...il.com>
Subject: Re: block: sleeping in atomic warnings
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@...nel.org> 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
Powered by blists - more mailing lists