* [PATCHv2] st: remove st_mutex
@ 2012-09-10 22:36 Lee Duncan
2012-09-23 7:25 ` Kai Makisara
2012-09-24 9:06 ` James Bottomley
0 siblings, 2 replies; 4+ messages in thread
From: Lee Duncan @ 2012-09-10 22:36 UTC (permalink / raw)
To: linux-scsi; +Cc: James Bottomley, Kai Mäkisara, Hannes Reinecke
From: Hannes Reinecke <hare@suse.com>
The st_mutex was created when the BKL was removed, and
prevents simultaneous st_open calls. It is better to
protect just the necessary data.
Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
This patch is based on the "misc" branch of the SCSI tree
and the 5-patch series for st sent by Jeff Mahoney 8/18/2012
and Ack-ed by Kai on 8/20.
Changes in v2: patch meta-data corrected
---
drivers/scsi/st.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index ceca095..98156a9 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -75,7 +75,6 @@ static const char *verstr = "20101219";
#include "st_options.h"
#include "st.h"
-static DEFINE_MUTEX(st_mutex);
static int buffer_kbs;
static int max_sg_segs;
static int try_direct_io = TRY_DIRECT_IO;
@@ -1185,7 +1184,6 @@ static int st_open(struct inode *inode, struct file *filp)
int dev = TAPE_NR(inode);
char *name;
- mutex_lock(&st_mutex);
/*
* We really want to do nonseekable_open(inode, filp); here, but some
* versions of tar incorrectly call lseek on tapes and bail out if that
@@ -1194,7 +1192,6 @@ static int st_open(struct inode *inode, struct file *filp)
filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
if (!(STp = scsi_tape_get(dev))) {
- mutex_unlock(&st_mutex);
return -ENXIO;
}
@@ -1205,7 +1202,6 @@ static int st_open(struct inode *inode, struct file *filp)
if (STp->in_use) {
spin_unlock(&st_use_lock);
scsi_tape_put(STp);
- mutex_unlock(&st_mutex);
DEB( printk(ST_DEB_MSG "%s: Device already in use.\n", name); )
return (-EBUSY);
}
@@ -1259,16 +1255,16 @@ static int st_open(struct inode *inode, struct file *filp)
retval = (-EIO);
goto err_out;
}
- mutex_unlock(&st_mutex);
return 0;
err_out:
normalize_buffer(STp->buffer);
+ spin_lock(&st_use_lock);
STp->in_use = 0;
+ spin_unlock(&st_use_lock);
scsi_tape_put(STp);
if (resumed)
scsi_autopm_put_device(STp->device);
- mutex_unlock(&st_mutex);
return retval;
}
--
1.7.11.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCHv2] st: remove st_mutex
2012-09-10 22:36 [PATCHv2] st: remove st_mutex Lee Duncan
@ 2012-09-23 7:25 ` Kai Makisara
2012-09-24 9:06 ` James Bottomley
1 sibling, 0 replies; 4+ messages in thread
From: Kai Makisara @ 2012-09-23 7:25 UTC (permalink / raw)
To: Lee Duncan; +Cc: linux-scsi, James Bottomley, Hannes Reinecke
[-- Attachment #1: Type: TEXT/PLAIN, Size: 572 bytes --]
On Mon, 10 Sep 2012, Lee Duncan wrote:
> From: Hannes Reinecke <hare@suse.com>
>
> The st_mutex was created when the BKL was removed, and
> prevents simultaneous st_open calls. It is better to
> protect just the necessary data.
>
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> Reviewed-by: Lee Duncan <lduncan@suse.com>
Acked-by: Kai Mäkisara <Kai.Makisara@kolumbus.fi>
>
> This patch is based on the "misc" branch of the SCSI tree
> and the 5-patch series for st sent by Jeff Mahoney 8/18/2012
> and Ack-ed by Kai on 8/20.
>
Thanks,
Kai
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] st: remove st_mutex
2012-09-10 22:36 [PATCHv2] st: remove st_mutex Lee Duncan
2012-09-23 7:25 ` Kai Makisara
@ 2012-09-24 9:06 ` James Bottomley
2012-09-24 17:16 ` Lee Duncan
1 sibling, 1 reply; 4+ messages in thread
From: James Bottomley @ 2012-09-24 9:06 UTC (permalink / raw)
To: Lee Duncan; +Cc: linux-scsi, Kai Mäkisara, Hannes Reinecke
On Mon, 2012-09-10 at 15:36 -0700, Lee Duncan wrote:
> From: Hannes Reinecke <hare@suse.com>
>
> The st_mutex was created when the BKL was removed, and
> prevents simultaneous st_open calls. It is better to
> protect just the necessary data.
>
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> Reviewed-by: Lee Duncan <lduncan@suse.com>
That should be Signed-off-by since you sent the patch to me. Signoffs
have to follow the chain of transmission. I've assumed this was just a
mistype.
James
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCHv2] st: remove st_mutex
2012-09-24 9:06 ` James Bottomley
@ 2012-09-24 17:16 ` Lee Duncan
0 siblings, 0 replies; 4+ messages in thread
From: Lee Duncan @ 2012-09-24 17:16 UTC (permalink / raw)
To: James Bottomley; +Cc: linux-scsi
On 09/24/2012 02:06 AM, James Bottomley wrote:
> On Mon, 2012-09-10 at 15:36 -0700, Lee Duncan wrote:
>> From: Hannes Reinecke <hare@suse.com>
>>
>> The st_mutex was created when the BKL was removed, and
>> prevents simultaneous st_open calls. It is better to
>> protect just the necessary data.
>>
>> Signed-off-by: Hannes Reinecke <hare@suse.com>
>> Reviewed-by: Lee Duncan <lduncan@suse.com>
>
> That should be Signed-off-by since you sent the patch to me. Signoffs
> have to follow the chain of transmission. I've assumed this was just a
> mistype.
>
> James
Thank you James.
--
Lee Duncan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-09-24 17:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-10 22:36 [PATCHv2] st: remove st_mutex Lee Duncan
2012-09-23 7:25 ` Kai Makisara
2012-09-24 9:06 ` James Bottomley
2012-09-24 17:16 ` Lee Duncan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).