public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 06/13] [scsi] changed ioctls to unlocked
@ 2009-03-24 21:12 stoyboyker
  2009-03-24 21:24 ` James Bottomley
  2009-03-25  4:21 ` Matthew Wilcox
  0 siblings, 2 replies; 4+ messages in thread
From: stoyboyker @ 2009-03-24 21:12 UTC (permalink / raw)
  To: linux-kernel; +Cc: Stoyan Gaydarov, James.Bottomley, linux-scsi

From: Stoyan Gaydarov <stoyboyker@gmail.com>

Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>
---
 drivers/scsi/osst.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
index 0ea78d9..80e7e98 100644
--- a/drivers/scsi/osst.c
+++ b/drivers/scsi/osst.c
@@ -4856,9 +4856,10 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp)
 
 
 /* The ioctl command */
-static int osst_ioctl(struct inode * inode,struct file * file,
-	 unsigned int cmd_in, unsigned long arg)
+static long osst_ioctl(struct file * file, unsigned int cmd_in,
+	unsigned long arg)
 {
+	lock_kernel();
 	int		      i, cmd_nr, cmd_type, blk, retval = 0;
 	struct st_modedef   * STm;
 	struct st_partstat  * STps;
@@ -4867,8 +4868,10 @@ static int osst_ioctl(struct inode * inode,struct file * file,
 	char		    * name  = tape_name(STp);
 	void	    __user  * p     = (void __user *)arg;
 
-	if (mutex_lock_interruptible(&STp->lock))
+	if (mutex_lock_interruptible(&STp->lock)) {
+		unlock_kernel();
 		return -ERESTARTSYS;
+	}
 
 #if DEBUG
 	if (debugging && !STp->in_use) {
@@ -5187,6 +5190,7 @@ out:
 
 	mutex_unlock(&STp->lock);
 
+	unlock_kernel();
 	return retval;
 }
 
@@ -5542,7 +5546,7 @@ static const struct file_operations osst_fops = {
 	.owner =        THIS_MODULE,
 	.read =         osst_read,
 	.write =        osst_write,
-	.ioctl =        osst_ioctl,
+	.unlocked_ioctl =        osst_ioctl,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl = osst_compat_ioctl,
 #endif
-- 
1.6.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 06/13] [scsi] changed ioctls to unlocked
  2009-03-24 21:12 [PATCH 06/13] [scsi] changed ioctls to unlocked stoyboyker
@ 2009-03-24 21:24 ` James Bottomley
  2009-03-24 21:28   ` Stoyan Gaydarov
  2009-03-25  4:21 ` Matthew Wilcox
  1 sibling, 1 reply; 4+ messages in thread
From: James Bottomley @ 2009-03-24 21:24 UTC (permalink / raw)
  To: stoyboyker; +Cc: linux-kernel, linux-scsi, osst

On Tue, 2009-03-24 at 16:12 -0500, stoyboyker@gmail.com wrote:
> From: Stoyan Gaydarov <stoyboyker@gmail.com>
> 
> Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>
> ---
>  drivers/scsi/osst.c |   12 ++++++++----
>  1 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
> index 0ea78d9..80e7e98 100644
> --- a/drivers/scsi/osst.c
> +++ b/drivers/scsi/osst.c
> @@ -4856,9 +4856,10 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp)
>  
> 
>  /* The ioctl command */
> -static int osst_ioctl(struct inode * inode,struct file * file,
> -	 unsigned int cmd_in, unsigned long arg)
> +static long osst_ioctl(struct file * file, unsigned int cmd_in,
> +	unsigned long arg)
>  {
> +	lock_kernel();

What necessitates the kernel locking?  When st was audited, it didn't
need it; since osst is in many ways a copy of st, I'm surprised it does.

James



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 06/13] [scsi] changed ioctls to unlocked
  2009-03-24 21:24 ` James Bottomley
@ 2009-03-24 21:28   ` Stoyan Gaydarov
  0 siblings, 0 replies; 4+ messages in thread
From: Stoyan Gaydarov @ 2009-03-24 21:28 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-kernel, linux-scsi, osst

On Tue, Mar 24, 2009 at 4:24 PM, James Bottomley
<James.Bottomley@hansenpartnership.com> wrote:
> On Tue, 2009-03-24 at 16:12 -0500, stoyboyker@gmail.com wrote:
>> From: Stoyan Gaydarov <stoyboyker@gmail.com>
>>
>> Signed-off-by: Stoyan Gaydarov <stoyboyker@gmail.com>
>> ---
>>  drivers/scsi/osst.c |   12 ++++++++----
>>  1 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c
>> index 0ea78d9..80e7e98 100644
>> --- a/drivers/scsi/osst.c
>> +++ b/drivers/scsi/osst.c
>> @@ -4856,9 +4856,10 @@ static int os_scsi_tape_close(struct inode * inode, struct file * filp)
>>
>>
>>  /* The ioctl command */
>> -static int osst_ioctl(struct inode * inode,struct file * file,
>> -      unsigned int cmd_in, unsigned long arg)
>> +static long osst_ioctl(struct file * file, unsigned int cmd_in,
>> +     unsigned long arg)
>>  {
>> +     lock_kernel();
>
> What necessitates the kernel locking?  When st was audited, it didn't
> need it; since osst is in many ways a copy of st, I'm surprised it does.
>
> James

The lock was there before, because it is used before calling
osst_ioctl, my patches don't change any functionality. It is meant to
show the maintainers of the code that the lock is there and to allow
them make a decision as to how best to handle the code without the
kernel locking. If it is not needed then the locks can be removed and
the function call can remain under the unlocked_ioctl.

-Stoyan

>
>
>



-- 

-Stoyan

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 06/13] [scsi] changed ioctls to unlocked
  2009-03-24 21:12 [PATCH 06/13] [scsi] changed ioctls to unlocked stoyboyker
  2009-03-24 21:24 ` James Bottomley
@ 2009-03-25  4:21 ` Matthew Wilcox
  1 sibling, 0 replies; 4+ messages in thread
From: Matthew Wilcox @ 2009-03-25  4:21 UTC (permalink / raw)
  To: stoyboyker; +Cc: linux-kernel, James.Bottomley, linux-scsi

On Tue, Mar 24, 2009 at 04:12:41PM -0500, stoyboyker@gmail.com wrote:
> +static long osst_ioctl(struct file * file, unsigned int cmd_in,
> +	unsigned long arg)
>  {
> +	lock_kernel();
>  	int		      i, cmd_nr, cmd_type, blk, retval = 0;

Did you try compiling this?  If so, what compiler did you use?  You
*should* have got an error about mixing code and declarations.

-- 
Matthew Wilcox				Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step."

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-03-25  4:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-24 21:12 [PATCH 06/13] [scsi] changed ioctls to unlocked stoyboyker
2009-03-24 21:24 ` James Bottomley
2009-03-24 21:28   ` Stoyan Gaydarov
2009-03-25  4:21 ` Matthew Wilcox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox