From: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
To: Jack Wang <jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
Cc: David Dillow <dillowda-1Heg1YXhbW8@public.gmane.org>,
Vu Pham <vu-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Sebastian Riemer
<sebastian.riemer-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>,
linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH 1/3] IB/srp: Remove target from list before freeing Scsi_Host structure
Date: Thu, 10 Oct 2013 14:48:48 +0200 [thread overview]
Message-ID: <5256A230.9020007@acm.org> (raw)
In-Reply-To: <5256A183.3030404-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
On 10/10/13 14:45, Jack Wang wrote:
> On 10/10/2013 01:50 PM, Bart Van Assche wrote:
>> From: Vu Pham <vuhuong-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>>
>> Remove an SRP target from the SRP target list before invoking the
>> last scsi_host_put() call. This change is necessary because that
>> last put frees the memory that holds the srp_target_port structure.
>>
>> This patch prevents that the following kernel oops can be triggered:
>>
>> RIP: 0010:[<ffffffff810b00d0>] __lock_acquire+0x500/0x1570
>> Call Trace:
>> [<ffffffff810b11e4>] lock_acquire+0xa4/0x120
>> [<ffffffff81531206>] _spin_lock+0x36/0x70
>> [<ffffffffa01b6d8f>] srp_remove_work+0xef/0x180 [ib_srp]
>> [<ffffffff8109125c>] worker_thread+0x21c/0x3d0
>> [<ffffffff81096e86>] kthread+0x96/0xa0
>> [<ffffffff8100c20a>] child_rip+0xa/0x20
>>
>> Signed-off-by: Vu Pham <vuhuong-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>> [bvanassche: Modified path description and CC'ed stable]
>> Signed-off-by: Bart Van Assche <bvanassche-HInyCGIudOg@public.gmane.org>
>> Cc: David Dillow <dillowda-1Heg1YXhbW8@public.gmane.org>
>> Cc: Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>> Cc: Sebastian Riemer <sebastian.riemer-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
>> Cc: Jack Wang <jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
>> Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
>> ---
>> drivers/infiniband/ulp/srp/ib_srp.c | 9 +++++----
>> 1 file changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
>> index f93baf8..f1318a8 100644
>> --- a/drivers/infiniband/ulp/srp/ib_srp.c
>> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
>> @@ -534,6 +534,11 @@ static void srp_remove_target(struct srp_target_port *target)
>> ib_destroy_cm_id(target->cm_id);
>> srp_free_target_ib(target);
>> srp_free_req_data(target);
>> +
>> + spin_lock(&target->srp_host->target_lock);
>> + list_del(&target->list);
>> + spin_unlock(&target->srp_host->target_lock);
>> +
>> scsi_host_put(target->scsi_host);
>> }
>>
>> @@ -545,10 +550,6 @@ static void srp_remove_work(struct work_struct *work)
>> WARN_ON_ONCE(target->state != SRP_TARGET_REMOVED);
>>
>> srp_remove_target(target);
>> -
>> - spin_lock(&target->srp_host->target_lock);
>> - list_del(&target->list);
>> - spin_unlock(&target->srp_host->target_lock);
>> }
>
> Or move the 3 line code on top of srp_remove_target(target);?
That would break srp_conn_unique() - removal from the target list must
only happen after a DREQ has been sent by the initiator to the target.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-10-10 12:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 11:48 [PATCH 0/3] IB/srp patches for the stable tree Bart Van Assche
[not found] ` <5256941A.3040506-HInyCGIudOg@public.gmane.org>
2013-10-10 11:50 ` [PATCH 1/3] IB/srp: Remove target from list before freeing Scsi_Host structure Bart Van Assche
[not found] ` <52569485.8050708-HInyCGIudOg@public.gmane.org>
2013-10-10 12:45 ` Jack Wang
[not found] ` <5256A183.3030404-EIkl63zCoXaH+58JC4qpiA@public.gmane.org>
2013-10-10 12:48 ` Bart Van Assche [this message]
[not found] ` <5256A230.9020007-HInyCGIudOg@public.gmane.org>
2013-10-10 13:42 ` Jack Wang
2013-10-10 11:52 ` [PATCH 2/3] IB/srp: Avoid offlining operational SCSI devices Bart Van Assche
[not found] ` <52569501.5030108-HInyCGIudOg@public.gmane.org>
2013-10-10 12:31 ` Jack Wang
2013-10-10 11:53 ` [PATCH 3/3] IB/srp: Report receive errors correctly Bart Van Assche
2013-10-25 22:16 ` [PATCH 0/3] IB/srp patches for the stable tree David Dillow
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5256A230.9020007@acm.org \
--to=bvanassche-hinycgiudog@public.gmane.org \
--cc=dillowda-1Heg1YXhbW8@public.gmane.org \
--cc=jinpu.wang-EIkl63zCoXaH+58JC4qpiA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sebastian.riemer-EIkl63zCoXaH+58JC4qpiA@public.gmane.org \
--cc=vu-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).