Re: block test failure with scsi_debug

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

 



Hi,

在 2023/06/21 15:02, Shinichiro Kawasaki 写道:
CC+: Yu Kuai, linux-scsi,

On Jun 21, 2023 / 02:46, Shinichiro Kawasaki wrote:
On Jun 20, 2023 / 06:11, Chaitanya Kulkarni wrote:
Hi,

I found few failures, are you also getting the same ?

linux-block/for-next observed block test failure :-

Yes, I've jtried the kernel on linux-block/for-next at git hash 334bdb61bbea,
and see the same failure symptoms. It looks that the first test case block/001
left scsi_debug in weird status, and following test cases were affected.

I tried simple commands below and found that scsi_debug module unload fails.

     # modprobe scsi_debug
     # modprobe -r scsi_debug
     modprobe: FATAL: Module scsi_debug is in use.

Thanks for the test, this is because /dev/sg will grab reference for
scsi_device, and this will block remove module.

I tested following patch can work, I'll send a fix.

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 2433eeef042a..dcb73787c29d 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1497,7 +1497,7 @@ sg_add_device(struct device *cl_dev)
        int error;
        unsigned long iflags;

-       error = scsi_device_get(scsidp);
+       error = blk_get_queue(scsidp->request_queue);
        if (error)
                return error;

@@ -1558,7 +1558,7 @@ sg_add_device(struct device *cl_dev)
 out:
        if (cdev)
                cdev_del(cdev);
-       scsi_device_put(scsidp);
+       blk_put_queue(scsidp->request_queue);
        return error;
 }

@@ -1575,7 +1575,7 @@ sg_device_destroy(struct kref *kref)
         */

        blk_trace_remove(q);
-       scsi_device_put(sdp->device);
+       blk_put_queue(q);

        write_lock_irqsave(&sg_index_lock, flags);
        idr_remove(&sg_index_idr, sdp->index);


I'll try to bisect and identify which commit triggers the unload failure.

The commit db59133e9279 ("scsi: sg: fix blktrace debugfs entries leakage") [1]
triggers the scsi_debug unload failure on my test system.

Yu, could you check the failure symptom?

[1] https://lore.kernel.org/linux-block/20230610022003.2557284-3-yukuai1@xxxxxxxxxxxxxxx/
.





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux