On Tue, 20 Jan 2009 17:00:09 -0500 Tony Battersby <tonyb@xxxxxxxxxxxxxxx> wrote: > sg_io_owned needs to be set before the command is sent to the midlevel; > otherwise, a quickly-completing command may cause a different CPU > to see "srp->done == 1 && !srp->sg_io_owned", which would lead to > incorrect behavior. > > Check srp->done and set srp->orphan while holding rq_list_lock to > prevent races with sg_rq_end_io(). > > There is no need to check sfp->closed from read/write/ioctl/poll/etc. > since the kernel guarantees that this won't happen. > > The usefulness of sg_srp_done() was questionable before; now it is > definitely not needed. > > Signed-off-by: Tony Battersby <tonyb@xxxxxxxxxxxxxxx> > --- > > Compared to the previous version of this patch, this version removes > sg_srp_done() and the unnecessary check for sfp->closed. > > sg.c | 39 ++++++++++++++------------------------- It looks ok to me. Better (simpler) than the first version. I guess that we could simplify 'done' and 'orphan' stuff a bit more but we can do later on. -- 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