Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1a09803 authored by Hyeongseok Kim's avatar Hyeongseok Kim Committed by Gerrit - the friendly Code Review server
Browse files

dm verity: skip verity work on I/O errors when system is shutting down



If emergency system shutdown is called, like by thermal shutdown,
dm device could be alive when the block device couldn't process
I/O requests anymore. In this status, the handling of I/O errors
by new dm I/O requests or by those already in-flight can lead to
a verity corruption state, which is misjudgment.
So, skip verity work for I/O error when system is shutting down.

Change-Id: I7b2e79283bb5810cefe688bf43b9ae97030ce917
Reviewed-by: default avatarSami Tolvanen <samitolvanen@google.com>
Signed-off-by: default avatarHyeongseok Kim <hyeongseok@gmail.com>
Patch-mainline: dm-devel @ 12/03/20, 00:46
Signed-off-by: default avatarRavi Kumar Siddojigari <rsiddoji@codeaurora.org>
Signed-off-by: default avatarSrinivasarao P <spathi@codeaurora.org>
parent 6b33f0cf
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -67,6 +67,14 @@ struct dm_verity_prefetch_work {
struct buffer_aux {
	int hash_verified;
};
/*
 * While system shutdown, skip verity work for I/O error.
 */
static inline bool verity_is_system_shutting_down(void)
{
	return system_state == SYSTEM_HALT || system_state == SYSTEM_POWER_OFF
		|| system_state == SYSTEM_RESTART;
}

/*
 * Initialize struct buffer_aux for a freshly created buffer.
@@ -513,7 +521,8 @@ static void verity_end_io(struct bio *bio)
{
	struct dm_verity_io *io = bio->bi_private;

	if (bio->bi_error && !verity_fec_is_enabled(io->v)) {
	if (bio->bi_error &&
		(!verity_fec_is_enabled(io->v) || verity_is_system_shutting_down())) {
		verity_finish_io(io, bio->bi_error);
		return;
	}