* [PATCH] scsi/st: remove BKL from open
@ 2010-06-01 21:16 Arnd Bergmann
0 siblings, 0 replies; 4+ messages in thread
From: Arnd Bergmann @ 2010-06-01 21:16 UTC (permalink / raw)
To: James E.J. Bottomley
Cc: Arnd Bergmann, Willem Riede, Kai Mäkisara,
James E.J. Bottomley, osst-users, linux-scsi, linux-kernel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]
The st_open function is serialized through the st_dev_arr_lock
and the STp->in_use flag, so there is no race that the BKL
can protect against in the driver itself, and the function
does not access any global state outside of the driver that
might be protected with the BKL.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Willem Riede <osst@riede.org>
Cc: "Kai Mäkisara" <Kai.Makisara@kolumbus.fi>
Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
Cc: osst-users@lists.sourceforge.net
Cc: linux-scsi@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
drivers/scsi/st.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 24211d0..8d4c4bb 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -39,7 +39,6 @@ static const char *verstr = "20081215";
#include <linux/cdev.h>
#include <linux/delay.h>
#include <linux/mutex.h>
-#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/dma.h>
@@ -1180,7 +1179,6 @@ static int st_open(struct inode *inode, struct file *filp)
int dev = TAPE_NR(inode);
char *name;
- lock_kernel();
/*
* 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
@@ -1188,10 +1186,8 @@ static int st_open(struct inode *inode, struct file *filp)
*/
filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
- if (!(STp = scsi_tape_get(dev))) {
- unlock_kernel();
+ if (!(STp = scsi_tape_get(dev)))
return -ENXIO;
- }
write_lock(&st_dev_arr_lock);
filp->private_data = STp;
@@ -1200,7 +1196,6 @@ static int st_open(struct inode *inode, struct file *filp)
if (STp->in_use) {
write_unlock(&st_dev_arr_lock);
scsi_tape_put(STp);
- unlock_kernel();
DEB( printk(ST_DEB_MSG "%s: Device already in use.\n", name); )
return (-EBUSY);
}
@@ -1249,14 +1244,12 @@ static int st_open(struct inode *inode, struct file *filp)
retval = (-EIO);
goto err_out;
}
- unlock_kernel();
return 0;
err_out:
normalize_buffer(STp->buffer);
STp->in_use = 0;
scsi_tape_put(STp);
- unlock_kernel();
return retval;
}
--
1.7.0.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi/st: remove BKL from open
2010-04-30 2:18 ` Frederic Weisbecker
@ 2010-04-30 19:03 ` Kai Makisara
0 siblings, 0 replies; 4+ messages in thread
From: Kai Makisara @ 2010-04-30 19:03 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: Arnd Bergmann, dgilbert, Jens Axboe, Vivek Goyal, Tejun Heo,
FUJITA Tomonori, Martin K. Petersen, Steven Rostedt, Ingo Molnar,
John Kacur, linux-scsi, linux-kernel, James Bottomley
On Fri, 30 Apr 2010, Frederic Weisbecker wrote:
> On Thu, Apr 15, 2010 at 10:51:38PM +0200, Arnd Bergmann wrote:
> > The st_open function is serialized through the st_dev_arr_lock
> > and the STp->in_use flag, so there is no race that the BKL
> > can protect against in the driver itself, and the function
> > does not access any global state outside of the driver that
> > might be protected with the BKL.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > ---
>
>
>
> Kai, can we get your ack on this?
>
I am sorry, I have forgotten to send it.
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Thanks,
Kai
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] scsi/st: remove BKL from open
2010-04-15 20:51 ` [PATCH] scsi/st: remove BKL from open Arnd Bergmann
@ 2010-04-30 2:18 ` Frederic Weisbecker
2010-04-30 19:03 ` Kai Makisara
0 siblings, 1 reply; 4+ messages in thread
From: Frederic Weisbecker @ 2010-04-30 2:18 UTC (permalink / raw)
To: Arnd Bergmann, Kai Makisara
Cc: dgilbert, Jens Axboe, Vivek Goyal, Tejun Heo, FUJITA Tomonori,
Martin K. Petersen, Steven Rostedt, Ingo Molnar, John Kacur,
linux-scsi, linux-kernel, James Bottomley
On Thu, Apr 15, 2010 at 10:51:38PM +0200, Arnd Bergmann wrote:
> The st_open function is serialized through the st_dev_arr_lock
> and the STp->in_use flag, so there is no race that the BKL
> can protect against in the driver itself, and the function
> does not access any global state outside of the driver that
> might be protected with the BKL.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Kai, can we get your ack on this?
Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] scsi/st: remove BKL from open
2010-04-15 20:03 ` Kai Makisara
@ 2010-04-15 20:51 ` Arnd Bergmann
2010-04-30 2:18 ` Frederic Weisbecker
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2010-04-15 20:51 UTC (permalink / raw)
To: Kai Makisara
Cc: dgilbert, Jens Axboe, Vivek Goyal, Tejun Heo,
Frederic Weisbecker, FUJITA Tomonori, Martin K. Petersen,
Steven Rostedt, Ingo Molnar, John Kacur, linux-scsi,
linux-kernel
The st_open function is serialized through the st_dev_arr_lock
and the STp->in_use flag, so there is no race that the BKL
can protect against in the driver itself, and the function
does not access any global state outside of the driver that
might be protected with the BKL.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/scsi/st.c | 9 +--------
1 files changed, 1 insertions(+), 8 deletions(-)
On Thursday 15 April 2010 22:03:24 Kai Makisara wrote:
> BKL does not have any "hidden duties" in open() in st.c. I don't know any
> reason why it would be needed, but, because I have not been absolutely
> sure, I have not removed it. (The tape devices are not opened often and so
> the overhead has been negligible. That is, while BKL has been available.)
> If you don't see any reason for BKL in open(), go ahead and remove it.
Ok, that certainly simplifies the sg.c conversion. Thanks!
Arnd
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 3ea1a71..b1462e0 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -39,7 +39,6 @@ static const char *verstr = "20081215";
#include <linux/cdev.h>
#include <linux/delay.h>
#include <linux/mutex.h>
-#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/dma.h>
@@ -1180,7 +1179,6 @@ static int st_open(struct inode *inode, struct file *filp)
int dev = TAPE_NR(inode);
char *name;
- lock_kernel();
/*
* 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
@@ -1188,10 +1186,8 @@ static int st_open(struct inode *inode, struct file *filp)
*/
filp->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
- if (!(STp = scsi_tape_get(dev))) {
- unlock_kernel();
+ if (!(STp = scsi_tape_get(dev)))
return -ENXIO;
- }
write_lock(&st_dev_arr_lock);
filp->private_data = STp;
@@ -1200,7 +1196,6 @@ static int st_open(struct inode *inode, struct file *filp)
if (STp->in_use) {
write_unlock(&st_dev_arr_lock);
scsi_tape_put(STp);
- unlock_kernel();
DEB( printk(ST_DEB_MSG "%s: Device already in use.\n", name); )
return (-EBUSY);
}
@@ -1249,14 +1244,12 @@ static int st_open(struct inode *inode, struct file *filp)
retval = (-EIO);
goto err_out;
}
- unlock_kernel();
return 0;
err_out:
normalize_buffer(STp->buffer);
STp->in_use = 0;
scsi_tape_put(STp);
- unlock_kernel();
return retval;
}
--
1.7.0.4
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-01 21:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-01 21:16 [PATCH] scsi/st: remove BKL from open Arnd Bergmann
-- strict thread matches above, loose matches on Subject: below --
2010-04-14 20:36 [PATCH 1/2] [RFC] block: replace BKL with global mutex Arnd Bergmann
2010-04-15 14:29 ` Arnd Bergmann
2010-04-15 20:03 ` Kai Makisara
2010-04-15 20:51 ` [PATCH] scsi/st: remove BKL from open Arnd Bergmann
2010-04-30 2:18 ` Frederic Weisbecker
2010-04-30 19:03 ` Kai Makisara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®