Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756826Ab0DOUv4 (ORCPT ); Thu, 15 Apr 2010 16:51:56 -0400 Received: from moutng.kundenserver.de ([212.227.126.171]:54511 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756539Ab0DOUvz (ORCPT ); Thu, 15 Apr 2010 16:51:55 -0400 From: Arnd Bergmann To: Kai Makisara Subject: [PATCH] scsi/st: remove BKL from open Date: Thu, 15 Apr 2010 22:51:38 +0200 User-Agent: KMail/1.13.2 (Linux/2.6.31-19-generic; KDE/4.4.2; x86_64; ; ) Cc: dgilbert@interlog.com, Jens Axboe , Vivek Goyal , Tejun Heo , Frederic Weisbecker , FUJITA Tomonori , "Martin K. Petersen" , Steven Rostedt , Ingo Molnar , John Kacur , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org References: <1271277384-7627-1-git-send-email-arnd@arndb.de> <201004151629.45029.arnd@arndb.de> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201004152251.39636.arnd@arndb.de> X-Provags-ID: V01U2FsdGVkX193/0aRw53K3xDSP1zwkxkYY8ql8oqfn+cS8lR 5e6FEQb6cX5x4C555lSFygp4Xq7VMk3q1LW7DXQZX2xl4W8L+p JjEvWCgddn5oeBzBA/Mhw== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2679 Lines: 86 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 --- 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 #include #include -#include #include #include @@ -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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/