[PATCH] scsi: ratelimit error messages

2017-01-22 Thread Wei Fang
printk_ratelimited() will lose the messages printked by sdev_printk(), maybe we should remove all printk_ratelimit() in scsi layer next time by rewriting sdev_printk(). Signed-off-by: Wei Fang --- drivers/scsi/scsi_lib.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a

[PATCH v4] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-12 Thread Wei Fang
respects the blocked flag and once in scsi_sysfs_add_sdev() which doesn't. Since the second set is entirely spurious, simply remove it to fix the problem. Reported-by: Zengxi Chen Signed-off-by: Wei Fang Reviewed-by: Ewan D. Milne --- Changes v1->v2: - don't modify scsi_internal_d

Re: [PATCH v3] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-12 Thread Wei Fang
Hi, James, Ewan, On 2016/12/13 0:43, James Bottomley wrote: > On Mon, 2016-12-12 at 11:23 -0500, Ewan D. Milne wrote: >> On Mon, 2016-12-12 at 10:20 +0800, Wei Fang wrote: >>> A race between scanning and fc_remote_port_delete() may result in a >>> permanent stop if the

[PATCH v3] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-11 Thread Wei Fang
respects the blocked flag and once in scsi_sysfs_add_sdev() which doesn't. Since the second set is entirely spurious, simply remove it to fix the problem. Reported-by: Zengxi Chen Signed-off-by: Wei Fang --- Changes v1->v2: - don't modify scsi_internal_device_unblock(), just re

Re: [PATCH v2] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-11 Thread Wei Fang
Hi, James, On 2016/12/10 0:02, James Bottomley wrote: > On Fri, 2016-12-09 at 17:35 +0800, Wei Fang wrote: >> A scan work can run simultaneously with fc_remote_port_delete(). >> If a scsi device is added to the ->__devices list in the scan work, >> it can be touche

[PATCH v2] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-09 Thread Wei Fang
v(). Reported-and-tested-by: Zengxi Chen Signed-off-by: Wei Fang --- Changes v1->v2: - don't modify scsi_internal_device_unblock(), just remove changing state to SDEV_RUNNING in scsi_sysfs_add_sdev(), suggested by James Bottomley and Ewan D. Milne. drivers/scsi/scsi_sysfs.c | 4

Re: [PATCH] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-08 Thread Wei Fang
On 2016/12/8 23:39, James Bottomley wrote: > On Thu, 2016-12-08 at 11:22 +0800, Wei Fang wrote: >> Hi, James, Ewan, >> >> On 2016/12/8 10:33, James Bottomley wrote: >>> On Thu, 2016-12-08 at 10:28 +0800, Wei Fang wrote: >>>> Hi, James, Ewan, >>

Re: [PATCH] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-07 Thread Wei Fang
Hi, James, Ewan, Bart, On 2016/12/8 11:22, Wei Fang wrote: > I looked through those code and found that if we fix this bug > by removing setting the state in scsi_sysfs_add_sdev(), it > can't be fixed completely: > > scsi_device_set_state(sdev, SDEV_RUNNING) i

Re: [PATCH] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-07 Thread Wei Fang
Hi, James, Ewan, On 2016/12/8 10:33, James Bottomley wrote: > On Thu, 2016-12-08 at 10:28 +0800, Wei Fang wrote: >> Hi, James, Ewan, >> >> On 2016/12/8 7:43, James Bottomley wrote: >>> On Wed, 2016-12-07 at 15:30 -0500, Ewan D. Milne wrote: >>>> On Wed,

Re: [PATCH] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-07 Thread Wei Fang
Hi, James, Ewan, On 2016/12/8 7:43, James Bottomley wrote: > On Wed, 2016-12-07 at 15:30 -0500, Ewan D. Milne wrote: >> On Wed, 2016-12-07 at 12:09 -0800, James Bottomley wrote: >>> Hm, it looks like the state set in scsi_sysfs_add_sdev() is bogus. >>> We expect the state to have been properly s

Re: [PATCH] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-06 Thread Wei Fang
Hi, Bart, On 2016/12/7 12:40, Bart Van Assche wrote: > I am aware that commit 5c10e63c943b caused the behavior change. But that > doesn't mean that a fix has to undo the changes introduced by that > commit. We do not only want to make sure that the SCSI core works as > intended but also that th

Re: [PATCH] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-06 Thread Wei Fang
Hi, Bart, On 2016/12/7 10:45, Bart Van Assche wrote: > On 12/06/16 17:21, Wei Fang wrote: >> The state of the scsi device first is changed to SDEV_BLOCK in >> scsi_add_lun() as you mentioned, then it will be changed to SDEV_RUNNING >> in scsi_sysfs_add_sdev(). > > Hel

Re: [PATCH] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-06 Thread Wei Fang
Hi, Bart, On 2016/12/6 23:51, Bart Van Assche wrote: > On 12/06/16 01:12, Wei Fang wrote: >> The scsi device is being setted to the SDEV_RUNNING state at the end of >> the scan work. When the remote port reappears, scsi_target_unblock() >> will be called, but the QUEUE_FLAG_

[PATCH] scsi: avoid a permanent stop of the scsi device's request queue

2016-12-06 Thread Wei Fang
restarting the device queue if the state is SDEV_RUNNING. Reported-by: Zengxi Chen Signed-off-by: Wei Fang --- drivers/scsi/scsi_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 9ca1f17..253ee74 100644 --- a/d

[RFC PATCH] scsi:fc: avoid a permanent stop of the scsi device's request queue

2016-11-15 Thread Wei Fang
his flag will not be cleared when the scsi device is being setted to the SDEV_RUNNING state in the end of the scan work. After that, all the requests sending to the device will be blocked. Fix this by flushing the scan work before blocking the device. Reported-by: Zengxi Chen Signed-off-by:

[RESEND PATCH] scsi: fix ata_port_wait_eh() hang caused by missing to wake up eh thread

2016-10-09 Thread Wei Fang
ead+0xfc/0x110 After that, the host is in recovery state, and any IOs to this host will be blocked. Fix this by accessing ->host_eh_schedule and ->shost_state in ->host_lock. We have tested the IOPS throughput by fio and found no performance degradation. Signed-off-by: Wei Fang --- driver

[PATCH] scsi: fix ata_port_wait_eh() hang caused by missing to wake up eh thread

2016-09-30 Thread Wei Fang
overy state, and any IOs to this host will be blocked. Fix this by accessing ->host_eh_schedule and ->shost_state in ->host_lock. Signed-off-by: Wei Fang --- drivers/scsi/scsi_lib.c | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/scsi

[PATCH v2] scsi:libsas: fix oops caused by assigning a freed task to ->lldd_task

2016-07-06 Thread Wei Fang
/0x438 [] worker_thread+0x144/0x4b0 [] kthread+0xfc/0x110 Fix this by reassigning NULL to ->lldd_task in error path. Signed-off-by: Wei Fang --- drivers/scsi/libsas/sas_ata.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_at

Re: [PATCH] scsi:libsas: fix oops caused by assigning a freed task to ->lldd_task

2016-07-06 Thread Wei Fang
Hi, Hannes, > This is most definitely wrong. > Sure you mean > > qc->lldd_task = NULL; > > in that line? My mistake. Thanks for pointing me out. Will resend soon. Please ignore this patch. Thanks, Wei -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a me

[PATCH] scsi:libsas: fix oops caused by assigning a freed task to ->lldd_task

2016-07-06 Thread Wei Fang
/0x438 [] worker_thread+0x144/0x4b0 [] kthread+0xfc/0x110 Fix this by reassigning NULL to ->lldd_task in error path. Signed-off-by: Wei Fang --- drivers/scsi/libsas/sas_ata.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_at

[PATCH v4 2/2] Documentation/scsi: update scsi_eh.txt about ->host_failed

2016-06-06 Thread Wei Fang
Update the new concurrency rules of ->host_failed. Signed-off-by: Wei Fang --- Documentation/scsi/scsi_eh.txt |8 ++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt index 8638f61..37eca00 100644 --

[PATCH v4 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-06-06 Thread Wei Fang
le, just remove the decrement in scsi_eh_finish_cmd() and zero ->host_busy after the strategy handle to fix this race. This fixes the problem introduced in commit 50824d6c5657 ("[SCSI] libsas: async ata-eh"). Reviewed-by: James Bottomley Signed-off-by: Wei Fang --- Changes v1->v2: - up

Re: [PATCH v3 2/2] Documentation/scsi: update scsi_eh.txt about ->host_failed

2016-06-06 Thread Wei Fang
On 2016/6/7 11:22, Martin K. Petersen wrote: >>>>>> "Wei" == Wei Fang writes: > > Wei, > > Wei> Update the new rules of ->host_failed. > > Are you going to incorporate the amendment from James? > Yes, I'll send the patch soon.

[PATCH v3 2/2] Documentation/scsi: update scsi_eh.txt about ->host_failed

2016-06-02 Thread Wei Fang
Update the new rules of ->host_failed. Signed-off-by: Wei Fang --- Documentation/scsi/scsi_eh.txt |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt index 8638f61..9702c78 100644 --- a/Documentation/s

Re: [PATCH 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-06-02 Thread Wei Fang
Forgot to add changes, please ignore it. On 2016/6/2 15:54, Wei Fang wrote: > sas_ata_strategy_handler() adds the works of the ata error handler > to system_unbound_wq. This workqueue asynchronously runs work items, > so the ata error handler will be performed concurrently on different &

[PATCH v3 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-06-02 Thread Wei Fang
le, just remove the decrement in scsi_eh_finish_cmd() and zero ->host_busy after the strategy handle to fix this race. This fixes the problem introduced in commit 50824d6c5657 ("[SCSI] libsas: async ata-eh"). Signed-off-by: Wei Fang --- Changes v1->v2: - update Documentation/scsi/scsi_eh

[PATCH 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-06-02 Thread Wei Fang
le, just remove the decrement in scsi_eh_finish_cmd() and zero ->host_busy after the strategy handle to fix this race. This fixes the problem introduced in commit 50824d6c5657 ("[SCSI] libsas: async ata-eh"). Signed-off-by: Wei Fang --- drivers/ata/libata-eh.c |2 +- drivers/scsi/s

[PATCH 2/2] Documentation/scsi: update scsi_eh.txt about ->host_failed

2016-06-02 Thread Wei Fang
Update the new rules of ->host_failed. Signed-off-by: Wei Fang --- Documentation/scsi/scsi_eh.txt |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt index 8638f61..9702c78 100644 --- a/Documentation/s

Re: [PATCH v2 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-06-01 Thread Wei Fang
On 2016/6/2 10:37, Wei Fang wrote: > Hi, Kevin, > > On 2016/6/1 22:36, Kevin Groeneveld wrote: >>> Subject: [PATCH v2 1/2] scsi: fix race between simultaneous decrements of >>> ->host_failed >> >> I wonder if this could be related to >> http:

Re: [PATCH v2 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-06-01 Thread Wei Fang
Hi, Kevin, On 2016/6/1 22:36, Kevin Groeneveld wrote: >> Subject: [PATCH v2 1/2] scsi: fix race between simultaneous decrements of >> ->host_failed > > I wonder if this could be related to > http://www.spinics.net/lists/linux-scsi/msg86808.html? > > I never did get to the bottom of that. If I

Re: [PATCH v2 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-06-01 Thread Wei Fang
Hi, James, On 2016/6/1 22:06, James Bottomley wrote: > On Tue, 2016-05-31 at 16:38 +0800, Wei Fang wrote: >> sas_ata_strategy_handler() adds the works of the ata error handler >> to system_unbound_wq. This workqueue asynchronously runs work items, >> so the ata error hand

Re: [PATCH v2 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-05-31 Thread Wei Fang
Hi, Tejun, On 2016/5/31 22:33, Tejun Heo wrote: > On Tue, May 31, 2016 at 04:38:17PM +0800, Wei Fang wrote: >> sas_ata_strategy_handler() adds the works of the ata error handler >> to system_unbound_wq. This workqueue asynchronously runs work items, > > Are there more th

[PATCH v2 1/2] scsi: fix race between simultaneous decrements of ->host_failed

2016-05-31 Thread Wei Fang
This fixes the problem introduced in commit 50824d6c5657 ("[SCSI] libsas: async ata-eh"). Reviewed-by: Christoph Hellwig Signed-off-by: Wei Fang --- drivers/ata/libata-eh.c |2 +- drivers/scsi/libsas/sas_scsi_host.c |5 +++-- drivers/scsi/scsi.c |

[PATCH v2 2/2] Documentation/scsi: update scsi_eh.txt about ->host_failed

2016-05-31 Thread Wei Fang
Update the new concurrency rules of ->host_failed. Signed-off-by: Wei Fang --- Documentation/scsi/scsi_eh.txt |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/scsi/scsi_eh.txt b/Documentation/scsi/scsi_eh.txt index 8638f61..e6d0de2 100644 --

Re: [PATCH] scsi: fix race between simultaneous decrements of ->host_failed

2016-05-30 Thread Wei Fang
Hi, Christoph, On 2016/5/29 14:54, Christoph Hellwig wrote: > On Sat, May 28, 2016 at 11:51:11AM +0800, Wei Fang wrote: >> async_sas_ata_eh(), which will call scsi_eh_finish_cmd() in some case, >> would be performed simultaneously in sas_ata_strategy_handler(). In this >> ca

Re: [PATCH] scsi: fix race between simultaneous decrements of ->host_failed

2016-05-30 Thread Wei Fang
Hi James, Christoph, On 2016/5/29 23:41, James Bottomley wrote: > On Sat, 2016-05-28 at 23:54 -0700, Christoph Hellwig wrote: >> On Sat, May 28, 2016 at 11:51:11AM +0800, Wei Fang wrote: >>> async_sas_ata_eh(), which will call scsi_eh_finish_cmd() in some >>&g

[PATCH] scsi: fix race between simultaneous decrements of ->host_failed

2016-05-27 Thread Wei Fang
ual between ->host_failed and ->host_busy. Then SCSI error handler thread won't become running, SCSI errors after that won't be handled forever. Use atomic type for ->host_failed to fix this race. Signed-off-by: Wei Fang --- drivers/ata/libata-eh.c |2 +

Re: [PATCH v3 08/32] scsi: hisi_sas: add hisi_sas_remove

2015-11-09 Thread Wei Fang
Hi John, On 2015/11/10 0:32, John Garry wrote: > This patch also includes relevant memory/pool > free'ing and sas/scsi host removal > > Signed-off-by: John Garry > --- > drivers/scsi/hisi_sas/hisi_sas_main.c | 71 > ++- > 1 file changed, 70 insertions(+), 1 dele