lkml.org 
[lkml]   [1999]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectscsi_do_cmd question
Hi All,

I've recently been messing with the scsi-idle patch and converted it so
that it works with 2.2.0 kernels.

I have a question about the scsi_do_cmd() function.

I have to pass a buffer as the 3rd argument to scsi_do_cmd, like this:

[...]
unsigned char *buffer = (unsigned char *) scsi_malloc(512);
[...]
scsi_do_cmd(SCpnt, (void *) cmd, (void *) buffer, 512,
sd_start_done, SD_TIMEOUT, MAX_RETRIES);
[...]

The original patch passed NULL for the buffer, and 0 for the length. But
that caused an oops on my system when I did:

/sbin/scsi-stop /dev/sda
ls /var/spool/news (mount point of sda2)

The oops was in swapper, so the system locked. By passing a 512 byte
buffer to the system call, the oops is avoided and the scsi-idle patch
works great.

Now the questions are:

1) Am I right, you have to pass a buffer?
2) If the answer to (1) is yes, take a look at this code from
scsi_ioctl.c:ioctl_internal_command()

{
struct semaphore sem = MUTEX_LOCKED;
SCpnt->request.sem = &sem;
scsi_do_cmd(SCpnt, cmd, NULL, 0, scsi_ioctl_done, timeout,
retries);
spin_unlock_irqrestore(&io_request_lock, flags);
down(&sem);
spin_lock_irqsave(&io_request_lock, flags);
SCpnt->request.sem = NULL;
}

scsi_do_cmd is called with a NULL buffer there. Why does that instance
work OK? (I'm presuming it *does* work OK?)

Jon.


--
Jon Evans


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:49    [W:0.022 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site