Message ID | 20240923174833.45345-1-thenzl@redhat.com |
---|---|
State | New |
Headers | show |
Series | megaraid_sas: fix for a potential deadlock | expand |
On 9/23/24 19:48, Tomas Henzl wrote: > This fixes a 'possible circular locking dependency detected' warning > CPU0 CPU1 > ---- ---- > lock(&instance->reset_mutex); > lock(&shost->scan_mutex); > lock(&instance->reset_mutex); > lock(&shost->scan_mutex); > > > Fix this but temporarily releasing the reset_mutex. > > Signed-off-by: Tomas Henzl <thenzl@redhat.com> > --- > drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c > index 6c79c350a4d5..253cc1159661 100644 > --- a/drivers/scsi/megaraid/megaraid_sas_base.c > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c > @@ -8907,8 +8907,11 @@ megasas_aen_polling(struct work_struct *work) > (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL), > (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL), > 0); > - if (sdev1) > + if (sdev1) { > + mutex_unlock(&instance->reset_mutex); > megasas_remove_scsi_device(sdev1); > + mutex_lock(&instance->reset_mutex); > + } > > event_type = SCAN_VD_CHANNEL; > break; Hi Chandrakanth, can you please review this patch? Thanks, Tomas
On Tue, Nov 5, 2024 at 9:57 PM Tomas Henzl <thenzl@redhat.com> wrote: > > On 9/23/24 19:48, Tomas Henzl wrote: > > This fixes a 'possible circular locking dependency detected' warning > > CPU0 CPU1 > > ---- ---- > > lock(&instance->reset_mutex); > > lock(&shost->scan_mutex); > > lock(&instance->reset_mutex); > > lock(&shost->scan_mutex); > > > > > > Fix this but temporarily releasing the reset_mutex. > > > > Signed-off-by: Tomas Henzl <thenzl@redhat.com> > > --- > > drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c > > index 6c79c350a4d5..253cc1159661 100644 > > --- a/drivers/scsi/megaraid/megaraid_sas_base.c > > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c > > @@ -8907,8 +8907,11 @@ megasas_aen_polling(struct work_struct *work) > > (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL), > > (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL), > > 0); > > - if (sdev1) > > + if (sdev1) { > > + mutex_unlock(&instance->reset_mutex); > > megasas_remove_scsi_device(sdev1); > > + mutex_lock(&instance->reset_mutex); > > + } > > > > event_type = SCAN_VD_CHANNEL; > > break; > > Hi Chandrakanth, > > can you please review this patch? > > Thanks, Tomas > Patch looks good to me. Acked-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
On Mon, Sep 23, 2024 at 11:18 PM Tomas Henzl <thenzl@redhat.com> wrote: > > This fixes a 'possible circular locking dependency detected' warning > CPU0 CPU1 > ---- ---- > lock(&instance->reset_mutex); > lock(&shost->scan_mutex); > lock(&instance->reset_mutex); > lock(&shost->scan_mutex); > > > Fix this but temporarily releasing the reset_mutex. > > Signed-off-by: Tomas Henzl <thenzl@redhat.com> > --- > drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c > index 6c79c350a4d5..253cc1159661 100644 > --- a/drivers/scsi/megaraid/megaraid_sas_base.c > +++ b/drivers/scsi/megaraid/megaraid_sas_base.c > @@ -8907,8 +8907,11 @@ megasas_aen_polling(struct work_struct *work) > (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL), > (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL), > 0); > - if (sdev1) > + if (sdev1) { > + mutex_unlock(&instance->reset_mutex); > megasas_remove_scsi_device(sdev1); > + mutex_lock(&instance->reset_mutex); > + } > > event_type = SCAN_VD_CHANNEL; > break; > -- > 2.46.0 > Patch looks good to me. Acked-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Chandrakanth,
>> This fixes a 'possible circular locking dependency detected' warning
Applied to 6.13/scsi-staging, thanks!
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c index 6c79c350a4d5..253cc1159661 100644 --- a/drivers/scsi/megaraid/megaraid_sas_base.c +++ b/drivers/scsi/megaraid/megaraid_sas_base.c @@ -8907,8 +8907,11 @@ megasas_aen_polling(struct work_struct *work) (ld_target_id / MEGASAS_MAX_DEV_PER_CHANNEL), (ld_target_id % MEGASAS_MAX_DEV_PER_CHANNEL), 0); - if (sdev1) + if (sdev1) { + mutex_unlock(&instance->reset_mutex); megasas_remove_scsi_device(sdev1); + mutex_lock(&instance->reset_mutex); + } event_type = SCAN_VD_CHANNEL; break;
This fixes a 'possible circular locking dependency detected' warning CPU0 CPU1 ---- ---- lock(&instance->reset_mutex); lock(&shost->scan_mutex); lock(&instance->reset_mutex); lock(&shost->scan_mutex); Fix this but temporarily releasing the reset_mutex. Signed-off-by: Tomas Henzl <thenzl@redhat.com> --- drivers/scsi/megaraid/megaraid_sas_base.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)