From: Borislav Petkov <petkovbb@googlemail.com>
To: David Miller <davem@davemloft.net>
Cc: linux-ide <linux-ide@vger.kernel.org>
Subject: [PATCH] ide-tape: remove the BKL
Date: Sun, 11 Oct 2009 12:25:19 +0200 [thread overview]
Message-ID: <20091011102519.GA2641@liondog.tnic> (raw)
Hi,
one less BKL user. Tested on a Seagate STT8000A, ATAPI TAPE drive.
---
>From 16e58d4d74a5f3a02204e2fe861d2cb3b3ee65fb Mon Sep 17 00:00:00 2001
From: Borislav Petkov <petkovbb@gmail.com>
Date: Mon, 5 Oct 2009 07:57:26 +0200
Subject: [PATCH] ide-tape: remove the BKL
Replace the BKL calls in the chrdev_{open,release} interfaces with a
simple sleeping mutex.
Signed-off-by: Borislav Petkov <petkovbb@gmail.com>
---
drivers/ide/ide-tape.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index 58fc920..6a0e625 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -221,6 +221,8 @@ typedef struct ide_tape_obj {
static DEFINE_MUTEX(idetape_ref_mutex);
+static DEFINE_MUTEX(idetape_chrdev_mutex);
+
static struct class *idetape_sysfs_class;
static void ide_tape_release(struct device *);
@@ -1457,10 +1459,11 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
if (i >= MAX_HWIFS * MAX_DRIVES)
return -ENXIO;
- lock_kernel();
+ mutex_lock(&idetape_chrdev_mutex);
+
tape = ide_tape_get(NULL, true, i);
if (!tape) {
- unlock_kernel();
+ mutex_unlock(&idetape_chrdev_mutex);
return -ENXIO;
}
@@ -1519,12 +1522,15 @@ static int idetape_chrdev_open(struct inode *inode, struct file *filp)
tape->door_locked = DOOR_LOCKED;
}
}
- unlock_kernel();
+ mutex_unlock(&idetape_chrdev_mutex);
+
return 0;
out_put_tape:
ide_tape_put(tape);
- unlock_kernel();
+
+ mutex_unlock(&idetape_chrdev_mutex);
+
return retval;
}
@@ -1551,7 +1557,8 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
ide_drive_t *drive = tape->drive;
unsigned int minor = iminor(inode);
- lock_kernel();
+ mutex_lock(&idetape_chrdev_mutex);
+
tape = drive->driver_data;
ide_debug_log(IDE_DBG_FUNC, "enter");
@@ -1575,7 +1582,9 @@ static int idetape_chrdev_release(struct inode *inode, struct file *filp)
}
clear_bit(ilog2(IDE_AFLAG_BUSY), &drive->atapi_flags);
ide_tape_put(tape);
- unlock_kernel();
+
+ mutex_unlock(&idetape_chrdev_mutex);
+
return 0;
}
--
1.6.3.3
--
Regards/Gruss,
Boris.
next reply other threads:[~2009-10-11 10:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-11 10:25 Borislav Petkov [this message]
2009-10-29 10:10 ` [PATCH] ide-tape: remove the BKL David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091011102519.GA2641@liondog.tnic \
--to=petkovbb@googlemail.com \
--cc=davem@davemloft.net \
--cc=linux-ide@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox