1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
--- ./kernel/block-io.c.orig
+++ ./kernel/block-io.c
@@ -155,14 +155,14 @@
{
struct blockio_data *bio_data = volume->private;
struct block_device *bdev;
- int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
+ int flags = FMODE_EXCL | FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
int err = 0;
bio_data->path = kstrdup(path, GFP_KERNEL);
if (!bio_data->path)
return -ENOMEM;
- bdev = open_bdev_exclusive(path, flags, THIS_MODULE);
+ bdev = blkdev_get_by_path(path, flags, THIS_MODULE);
if (IS_ERR(bdev)) {
err = PTR_ERR(bdev);
eprintk("Can't open device %s, error %d\n", path, err);
@@ -250,10 +250,10 @@
blockio_detach(struct iet_volume *volume)
{
struct blockio_data *bio_data = volume->private;
- int flags = FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
+ int flags = FMODE_EXCL | FMODE_READ | (LUReadonly(volume) ? 0 : FMODE_WRITE);
if (bio_data->bdev)
- close_bdev_exclusive(bio_data->bdev, flags);
+ blkdev_put(bio_data->bdev, flags);
kfree(bio_data->path);
kfree(volume->private);
|