]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/block/brd.c
Merge branch 'for-2.6.37/barrier' of git://git.kernel.dk/linux-2.6-block
[karo-tx-linux.git] / drivers / block / brd.c
index fa33f97722babc52ca0a9405100e5a8dfc899ca2..b7f51e4594f8660f0a54472d264d957dbe533312 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/blkdev.h>
 #include <linux/bio.h>
 #include <linux/highmem.h>
-#include <linux/smp_lock.h>
+#include <linux/mutex.h>
 #include <linux/radix-tree.h>
 #include <linux/buffer_head.h> /* invalidate_bh_lrus() */
 #include <linux/slab.h>
@@ -55,6 +55,7 @@ struct brd_device {
 /*
  * Look up and return a brd's page for a given sector.
  */
+static DEFINE_MUTEX(brd_mutex);
 static struct page *brd_lookup_page(struct brd_device *brd, sector_t sector)
 {
        pgoff_t idx;
@@ -402,7 +403,7 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode,
         * ram device BLKFLSBUF has special semantics, we want to actually
         * release and destroy the ramdisk data.
         */
-       lock_kernel();
+       mutex_lock(&brd_mutex);
        mutex_lock(&bdev->bd_mutex);
        error = -EBUSY;
        if (bdev->bd_openers <= 1) {
@@ -419,7 +420,7 @@ static int brd_ioctl(struct block_device *bdev, fmode_t mode,
                error = 0;
        }
        mutex_unlock(&bdev->bd_mutex);
-       unlock_kernel();
+       mutex_unlock(&brd_mutex);
 
        return error;
 }