From: scameron@beardog.cce.hp.com
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Wei Yongjun <weiyj.lk@gmail.com>,
yongjun_wei@trendmicro.com.cn, iss_storagedev@hp.com,
linux-scsi@vger.kernel.org, scameron@beardog.cce.hp.com
Subject: Re: [PATCH] [SCSI] hpsa: fix return value check in start_controller_lockup_detector()
Date: Wed, 30 Oct 2013 08:33:15 -0500 [thread overview]
Message-ID: <20131030133315.GD31390@beardog.cce.hp.com> (raw)
In-Reply-To: <1383083558.2071.38.camel@dabdike.int.hansenpartnership.com>
On Tue, Oct 29, 2013 at 02:52:38PM -0700, James Bottomley wrote:
> On Tue, 2013-10-29 at 11:09 -0500, scameron@beardog.cce.hp.com wrote:
> > On Tue, Oct 29, 2013 at 02:43:56PM +0800, Wei Yongjun wrote:
> > > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > >
> > > In case of error, the function kthread_run() returns ERR_PTR()
> > > and never returns NULL. The NULL test in the return value check
> > > should be replaced with IS_ERR().
> > >
> > > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> > > ---
> > > drivers/scsi/hpsa.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> > > index 891c86b..f413b14 100644
> > > --- a/drivers/scsi/hpsa.c
> > > +++ b/drivers/scsi/hpsa.c
> > > @@ -4757,7 +4757,8 @@ static void start_controller_lockup_detector(struct ctlr_info *h)
> > > kthread_run(detect_controller_lockup_thread,
> > > NULL, HPSA);
> > > }
> > > - if (!hpsa_lockup_detector) {
> > > + if (IS_ERR(hpsa_lockup_detector)) {
> > > + hpsa_lockup_detector = NULL;
> > > dev_warn(&h->pdev->dev,
> > > "Could not start lockup detector thread\n");
> > > return;
> >
> > Ack.
>
> Hmm, this whole lockup thread start/stop thing is horribly racy with
> hotplug (and bind and unbind).
>
> Firstly, why do you need an actual thread, why not just use a workqueue?
> That way you don't need a list or a lock, you can just schedule work for
> each instance? since they don't interfere, no global list and no lock.
>
> If you insist on a thread, it should probably start at module insertion
> and be shut down at module removal, so no races. You can have it sleep
> forever on list_empty(&hpsa_ctlr_list) and wake it when you add a
> controller.
Alright, I'll work on it. Thanks.
-- steve
prev parent reply other threads:[~2013-10-30 13:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-29 6:43 [PATCH] [SCSI] hpsa: fix return value check in start_controller_lockup_detector() Wei Yongjun
2013-10-29 16:09 ` scameron
2013-10-29 21:52 ` James Bottomley
2013-10-30 13:33 ` scameron [this message]
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=20131030133315.GD31390@beardog.cce.hp.com \
--to=scameron@beardog.cce.hp.com \
--cc=James.Bottomley@HansenPartnership.com \
--cc=iss_storagedev@hp.com \
--cc=linux-scsi@vger.kernel.org \
--cc=weiyj.lk@gmail.com \
--cc=yongjun_wei@trendmicro.com.cn \
/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).