Re: [PATCH v5 01/10] scsi: scsi_debug: create scsi_debug directory in the debugfs filesystem
On 2023/9/28 9:13, Douglas Gilbert wrote: On 2023-09-22 05:28, Wenchao Hao wrote: Create directory scsi_debug in the root of the debugfs filesystem. Prepare to add interface for manage error injection. Acked-by: Douglas Gilbert Signed-off-by: Wenchao Hao --- drivers/scsi/scsi_debug.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 9c0af50501f9..35c336271b13 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -862,6 +863,8 @@ static const int device_qfull_result = static const int condition_met_result = SAM_STAT_CONDITION_MET; +static struct dentry *sdebug_debugfs_root; + /* Only do the extra work involved in logical block provisioning if one or * more of the lbpu, lbpws or lbpws10 parameters are given and we are doing @@ -7011,6 +7014,8 @@ static int __init scsi_debug_init(void) goto driver_unreg; } + sdebug_debugfs_root = debugfs_create_dir("scsi_debug", NULL); debugfs_create_dir() can fail and return NULL. Looking at other drivers, most seem to assume it will work. Since the scsi_debug driver is often used to test abnormal situations, perhaps adding something like: if (!sdebug_debugfs_root) pr_info("%s: failed to create initial debugfs directory\n", __func__); might save someone a bit of time if a NULL dereference on sdebug_debugfs_root follows later. That is what the mpt3sas driver does. Yes, I would fix it by checking return value of debugfs related call after your review suggestions for other patches. Doug Gilbert + for (k = 0; k < hosts_to_add; k++) { if (want_store && k == 0) { ret = sdebug_add_host_helper(idx); @@ -7057,6 +7062,7 @@ static void __exit scsi_debug_exit(void) sdebug_erase_all_stores(false); xa_destroy(per_store_ap); + debugfs_remove(sdebug_debugfs_root); } device_initcall(scsi_debug_init); -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/382fe161-95fb-3249-32cf-07058f81a4bc%40huawei.com.
Re: [PATCH v5 01/10] scsi: scsi_debug: create scsi_debug directory in the debugfs filesystem
On 2023-09-22 05:28, Wenchao Hao wrote: Create directory scsi_debug in the root of the debugfs filesystem. Prepare to add interface for manage error injection. Acked-by: Douglas Gilbert Signed-off-by: Wenchao Hao --- drivers/scsi/scsi_debug.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 9c0af50501f9..35c336271b13 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -862,6 +863,8 @@ static const int device_qfull_result = static const int condition_met_result = SAM_STAT_CONDITION_MET; +static struct dentry *sdebug_debugfs_root; + /* Only do the extra work involved in logical block provisioning if one or * more of the lbpu, lbpws or lbpws10 parameters are given and we are doing @@ -7011,6 +7014,8 @@ static int __init scsi_debug_init(void) goto driver_unreg; } + sdebug_debugfs_root = debugfs_create_dir("scsi_debug", NULL); debugfs_create_dir() can fail and return NULL. Looking at other drivers, most seem to assume it will work. Since the scsi_debug driver is often used to test abnormal situations, perhaps adding something like: if (!sdebug_debugfs_root) pr_info("%s: failed to create initial debugfs directory\n", __func__); might save someone a bit of time if a NULL dereference on sdebug_debugfs_root follows later. That is what the mpt3sas driver does. Doug Gilbert + for (k = 0; k < hosts_to_add; k++) { if (want_store && k == 0) { ret = sdebug_add_host_helper(idx); @@ -7057,6 +7062,7 @@ static void __exit scsi_debug_exit(void) sdebug_erase_all_stores(false); xa_destroy(per_store_ap); + debugfs_remove(sdebug_debugfs_root); } device_initcall(scsi_debug_init); -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/8c7cfe09-d145-4387-91cf-da9d4e2398e1%40interlog.com.
Re: [PATCH v5 00/10] scsi:scsi_debug: Add error injection for single device
Doug, > The original error injection mechanism was based on scsi_host which > could not inject fault for a single SCSI device. > > This patchset provides the ability to inject errors for a single SCSI > device. Now we supports inject timeout errors, queuecommand errors, > and hostbyte, driverbyte, statusbyte, and sense data for specific SCSI > Command. Two new error injection is defined to make abort command or > reset LUN failed. Please review patches 7 through 10. Thank you! -- Martin K. Petersen Oracle Linux Engineering -- You received this message because you are subscribed to the Google Groups "open-iscsi" group. To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/open-iscsi/yq1ttrfzkz5.fsf%40ca-mkp.ca.oracle.com.