Re: [6.1.0-rc4-next-20221109] Boot time warning kernel/module/main.c:852

From: Bart Van Assche
Date: Thu Nov 10 2022 - 12:44:46 EST


On 11/10/22 00:01, Sachin Sant wrote:
While booting 6.1.0-rc4-next-20221109 next kernel on a IBM Power9 LPAR
following warning is seen:

[ 8.808868] ------------[ cut here ]------------
[ 8.808872] WARNING: CPU: 1 PID: 378 at kernel/module/main.c:852 module_put+0x48/0x100
[ 8.809024] sd 1:0:0:1: [sdc] Write cache: disabled, read cache: enabled, supports DPO and FUA
[ 8.809024] LR [c0000000009ee680] scsi_device_put+0x50/0x70
[ 8.809035] Call Trace:
[ 8.809038] [c000000007c37b10] [c000000007c37b50] 0xc000000007c37b50 (unreliable)
[ 8.809045] [c000000007c37b50] [c0000000009ee674] scsi_device_put+0x44/0x70
[ 8.809053] [c000000007c37b80] [c000000000a10c70] alua_rtpg_work+0x210/0x920
[ 8.809059] [c000000007c37c90] [c000000000182314] process_one_work+0x2b4/0x5b0
[ 8.809066] [c000000007c37d30] [c000000000182688] worker_thread+0x78/0x600
[ 8.809072] [c000000007c37dc0] [c00000000018f4f4] kthread+0x124/0x130
[ 8.809079] [c000000007c37e10] [c00000000000cffc] ret_from_kernel_thread+0x5c/0x64
[ 8.809086] Instruction dump:
[ 8.809090] f821ffc1 41820034 395e03c0 7c0004ac 7d205028 2c090001 3929ffff 41c00010
[ 8.809101] 7d20512d
[ 8.809101] sd 1:0:0:1: [sdc] Preferred minimum I/O size 32768 bytes
[ 8.809102] 40c2ffec 7c0004ac 79290fe2 <0b090000> 60000000 38210040 ebc1fff0
[ 8.809115] ---[ end trace 0000000000000000 ]—

-next-20221108 was good. Git bisect points to following

commit 0b25e17e9018a0ea68a9f0b4787672e8c68fa8d5
Date: Mon Oct 31 15:47:25 2022 -0700
scsi: alua: Move a scsi_device_put() call out of alua_check_vpd()

Reverting this patch gets rid of the warning.

Hi Sachin,

Thanks for the detailed report. Does the patch below help?

diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
index 693cd827e138..d2cf15338724 100644
--- a/drivers/scsi/device_handler/scsi_dh_alua.c
+++ b/drivers/scsi/device_handler/scsi_dh_alua.c
@@ -1025,7 +1025,7 @@ static bool __must_check alua_rtpg_queue(struct alua_port_group *pg,
kref_put(&pg->kref, release_port_group);
}

- return true;
+ return sdev != NULL;
}

/*