[dm-devel] [PATCH 5/6] dm crypt: Replace the in_interrupt() usage in crypt_convert().

Sebastian Andrzej Siewior bigeasy at linutronix.de
Sat Feb 13 11:11:45 UTC 2021


crypt_convert() is always invoked with atomic == true if invoked from an
atomic context.

The usage of in_interrupt() in drivers is phased out and Linus clearly
requested that code which changes behaviour depending on context should
either be separated or the context be conveyed in an argument passed by
the caller, which usually knows the context.

Use the `atomic' argument instead of in_interrupt() to check if it is
safe to wait on a completion.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy at linutronix.de>
---
 drivers/md/dm-crypt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index 1151a0108ae78..0cdfee10d5a23 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1575,7 +1575,7 @@ static blk_status_t crypt_convert(struct crypt_config *cc,
 		 * but the driver request queue is full, let's wait.
 		 */
 		case -EBUSY:
-			if (in_interrupt()) {
+			if (atomic) {
 				if (try_wait_for_completion(&ctx->restart)) {
 					/*
 					 * we don't have to block to wait for completion,
-- 
2.30.0





More information about the dm-devel mailing list