On Sun, 28 Sep 2008, Boaz Harrosh wrote: > Alan Stern wrote: > > James and Boaz: > > > > Here's a question. Suppose a device returns NOT READY sense key > > repeatedly. How long should the request be retried before we give up? > > If we never give up then the request will never finish, so the caller > > will hang. > > > > Alan Stern > > > I always thought request->retries was for that. Perhaps I misunderstood. Maybe it is intended for that purpose, but it isn't being used as far as I can tell. req->retries is never decremented; instead scmd->allowed is initialized to req->retries when the request is prepped. But when a command fails and scsi_requeue_command() is called, the request is un-prepped and put back on the queue. Then it is prepped again and a new scmd is created -- with the same number of retries as before. Thus we will never run out of retries. > I think there should be one user settable global counter that will limit > all retries of any kind. You're missing a major point. Suppose for example that the device returns NOT READY because a new medium is being loaded, a procedure that takes a couple of seconds. But the SCSI core doesn't wait between retries; a new command is sent as soon as the old one fails. A retry limit of 10 could easily be used up in a fraction of a second, and then the request would fail. Is this how it's supposed to work? Would it be better to invoke the error handler for this sort of thing? Alan Stern -- 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