Re: [PATCH 1/5] target: Fix race between multiple invocations of target_qf_do_work()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Sep 17, 2011 at 12:23:36PM -0700, Linus Torvalds wrote:
> > With multiple CPUs running this code, one CPU can end up deleting the
> > list entry that the other CPU is about to work on.
> >
> > Fix this by splicing the list entries onto a local list and then
> > operating on that in the work function.
> 
> Umm. It sounds like what you really want is just a single-threaded workqueue.
> 
> Wouldn't it be better to do the alloc_workqueue with WQ_UNBOUND, and a
> max limit of a single thread? There's a helper function for it:
> alloc_ordered_workqueue().
> 
> I dunno. Maybe there's a reason why you actually do want threaded
> workqueues, but your description makes it sound like this would be
> better resolved by simply using an ordered on.

The right fix is to restructure the code at an higher level, and queue
up each individual command to the workqueue, thus killing the list
entirely.  But that's not really in scope for 3.1 at this point.

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux