diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-08-07 12:25:34 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2010-08-07 12:25:34 -0400 |
commit | 6e9624b8caec290d28b4c6d9ec75749df6372b87 (patch) | |
tree | 47225b544e1da82742795553dc4e8aa70c17afdc /drivers | |
parent | 8a6cfeb6deca3a8fefd639d898b0d163c0b5d368 (diff) |
block: push down BKL into .open and .release
The open and release block_device_operations are currently
called with the BKL held. In order to change that, we must
first make sure that all drivers that currently rely
on this have no regressions.
This blindly pushes the BKL into all .open and .release
operations for all block drivers to prepare for the
next step. The drivers can subsequently replace the BKL
with their own locks or remove it completely when it can
be shown that it is not needed.
The functions blkdev_get and blkdev_put are the only
remaining users of the big kernel lock in the block
layer, besides a few uses in the ioctl code, none
of which need to serialize with blkdev_{get,put}.
Most of these two functions is also under the protection
of bdev->bd_mutex, including the actual calls to
->open and ->release, and the common code does not
access any global data structures that need the BKL.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'drivers')
37 files changed, 326 insertions, 39 deletions
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index c5f22bb0a48e..4e2c367fec11 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -79,23 +79,28 @@ static int DAC960_open(struct block_device *bdev, fmode_t mode) | |||
79 | struct gendisk *disk = bdev->bd_disk; | 79 | struct gendisk *disk = bdev->bd_disk; |
80 | DAC960_Controller_T *p = disk->queue->queuedata; | 80 | DAC960_Controller_T *p = disk->queue->queuedata; |
81 | int drive_nr = (long)disk->private_data; | 81 | int drive_nr = (long)disk->private_data; |
82 | int ret = -ENXIO; | ||
82 | 83 | ||
84 | lock_kernel(); | ||
83 | if (p->FirmwareType == DAC960_V1_Controller) { | 85 | if (p->FirmwareType == DAC960_V1_Controller) { |
84 | if (p->V1.LogicalDriveInformation[drive_nr]. | 86 | if (p->V1.LogicalDriveInformation[drive_nr]. |
85 | LogicalDriveState == DAC960_V1_LogicalDrive_Offline) | 87 | LogicalDriveState == DAC960_V1_LogicalDrive_Offline) |
86 | return -ENXIO; | 88 | goto out; |
87 | } else { | 89 | } else { |
88 | DAC960_V2_LogicalDeviceInfo_T *i = | 90 | DAC960_V2_LogicalDeviceInfo_T *i = |
89 | p->V2.LogicalDeviceInformation[drive_nr]; | 91 | p->V2.LogicalDeviceInformation[drive_nr]; |
90 | if (!i || i->LogicalDeviceState == DAC960_V2_LogicalDevice_Offline) | 92 | if (!i || i->LogicalDeviceState == DAC960_V2_LogicalDevice_Offline) |
91 | return -ENXIO; | 93 | goto out; |
92 | } | 94 | } |
93 | 95 | ||
94 | check_disk_change(bdev); | 96 | check_disk_change(bdev); |
95 | 97 | ||
96 | if (!get_capacity(p->disks[drive_nr])) | 98 | if (!get_capacity(p->disks[drive_nr])) |
97 | return -ENXIO; | 99 | goto out; |
98 | return 0; | 100 | ret = 0; |
101 | out: | ||
102 | unlock_kernel(); | ||
103 | return ret; | ||
99 | } | 104 | } |
100 | 105 | ||
101 | static int DAC960_getgeo(struct block_device *bdev, struct hd_geometry *geo) | 106 | static int DAC960_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 0fa26359304c..76f114f0bba3 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1555,10 +1555,13 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
1555 | int old_dev; | 1555 | int old_dev; |
1556 | unsigned long flags; | 1556 | unsigned long flags; |
1557 | 1557 | ||
1558 | lock_kernel(); | ||
1558 | old_dev = fd_device[drive]; | 1559 | old_dev = fd_device[drive]; |
1559 | 1560 | ||
1560 | if (fd_ref[drive] && old_dev != system) | 1561 | if (fd_ref[drive] && old_dev != system) { |
1562 | unlock_kernel(); | ||
1561 | return -EBUSY; | 1563 | return -EBUSY; |
1564 | } | ||
1562 | 1565 | ||
1563 | if (mode & (FMODE_READ|FMODE_WRITE)) { | 1566 | if (mode & (FMODE_READ|FMODE_WRITE)) { |
1564 | check_disk_change(bdev); | 1567 | check_disk_change(bdev); |
@@ -1571,8 +1574,10 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
1571 | fd_deselect (drive); | 1574 | fd_deselect (drive); |
1572 | rel_fdc(); | 1575 | rel_fdc(); |
1573 | 1576 | ||
1574 | if (wrprot) | 1577 | if (wrprot) { |
1578 | unlock_kernel(); | ||
1575 | return -EROFS; | 1579 | return -EROFS; |
1580 | } | ||
1576 | } | 1581 | } |
1577 | } | 1582 | } |
1578 | 1583 | ||
@@ -1589,6 +1594,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
1589 | printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, | 1594 | printk(KERN_INFO "fd%d: accessing %s-disk with %s-layout\n",drive, |
1590 | unit[drive].type->name, data_types[system].name); | 1595 | unit[drive].type->name, data_types[system].name); |
1591 | 1596 | ||
1597 | unlock_kernel(); | ||
1592 | return 0; | 1598 | return 0; |
1593 | } | 1599 | } |
1594 | 1600 | ||
@@ -1597,6 +1603,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
1597 | struct amiga_floppy_struct *p = disk->private_data; | 1603 | struct amiga_floppy_struct *p = disk->private_data; |
1598 | int drive = p - unit; | 1604 | int drive = p - unit; |
1599 | 1605 | ||
1606 | lock_kernel(); | ||
1600 | if (unit[drive].dirty == 1) { | 1607 | if (unit[drive].dirty == 1) { |
1601 | del_timer (flush_track_timer + drive); | 1608 | del_timer (flush_track_timer + drive); |
1602 | non_int_flush_track (drive); | 1609 | non_int_flush_track (drive); |
@@ -1610,6 +1617,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
1610 | /* the mod_use counter is handled this way */ | 1617 | /* the mod_use counter is handled this way */ |
1611 | floppy_off (drive | 0x40000000); | 1618 | floppy_off (drive | 0x40000000); |
1612 | #endif | 1619 | #endif |
1620 | unlock_kernel(); | ||
1613 | return 0; | 1621 | return 0; |
1614 | } | 1622 | } |
1615 | 1623 | ||
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c index 65deffde60ac..a946929735a5 100644 --- a/drivers/block/aoe/aoeblk.c +++ b/drivers/block/aoe/aoeblk.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/genhd.h> | 13 | #include <linux/genhd.h> |
14 | #include <linux/netdevice.h> | 14 | #include <linux/netdevice.h> |
15 | #include <linux/smp_lock.h> | ||
15 | #include "aoe.h" | 16 | #include "aoe.h" |
16 | 17 | ||
17 | static struct kmem_cache *buf_pool_cache; | 18 | static struct kmem_cache *buf_pool_cache; |
@@ -124,13 +125,16 @@ aoeblk_open(struct block_device *bdev, fmode_t mode) | |||
124 | struct aoedev *d = bdev->bd_disk->private_data; | 125 | struct aoedev *d = bdev->bd_disk->private_data; |
125 | ulong flags; | 126 | ulong flags; |
126 | 127 | ||
128 | lock_kernel(); | ||
127 | spin_lock_irqsave(&d->lock, flags); | 129 | spin_lock_irqsave(&d->lock, flags); |
128 | if (d->flags & DEVFL_UP) { | 130 | if (d->flags & DEVFL_UP) { |
129 | d->nopen++; | 131 | d->nopen++; |
130 | spin_unlock_irqrestore(&d->lock, flags); | 132 | spin_unlock_irqrestore(&d->lock, flags); |
133 | unlock_kernel(); | ||
131 | return 0; | 134 | return 0; |
132 | } | 135 | } |
133 | spin_unlock_irqrestore(&d->lock, flags); | 136 | spin_unlock_irqrestore(&d->lock, flags); |
137 | unlock_kernel(); | ||
134 | return -ENODEV; | 138 | return -ENODEV; |
135 | } | 139 | } |
136 | 140 | ||
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 1bb8bfcfdbd9..aceb96476524 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -1850,22 +1850,34 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
1850 | return 0; | 1850 | return 0; |
1851 | } | 1851 | } |
1852 | 1852 | ||
1853 | static int floppy_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
1854 | { | ||
1855 | int ret; | ||
1856 | |||
1857 | lock_kernel(); | ||
1858 | ret = floppy_open(bdev, mode); | ||
1859 | unlock_kernel(); | ||
1860 | |||
1861 | return ret; | ||
1862 | } | ||
1853 | 1863 | ||
1854 | static int floppy_release(struct gendisk *disk, fmode_t mode) | 1864 | static int floppy_release(struct gendisk *disk, fmode_t mode) |
1855 | { | 1865 | { |
1856 | struct atari_floppy_struct *p = disk->private_data; | 1866 | struct atari_floppy_struct *p = disk->private_data; |
1867 | lock_kernel(); | ||
1857 | if (p->ref < 0) | 1868 | if (p->ref < 0) |
1858 | p->ref = 0; | 1869 | p->ref = 0; |
1859 | else if (!p->ref--) { | 1870 | else if (!p->ref--) { |
1860 | printk(KERN_ERR "floppy_release with fd_ref == 0"); | 1871 | printk(KERN_ERR "floppy_release with fd_ref == 0"); |
1861 | p->ref = 0; | 1872 | p->ref = 0; |
1862 | } | 1873 | } |
1874 | unlock_kernel(); | ||
1863 | return 0; | 1875 | return 0; |
1864 | } | 1876 | } |
1865 | 1877 | ||
1866 | static const struct block_device_operations floppy_fops = { | 1878 | static const struct block_device_operations floppy_fops = { |
1867 | .owner = THIS_MODULE, | 1879 | .owner = THIS_MODULE, |
1868 | .open = floppy_open, | 1880 | .open = floppy_unlocked_open, |
1869 | .release = floppy_release, | 1881 | .release = floppy_release, |
1870 | .ioctl = fd_ioctl, | 1882 | .ioctl = fd_ioctl, |
1871 | .media_changed = check_floppy_change, | 1883 | .media_changed = check_floppy_change, |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index a6c0494dd054..665a470310a9 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -178,6 +178,7 @@ static void do_cciss_request(struct request_queue *q); | |||
178 | static irqreturn_t do_cciss_intx(int irq, void *dev_id); | 178 | static irqreturn_t do_cciss_intx(int irq, void *dev_id); |
179 | static irqreturn_t do_cciss_msix_intr(int irq, void *dev_id); | 179 | static irqreturn_t do_cciss_msix_intr(int irq, void *dev_id); |
180 | static int cciss_open(struct block_device *bdev, fmode_t mode); | 180 | static int cciss_open(struct block_device *bdev, fmode_t mode); |
181 | static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode); | ||
181 | static int cciss_release(struct gendisk *disk, fmode_t mode); | 182 | static int cciss_release(struct gendisk *disk, fmode_t mode); |
182 | static int do_ioctl(struct block_device *bdev, fmode_t mode, | 183 | static int do_ioctl(struct block_device *bdev, fmode_t mode, |
183 | unsigned int cmd, unsigned long arg); | 184 | unsigned int cmd, unsigned long arg); |
@@ -237,7 +238,7 @@ static int cciss_compat_ioctl(struct block_device *, fmode_t, | |||
237 | 238 | ||
238 | static const struct block_device_operations cciss_fops = { | 239 | static const struct block_device_operations cciss_fops = { |
239 | .owner = THIS_MODULE, | 240 | .owner = THIS_MODULE, |
240 | .open = cciss_open, | 241 | .open = cciss_unlocked_open, |
241 | .release = cciss_release, | 242 | .release = cciss_release, |
242 | .ioctl = do_ioctl, | 243 | .ioctl = do_ioctl, |
243 | .getgeo = cciss_getgeo, | 244 | .getgeo = cciss_getgeo, |
@@ -1042,13 +1043,28 @@ static int cciss_open(struct block_device *bdev, fmode_t mode) | |||
1042 | return 0; | 1043 | return 0; |
1043 | } | 1044 | } |
1044 | 1045 | ||
1046 | static int cciss_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
1047 | { | ||
1048 | int ret; | ||
1049 | |||
1050 | lock_kernel(); | ||
1051 | ret = cciss_open(bdev, mode); | ||
1052 | unlock_kernel(); | ||
1053 | |||
1054 | return ret; | ||
1055 | } | ||
1056 | |||
1045 | /* | 1057 | /* |
1046 | * Close. Sync first. | 1058 | * Close. Sync first. |
1047 | */ | 1059 | */ |
1048 | static int cciss_release(struct gendisk *disk, fmode_t mode) | 1060 | static int cciss_release(struct gendisk *disk, fmode_t mode) |
1049 | { | 1061 | { |
1050 | ctlr_info_t *host = get_host(disk); | 1062 | ctlr_info_t *host; |
1051 | drive_info_struct *drv = get_drv(disk); | 1063 | drive_info_struct *drv; |
1064 | |||
1065 | lock_kernel(); | ||
1066 | host = get_host(disk); | ||
1067 | drv = get_drv(disk); | ||
1052 | 1068 | ||
1053 | #ifdef CCISS_DEBUG | 1069 | #ifdef CCISS_DEBUG |
1054 | printk(KERN_DEBUG "cciss_release %s\n", disk->disk_name); | 1070 | printk(KERN_DEBUG "cciss_release %s\n", disk->disk_name); |
@@ -1056,6 +1072,7 @@ static int cciss_release(struct gendisk *disk, fmode_t mode) | |||
1056 | 1072 | ||
1057 | drv->usage_count--; | 1073 | drv->usage_count--; |
1058 | host->usage_count--; | 1074 | host->usage_count--; |
1075 | unlock_kernel(); | ||
1059 | return 0; | 1076 | return 0; |
1060 | } | 1077 | } |
1061 | 1078 | ||
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index c459aeea3c0c..28937b661564 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -158,7 +158,7 @@ static int sendcmd( | |||
158 | unsigned int blkcnt, | 158 | unsigned int blkcnt, |
159 | unsigned int log_unit ); | 159 | unsigned int log_unit ); |
160 | 160 | ||
161 | static int ida_open(struct block_device *bdev, fmode_t mode); | 161 | static int ida_unlocked_open(struct block_device *bdev, fmode_t mode); |
162 | static int ida_release(struct gendisk *disk, fmode_t mode); | 162 | static int ida_release(struct gendisk *disk, fmode_t mode); |
163 | static int ida_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg); | 163 | static int ida_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg); |
164 | static int ida_getgeo(struct block_device *bdev, struct hd_geometry *geo); | 164 | static int ida_getgeo(struct block_device *bdev, struct hd_geometry *geo); |
@@ -196,7 +196,7 @@ static inline ctlr_info_t *get_host(struct gendisk *disk) | |||
196 | 196 | ||
197 | static const struct block_device_operations ida_fops = { | 197 | static const struct block_device_operations ida_fops = { |
198 | .owner = THIS_MODULE, | 198 | .owner = THIS_MODULE, |
199 | .open = ida_open, | 199 | .open = ida_unlocked_open, |
200 | .release = ida_release, | 200 | .release = ida_release, |
201 | .ioctl = ida_ioctl, | 201 | .ioctl = ida_ioctl, |
202 | .getgeo = ida_getgeo, | 202 | .getgeo = ida_getgeo, |
@@ -841,13 +841,29 @@ static int ida_open(struct block_device *bdev, fmode_t mode) | |||
841 | return 0; | 841 | return 0; |
842 | } | 842 | } |
843 | 843 | ||
844 | static int ida_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
845 | { | ||
846 | int ret; | ||
847 | |||
848 | lock_kernel(); | ||
849 | ret = ida_open(bdev, mode); | ||
850 | unlock_kernel(); | ||
851 | |||
852 | return ret; | ||
853 | } | ||
854 | |||
844 | /* | 855 | /* |
845 | * Close. Sync first. | 856 | * Close. Sync first. |
846 | */ | 857 | */ |
847 | static int ida_release(struct gendisk *disk, fmode_t mode) | 858 | static int ida_release(struct gendisk *disk, fmode_t mode) |
848 | { | 859 | { |
849 | ctlr_info_t *host = get_host(disk); | 860 | ctlr_info_t *host; |
861 | |||
862 | lock_kernel(); | ||
863 | host = get_host(disk); | ||
850 | host->usage_count--; | 864 | host->usage_count--; |
865 | unlock_kernel(); | ||
866 | |||
851 | return 0; | 867 | return 0; |
852 | } | 868 | } |
853 | 869 | ||
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index e2ab13d99d69..d2b6764a7b1f 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -2604,6 +2604,7 @@ static int drbd_open(struct block_device *bdev, fmode_t mode) | |||
2604 | unsigned long flags; | 2604 | unsigned long flags; |
2605 | int rv = 0; | 2605 | int rv = 0; |
2606 | 2606 | ||
2607 | lock_kernel(); | ||
2607 | spin_lock_irqsave(&mdev->req_lock, flags); | 2608 | spin_lock_irqsave(&mdev->req_lock, flags); |
2608 | /* to have a stable mdev->state.role | 2609 | /* to have a stable mdev->state.role |
2609 | * and no race with updating open_cnt */ | 2610 | * and no race with updating open_cnt */ |
@@ -2618,6 +2619,7 @@ static int drbd_open(struct block_device *bdev, fmode_t mode) | |||
2618 | if (!rv) | 2619 | if (!rv) |
2619 | mdev->open_cnt++; | 2620 | mdev->open_cnt++; |
2620 | spin_unlock_irqrestore(&mdev->req_lock, flags); | 2621 | spin_unlock_irqrestore(&mdev->req_lock, flags); |
2622 | unlock_kernel(); | ||
2621 | 2623 | ||
2622 | return rv; | 2624 | return rv; |
2623 | } | 2625 | } |
@@ -2625,7 +2627,9 @@ static int drbd_open(struct block_device *bdev, fmode_t mode) | |||
2625 | static int drbd_release(struct gendisk *gd, fmode_t mode) | 2627 | static int drbd_release(struct gendisk *gd, fmode_t mode) |
2626 | { | 2628 | { |
2627 | struct drbd_conf *mdev = gd->private_data; | 2629 | struct drbd_conf *mdev = gd->private_data; |
2630 | lock_kernel(); | ||
2628 | mdev->open_cnt--; | 2631 | mdev->open_cnt--; |
2632 | unlock_kernel(); | ||
2629 | return 0; | 2633 | return 0; |
2630 | } | 2634 | } |
2631 | 2635 | ||
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 40419b066aa9..3126d5122b2b 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3616,6 +3616,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
3616 | { | 3616 | { |
3617 | int drive = (long)disk->private_data; | 3617 | int drive = (long)disk->private_data; |
3618 | 3618 | ||
3619 | lock_kernel(); | ||
3619 | mutex_lock(&open_lock); | 3620 | mutex_lock(&open_lock); |
3620 | if (UDRS->fd_ref < 0) | 3621 | if (UDRS->fd_ref < 0) |
3621 | UDRS->fd_ref = 0; | 3622 | UDRS->fd_ref = 0; |
@@ -3626,6 +3627,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
3626 | if (!UDRS->fd_ref) | 3627 | if (!UDRS->fd_ref) |
3627 | opened_bdev[drive] = NULL; | 3628 | opened_bdev[drive] = NULL; |
3628 | mutex_unlock(&open_lock); | 3629 | mutex_unlock(&open_lock); |
3630 | unlock_kernel(); | ||
3629 | 3631 | ||
3630 | return 0; | 3632 | return 0; |
3631 | } | 3633 | } |
@@ -3643,6 +3645,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
3643 | int res = -EBUSY; | 3645 | int res = -EBUSY; |
3644 | char *tmp; | 3646 | char *tmp; |
3645 | 3647 | ||
3648 | lock_kernel(); | ||
3646 | mutex_lock(&open_lock); | 3649 | mutex_lock(&open_lock); |
3647 | old_dev = UDRS->fd_device; | 3650 | old_dev = UDRS->fd_device; |
3648 | if (opened_bdev[drive] && opened_bdev[drive] != bdev) | 3651 | if (opened_bdev[drive] && opened_bdev[drive] != bdev) |
@@ -3719,6 +3722,7 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
3719 | goto out; | 3722 | goto out; |
3720 | } | 3723 | } |
3721 | mutex_unlock(&open_lock); | 3724 | mutex_unlock(&open_lock); |
3725 | unlock_kernel(); | ||
3722 | return 0; | 3726 | return 0; |
3723 | out: | 3727 | out: |
3724 | if (UDRS->fd_ref < 0) | 3728 | if (UDRS->fd_ref < 0) |
@@ -3729,6 +3733,7 @@ out: | |||
3729 | opened_bdev[drive] = NULL; | 3733 | opened_bdev[drive] = NULL; |
3730 | out2: | 3734 | out2: |
3731 | mutex_unlock(&open_lock); | 3735 | mutex_unlock(&open_lock); |
3736 | unlock_kernel(); | ||
3732 | return res; | 3737 | return res; |
3733 | } | 3738 | } |
3734 | 3739 | ||
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index d285a5481965..f3c636d23718 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -67,6 +67,7 @@ | |||
67 | #include <linux/compat.h> | 67 | #include <linux/compat.h> |
68 | #include <linux/suspend.h> | 68 | #include <linux/suspend.h> |
69 | #include <linux/freezer.h> | 69 | #include <linux/freezer.h> |
70 | #include <linux/smp_lock.h> | ||
70 | #include <linux/writeback.h> | 71 | #include <linux/writeback.h> |
71 | #include <linux/buffer_head.h> /* for invalidate_bdev() */ | 72 | #include <linux/buffer_head.h> /* for invalidate_bdev() */ |
72 | #include <linux/completion.h> | 73 | #include <linux/completion.h> |
@@ -1408,9 +1409,11 @@ static int lo_open(struct block_device *bdev, fmode_t mode) | |||
1408 | { | 1409 | { |
1409 | struct loop_device *lo = bdev->bd_disk->private_data; | 1410 | struct loop_device *lo = bdev->bd_disk->private_data; |
1410 | 1411 | ||
1412 | lock_kernel(); | ||
1411 | mutex_lock(&lo->lo_ctl_mutex); | 1413 | mutex_lock(&lo->lo_ctl_mutex); |
1412 | lo->lo_refcnt++; | 1414 | lo->lo_refcnt++; |
1413 | mutex_unlock(&lo->lo_ctl_mutex); | 1415 | mutex_unlock(&lo->lo_ctl_mutex); |
1416 | unlock_kernel(); | ||
1414 | 1417 | ||
1415 | return 0; | 1418 | return 0; |
1416 | } | 1419 | } |
@@ -1420,6 +1423,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode) | |||
1420 | struct loop_device *lo = disk->private_data; | 1423 | struct loop_device *lo = disk->private_data; |
1421 | int err; | 1424 | int err; |
1422 | 1425 | ||
1426 | lock_kernel(); | ||
1423 | mutex_lock(&lo->lo_ctl_mutex); | 1427 | mutex_lock(&lo->lo_ctl_mutex); |
1424 | 1428 | ||
1425 | if (--lo->lo_refcnt) | 1429 | if (--lo->lo_refcnt) |
@@ -1444,6 +1448,7 @@ static int lo_release(struct gendisk *disk, fmode_t mode) | |||
1444 | out: | 1448 | out: |
1445 | mutex_unlock(&lo->lo_ctl_mutex); | 1449 | mutex_unlock(&lo->lo_ctl_mutex); |
1446 | out_unlocked: | 1450 | out_unlocked: |
1451 | lock_kernel(); | ||
1447 | return 0; | 1452 | return 0; |
1448 | } | 1453 | } |
1449 | 1454 | ||
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index daba7a62a663..76f8565e1e8d 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -225,13 +225,21 @@ static char *pcd_buf; /* buffer for request in progress */ | |||
225 | static int pcd_block_open(struct block_device *bdev, fmode_t mode) | 225 | static int pcd_block_open(struct block_device *bdev, fmode_t mode) |
226 | { | 226 | { |
227 | struct pcd_unit *cd = bdev->bd_disk->private_data; | 227 | struct pcd_unit *cd = bdev->bd_disk->private_data; |
228 | return cdrom_open(&cd->info, bdev, mode); | 228 | int ret; |
229 | |||
230 | lock_kernel(); | ||
231 | ret = cdrom_open(&cd->info, bdev, mode); | ||
232 | unlock_kernel(); | ||
233 | |||
234 | return ret; | ||
229 | } | 235 | } |
230 | 236 | ||
231 | static int pcd_block_release(struct gendisk *disk, fmode_t mode) | 237 | static int pcd_block_release(struct gendisk *disk, fmode_t mode) |
232 | { | 238 | { |
233 | struct pcd_unit *cd = disk->private_data; | 239 | struct pcd_unit *cd = disk->private_data; |
240 | lock_kernel(); | ||
234 | cdrom_release(&cd->info, mode); | 241 | cdrom_release(&cd->info, mode); |
242 | unlock_kernel(); | ||
235 | return 0; | 243 | return 0; |
236 | } | 244 | } |
237 | 245 | ||
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index c4d6ed9846ca..985f0d4f1d1e 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c | |||
@@ -736,12 +736,14 @@ static int pd_open(struct block_device *bdev, fmode_t mode) | |||
736 | { | 736 | { |
737 | struct pd_unit *disk = bdev->bd_disk->private_data; | 737 | struct pd_unit *disk = bdev->bd_disk->private_data; |
738 | 738 | ||
739 | lock_kernel(); | ||
739 | disk->access++; | 740 | disk->access++; |
740 | 741 | ||
741 | if (disk->removable) { | 742 | if (disk->removable) { |
742 | pd_special_command(disk, pd_media_check); | 743 | pd_special_command(disk, pd_media_check); |
743 | pd_special_command(disk, pd_door_lock); | 744 | pd_special_command(disk, pd_door_lock); |
744 | } | 745 | } |
746 | unlock_kernel(); | ||
745 | return 0; | 747 | return 0; |
746 | } | 748 | } |
747 | 749 | ||
@@ -783,8 +785,10 @@ static int pd_release(struct gendisk *p, fmode_t mode) | |||
783 | { | 785 | { |
784 | struct pd_unit *disk = p->private_data; | 786 | struct pd_unit *disk = p->private_data; |
785 | 787 | ||
788 | lock_kernel(); | ||
786 | if (!--disk->access && disk->removable) | 789 | if (!--disk->access && disk->removable) |
787 | pd_special_command(disk, pd_door_unlock); | 790 | pd_special_command(disk, pd_door_unlock); |
791 | unlock_kernel(); | ||
788 | 792 | ||
789 | return 0; | 793 | return 0; |
790 | } | 794 | } |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 38b4d566b816..4457b494882a 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -300,20 +300,26 @@ static void __init pf_init_units(void) | |||
300 | static int pf_open(struct block_device *bdev, fmode_t mode) | 300 | static int pf_open(struct block_device *bdev, fmode_t mode) |
301 | { | 301 | { |
302 | struct pf_unit *pf = bdev->bd_disk->private_data; | 302 | struct pf_unit *pf = bdev->bd_disk->private_data; |
303 | int ret; | ||
303 | 304 | ||
305 | lock_kernel(); | ||
304 | pf_identify(pf); | 306 | pf_identify(pf); |
305 | 307 | ||
308 | ret = -ENODEV; | ||
306 | if (pf->media_status == PF_NM) | 309 | if (pf->media_status == PF_NM) |
307 | return -ENODEV; | 310 | goto out; |
308 | 311 | ||
312 | ret = -EROFS; | ||
309 | if ((pf->media_status == PF_RO) && (mode & FMODE_WRITE)) | 313 | if ((pf->media_status == PF_RO) && (mode & FMODE_WRITE)) |
310 | return -EROFS; | 314 | goto out; |
311 | 315 | ||
316 | ret = 0; | ||
312 | pf->access++; | 317 | pf->access++; |
313 | if (pf->removable) | 318 | if (pf->removable) |
314 | pf_lock(pf, 1); | 319 | pf_lock(pf, 1); |
315 | 320 | out: | |
316 | return 0; | 321 | unlock_kernel(); |
322 | return ret; | ||
317 | } | 323 | } |
318 | 324 | ||
319 | static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo) | 325 | static int pf_getgeo(struct block_device *bdev, struct hd_geometry *geo) |
@@ -354,14 +360,18 @@ static int pf_release(struct gendisk *disk, fmode_t mode) | |||
354 | { | 360 | { |
355 | struct pf_unit *pf = disk->private_data; | 361 | struct pf_unit *pf = disk->private_data; |
356 | 362 | ||
357 | if (pf->access <= 0) | 363 | lock_kernel(); |
364 | if (pf->access <= 0) { | ||
365 | unlock_kernel(); | ||
358 | return -EINVAL; | 366 | return -EINVAL; |
367 | } | ||
359 | 368 | ||
360 | pf->access--; | 369 | pf->access--; |
361 | 370 | ||
362 | if (!pf->access && pf->removable) | 371 | if (!pf->access && pf->removable) |
363 | pf_lock(pf, 0); | 372 | pf_lock(pf, 0); |
364 | 373 | ||
374 | unlock_kernel(); | ||
365 | return 0; | 375 | return 0; |
366 | 376 | ||
367 | } | 377 | } |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 40f1e31f42c4..b1cbeb59bb76 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2383,6 +2383,7 @@ static int pkt_open(struct block_device *bdev, fmode_t mode) | |||
2383 | 2383 | ||
2384 | VPRINTK(DRIVER_NAME": entering open\n"); | 2384 | VPRINTK(DRIVER_NAME": entering open\n"); |
2385 | 2385 | ||
2386 | lock_kernel(); | ||
2386 | mutex_lock(&ctl_mutex); | 2387 | mutex_lock(&ctl_mutex); |
2387 | pd = pkt_find_dev_from_minor(MINOR(bdev->bd_dev)); | 2388 | pd = pkt_find_dev_from_minor(MINOR(bdev->bd_dev)); |
2388 | if (!pd) { | 2389 | if (!pd) { |
@@ -2410,6 +2411,7 @@ static int pkt_open(struct block_device *bdev, fmode_t mode) | |||
2410 | } | 2411 | } |
2411 | 2412 | ||
2412 | mutex_unlock(&ctl_mutex); | 2413 | mutex_unlock(&ctl_mutex); |
2414 | unlock_kernel(); | ||
2413 | return 0; | 2415 | return 0; |
2414 | 2416 | ||
2415 | out_dec: | 2417 | out_dec: |
@@ -2417,6 +2419,7 @@ out_dec: | |||
2417 | out: | 2419 | out: |
2418 | VPRINTK(DRIVER_NAME": failed open (%d)\n", ret); | 2420 | VPRINTK(DRIVER_NAME": failed open (%d)\n", ret); |
2419 | mutex_unlock(&ctl_mutex); | 2421 | mutex_unlock(&ctl_mutex); |
2422 | unlock_kernel(); | ||
2420 | return ret; | 2423 | return ret; |
2421 | } | 2424 | } |
2422 | 2425 | ||
@@ -2425,6 +2428,7 @@ static int pkt_close(struct gendisk *disk, fmode_t mode) | |||
2425 | struct pktcdvd_device *pd = disk->private_data; | 2428 | struct pktcdvd_device *pd = disk->private_data; |
2426 | int ret = 0; | 2429 | int ret = 0; |
2427 | 2430 | ||
2431 | lock_kernel(); | ||
2428 | mutex_lock(&ctl_mutex); | 2432 | mutex_lock(&ctl_mutex); |
2429 | pd->refcnt--; | 2433 | pd->refcnt--; |
2430 | BUG_ON(pd->refcnt < 0); | 2434 | BUG_ON(pd->refcnt < 0); |
@@ -2433,6 +2437,7 @@ static int pkt_close(struct gendisk *disk, fmode_t mode) | |||
2433 | pkt_release_dev(pd, flush); | 2437 | pkt_release_dev(pd, flush); |
2434 | } | 2438 | } |
2435 | mutex_unlock(&ctl_mutex); | 2439 | mutex_unlock(&ctl_mutex); |
2440 | unlock_kernel(); | ||
2436 | return ret; | 2441 | return ret; |
2437 | } | 2442 | } |
2438 | 2443 | ||
diff --git a/drivers/block/swim.c b/drivers/block/swim.c index f04f74e3758f..2e46815876df 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c | |||
@@ -662,11 +662,23 @@ out: | |||
662 | return err; | 662 | return err; |
663 | } | 663 | } |
664 | 664 | ||
665 | static int floppy_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
666 | { | ||
667 | int ret; | ||
668 | |||
669 | lock_kernel(); | ||
670 | ret = floppy_open(bdev, mode); | ||
671 | unlock_kernel(); | ||
672 | |||
673 | return ret; | ||
674 | } | ||
675 | |||
665 | static int floppy_release(struct gendisk *disk, fmode_t mode) | 676 | static int floppy_release(struct gendisk *disk, fmode_t mode) |
666 | { | 677 | { |
667 | struct floppy_state *fs = disk->private_data; | 678 | struct floppy_state *fs = disk->private_data; |
668 | struct swim __iomem *base = fs->swd->base; | 679 | struct swim __iomem *base = fs->swd->base; |
669 | 680 | ||
681 | lock_kernel(); | ||
670 | if (fs->ref_count < 0) | 682 | if (fs->ref_count < 0) |
671 | fs->ref_count = 0; | 683 | fs->ref_count = 0; |
672 | else if (fs->ref_count > 0) | 684 | else if (fs->ref_count > 0) |
@@ -674,6 +686,7 @@ static int floppy_release(struct gendisk *disk, fmode_t mode) | |||
674 | 686 | ||
675 | if (fs->ref_count == 0) | 687 | if (fs->ref_count == 0) |
676 | swim_motor(base, OFF); | 688 | swim_motor(base, OFF); |
689 | unlock_kernel(); | ||
677 | 690 | ||
678 | return 0; | 691 | return 0; |
679 | } | 692 | } |
@@ -754,7 +767,7 @@ static int floppy_revalidate(struct gendisk *disk) | |||
754 | 767 | ||
755 | static const struct block_device_operations floppy_fops = { | 768 | static const struct block_device_operations floppy_fops = { |
756 | .owner = THIS_MODULE, | 769 | .owner = THIS_MODULE, |
757 | .open = floppy_open, | 770 | .open = floppy_unlocked_open, |
758 | .release = floppy_release, | 771 | .release = floppy_release, |
759 | .ioctl = floppy_ioctl, | 772 | .ioctl = floppy_ioctl, |
760 | .getgeo = floppy_getgeo, | 773 | .getgeo = floppy_getgeo, |
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index f3657b2a5386..cc6a3864822c 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -949,15 +949,28 @@ static int floppy_open(struct block_device *bdev, fmode_t mode) | |||
949 | return 0; | 949 | return 0; |
950 | } | 950 | } |
951 | 951 | ||
952 | static int floppy_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
953 | { | ||
954 | int ret; | ||
955 | |||
956 | lock_kernel(); | ||
957 | ret = floppy_open(bdev, mode); | ||
958 | unlock_kernel(); | ||
959 | |||
960 | return ret; | ||
961 | } | ||
962 | |||
952 | static int floppy_release(struct gendisk *disk, fmode_t mode) | 963 | static int floppy_release(struct gendisk *disk, fmode_t mode) |
953 | { | 964 | { |
954 | struct floppy_state *fs = disk->private_data; | 965 | struct floppy_state *fs = disk->private_data; |
955 | struct swim3 __iomem *sw = fs->swim3; | 966 | struct swim3 __iomem *sw = fs->swim3; |
967 | lock_kernel(); | ||
956 | if (fs->ref_count > 0 && --fs->ref_count == 0) { | 968 | if (fs->ref_count > 0 && --fs->ref_count == 0) { |
957 | swim3_action(fs, MOTOR_OFF); | 969 | swim3_action(fs, MOTOR_OFF); |
958 | out_8(&sw->control_bic, 0xff); | 970 | out_8(&sw->control_bic, 0xff); |
959 | swim3_select(fs, RELAX); | 971 | swim3_select(fs, RELAX); |
960 | } | 972 | } |
973 | unlock_kernel(); | ||
961 | return 0; | 974 | return 0; |
962 | } | 975 | } |
963 | 976 | ||
@@ -1008,7 +1021,7 @@ static int floppy_revalidate(struct gendisk *disk) | |||
1008 | } | 1021 | } |
1009 | 1022 | ||
1010 | static const struct block_device_operations floppy_fops = { | 1023 | static const struct block_device_operations floppy_fops = { |
1011 | .open = floppy_open, | 1024 | .open = floppy_unlocked_open, |
1012 | .release = floppy_release, | 1025 | .release = floppy_release, |
1013 | .ioctl = floppy_ioctl, | 1026 | .ioctl = floppy_ioctl, |
1014 | .media_changed = floppy_check_change, | 1027 | .media_changed = floppy_check_change, |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index 102ed52d0e0f..c48e14878582 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -1711,6 +1711,18 @@ err_open: | |||
1711 | return rc; | 1711 | return rc; |
1712 | } | 1712 | } |
1713 | 1713 | ||
1714 | static int ub_bd_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
1715 | { | ||
1716 | int ret; | ||
1717 | |||
1718 | lock_kernel(); | ||
1719 | ret = ub_bd_open(bdev, mode); | ||
1720 | unlock_kernel(); | ||
1721 | |||
1722 | return ret; | ||
1723 | } | ||
1724 | |||
1725 | |||
1714 | /* | 1726 | /* |
1715 | */ | 1727 | */ |
1716 | static int ub_bd_release(struct gendisk *disk, fmode_t mode) | 1728 | static int ub_bd_release(struct gendisk *disk, fmode_t mode) |
@@ -1718,7 +1730,10 @@ static int ub_bd_release(struct gendisk *disk, fmode_t mode) | |||
1718 | struct ub_lun *lun = disk->private_data; | 1730 | struct ub_lun *lun = disk->private_data; |
1719 | struct ub_dev *sc = lun->udev; | 1731 | struct ub_dev *sc = lun->udev; |
1720 | 1732 | ||
1733 | lock_kernel(); | ||
1721 | ub_put(sc); | 1734 | ub_put(sc); |
1735 | unlock_kernel(); | ||
1736 | |||
1722 | return 0; | 1737 | return 0; |
1723 | } | 1738 | } |
1724 | 1739 | ||
@@ -1798,7 +1813,7 @@ static int ub_bd_media_changed(struct gendisk *disk) | |||
1798 | 1813 | ||
1799 | static const struct block_device_operations ub_bd_fops = { | 1814 | static const struct block_device_operations ub_bd_fops = { |
1800 | .owner = THIS_MODULE, | 1815 | .owner = THIS_MODULE, |
1801 | .open = ub_bd_open, | 1816 | .open = ub_bd_unlocked_open, |
1802 | .release = ub_bd_release, | 1817 | .release = ub_bd_release, |
1803 | .ioctl = ub_bd_ioctl, | 1818 | .ioctl = ub_bd_ioctl, |
1804 | .media_changed = ub_bd_media_changed, | 1819 | .media_changed = ub_bd_media_changed, |
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index 5663d3c284c8..f651e51a3319 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
42 | #include <linux/init.h> | 42 | #include <linux/init.h> |
43 | #include <linux/string.h> | 43 | #include <linux/string.h> |
44 | #include <linux/smp_lock.h> | ||
44 | #include <linux/dma-mapping.h> | 45 | #include <linux/dma-mapping.h> |
45 | #include <linux/completion.h> | 46 | #include <linux/completion.h> |
46 | #include <linux/device.h> | 47 | #include <linux/device.h> |
@@ -175,6 +176,18 @@ static int viodasd_open(struct block_device *bdev, fmode_t mode) | |||
175 | return 0; | 176 | return 0; |
176 | } | 177 | } |
177 | 178 | ||
179 | static int viodasd_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
180 | { | ||
181 | int ret; | ||
182 | |||
183 | lock_kernel(); | ||
184 | ret = viodasd_open(bdev, mode); | ||
185 | unlock_kernel(); | ||
186 | |||
187 | return ret; | ||
188 | } | ||
189 | |||
190 | |||
178 | /* | 191 | /* |
179 | * External release entry point. | 192 | * External release entry point. |
180 | */ | 193 | */ |
@@ -183,6 +196,7 @@ static int viodasd_release(struct gendisk *disk, fmode_t mode) | |||
183 | struct viodasd_device *d = disk->private_data; | 196 | struct viodasd_device *d = disk->private_data; |
184 | HvLpEvent_Rc hvrc; | 197 | HvLpEvent_Rc hvrc; |
185 | 198 | ||
199 | lock_kernel(); | ||
186 | /* Send the event to OS/400. We DON'T expect a response */ | 200 | /* Send the event to OS/400. We DON'T expect a response */ |
187 | hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp, | 201 | hvrc = HvCallEvent_signalLpEventFast(viopath_hostLp, |
188 | HvLpEvent_Type_VirtualIo, | 202 | HvLpEvent_Type_VirtualIo, |
@@ -195,6 +209,9 @@ static int viodasd_release(struct gendisk *disk, fmode_t mode) | |||
195 | 0, 0, 0); | 209 | 0, 0, 0); |
196 | if (hvrc != 0) | 210 | if (hvrc != 0) |
197 | pr_warning("HV close call failed %d\n", (int)hvrc); | 211 | pr_warning("HV close call failed %d\n", (int)hvrc); |
212 | |||
213 | unlock_kernel(); | ||
214 | |||
198 | return 0; | 215 | return 0; |
199 | } | 216 | } |
200 | 217 | ||
@@ -219,7 +236,7 @@ static int viodasd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
219 | */ | 236 | */ |
220 | static const struct block_device_operations viodasd_fops = { | 237 | static const struct block_device_operations viodasd_fops = { |
221 | .owner = THIS_MODULE, | 238 | .owner = THIS_MODULE, |
222 | .open = viodasd_open, | 239 | .open = viodasd_unlocked_open, |
223 | .release = viodasd_release, | 240 | .release = viodasd_release, |
224 | .getgeo = viodasd_getgeo, | 241 | .getgeo = viodasd_getgeo, |
225 | }; | 242 | }; |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 9119cd3d56a4..91374282755d 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/cdrom.h> | 41 | #include <linux/cdrom.h> |
42 | #include <linux/module.h> | 42 | #include <linux/module.h> |
43 | #include <linux/slab.h> | 43 | #include <linux/slab.h> |
44 | #include <linux/smp_lock.h> | ||
44 | #include <linux/scatterlist.h> | 45 | #include <linux/scatterlist.h> |
45 | 46 | ||
46 | #include <xen/xen.h> | 47 | #include <xen/xen.h> |
@@ -1018,13 +1019,18 @@ static int blkfront_is_ready(struct xenbus_device *dev) | |||
1018 | static int blkif_open(struct block_device *bdev, fmode_t mode) | 1019 | static int blkif_open(struct block_device *bdev, fmode_t mode) |
1019 | { | 1020 | { |
1020 | struct blkfront_info *info = bdev->bd_disk->private_data; | 1021 | struct blkfront_info *info = bdev->bd_disk->private_data; |
1022 | |||
1023 | lock_kernel(); | ||
1021 | info->users++; | 1024 | info->users++; |
1025 | unlock_kernel(); | ||
1026 | |||
1022 | return 0; | 1027 | return 0; |
1023 | } | 1028 | } |
1024 | 1029 | ||
1025 | static int blkif_release(struct gendisk *disk, fmode_t mode) | 1030 | static int blkif_release(struct gendisk *disk, fmode_t mode) |
1026 | { | 1031 | { |
1027 | struct blkfront_info *info = disk->private_data; | 1032 | struct blkfront_info *info = disk->private_data; |
1033 | lock_kernel(); | ||
1028 | info->users--; | 1034 | info->users--; |
1029 | if (info->users == 0) { | 1035 | if (info->users == 0) { |
1030 | /* Check whether we have been instructed to close. We will | 1036 | /* Check whether we have been instructed to close. We will |
@@ -1036,6 +1042,7 @@ static int blkif_release(struct gendisk *disk, fmode_t mode) | |||
1036 | if (state == XenbusStateClosing && info->is_ready) | 1042 | if (state == XenbusStateClosing && info->is_ready) |
1037 | blkfront_closing(dev); | 1043 | blkfront_closing(dev); |
1038 | } | 1044 | } |
1045 | unlock_kernel(); | ||
1039 | return 0; | 1046 | return 0; |
1040 | } | 1047 | } |
1041 | 1048 | ||
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index ac278ac908d5..b71888b909a0 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -89,6 +89,7 @@ | |||
89 | #include <linux/delay.h> | 89 | #include <linux/delay.h> |
90 | #include <linux/slab.h> | 90 | #include <linux/slab.h> |
91 | #include <linux/blkdev.h> | 91 | #include <linux/blkdev.h> |
92 | #include <linux/smp_lock.h> | ||
92 | #include <linux/ata.h> | 93 | #include <linux/ata.h> |
93 | #include <linux/hdreg.h> | 94 | #include <linux/hdreg.h> |
94 | #include <linux/platform_device.h> | 95 | #include <linux/platform_device.h> |
@@ -901,11 +902,14 @@ static int ace_open(struct block_device *bdev, fmode_t mode) | |||
901 | 902 | ||
902 | dev_dbg(ace->dev, "ace_open() users=%i\n", ace->users + 1); | 903 | dev_dbg(ace->dev, "ace_open() users=%i\n", ace->users + 1); |
903 | 904 | ||
905 | lock_kernel(); | ||
904 | spin_lock_irqsave(&ace->lock, flags); | 906 | spin_lock_irqsave(&ace->lock, flags); |
905 | ace->users++; | 907 | ace->users++; |
906 | spin_unlock_irqrestore(&ace->lock, flags); | 908 | spin_unlock_irqrestore(&ace->lock, flags); |
907 | 909 | ||
908 | check_disk_change(bdev); | 910 | check_disk_change(bdev); |
911 | unlock_kernel(); | ||
912 | |||
909 | return 0; | 913 | return 0; |
910 | } | 914 | } |
911 | 915 | ||
@@ -917,6 +921,7 @@ static int ace_release(struct gendisk *disk, fmode_t mode) | |||
917 | 921 | ||
918 | dev_dbg(ace->dev, "ace_release() users=%i\n", ace->users - 1); | 922 | dev_dbg(ace->dev, "ace_release() users=%i\n", ace->users - 1); |
919 | 923 | ||
924 | lock_kernel(); | ||
920 | spin_lock_irqsave(&ace->lock, flags); | 925 | spin_lock_irqsave(&ace->lock, flags); |
921 | ace->users--; | 926 | ace->users--; |
922 | if (ace->users == 0) { | 927 | if (ace->users == 0) { |
@@ -924,6 +929,7 @@ static int ace_release(struct gendisk *disk, fmode_t mode) | |||
924 | ace_out(ace, ACE_CTRL, val & ~ACE_CTRL_LOCKREQ); | 929 | ace_out(ace, ACE_CTRL, val & ~ACE_CTRL_LOCKREQ); |
925 | } | 930 | } |
926 | spin_unlock_irqrestore(&ace->lock, flags); | 931 | spin_unlock_irqrestore(&ace->lock, flags); |
932 | unlock_kernel(); | ||
927 | return 0; | 933 | return 0; |
928 | } | 934 | } |
929 | 935 | ||
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index 9114654b54d9..d75b2bb601ad 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/blkdev.h> | 34 | #include <linux/blkdev.h> |
35 | #include <linux/bitops.h> | 35 | #include <linux/bitops.h> |
36 | #include <linux/smp_lock.h> | ||
36 | #include <linux/slab.h> | 37 | #include <linux/slab.h> |
37 | 38 | ||
38 | #include <asm/setup.h> | 39 | #include <asm/setup.h> |
@@ -153,6 +154,7 @@ static int z2_open(struct block_device *bdev, fmode_t mode) | |||
153 | 154 | ||
154 | device = MINOR(bdev->bd_dev); | 155 | device = MINOR(bdev->bd_dev); |
155 | 156 | ||
157 | lock_kernel(); | ||
156 | if ( current_device != -1 && current_device != device ) | 158 | if ( current_device != -1 && current_device != device ) |
157 | { | 159 | { |
158 | rc = -EBUSY; | 160 | rc = -EBUSY; |
@@ -294,20 +296,25 @@ static int z2_open(struct block_device *bdev, fmode_t mode) | |||
294 | set_capacity(z2ram_gendisk, z2ram_size >> 9); | 296 | set_capacity(z2ram_gendisk, z2ram_size >> 9); |
295 | } | 297 | } |
296 | 298 | ||
299 | unlock_kernel(); | ||
297 | return 0; | 300 | return 0; |
298 | 301 | ||
299 | err_out_kfree: | 302 | err_out_kfree: |
300 | kfree(z2ram_map); | 303 | kfree(z2ram_map); |
301 | err_out: | 304 | err_out: |
305 | unlock_kernel(); | ||
302 | return rc; | 306 | return rc; |
303 | } | 307 | } |
304 | 308 | ||
305 | static int | 309 | static int |
306 | z2_release(struct gendisk *disk, fmode_t mode) | 310 | z2_release(struct gendisk *disk, fmode_t mode) |
307 | { | 311 | { |
308 | if ( current_device == -1 ) | 312 | lock_kernel(); |
309 | return 0; | 313 | if ( current_device == -1 ) { |
310 | 314 | unlock_kernel(); | |
315 | return 0; | ||
316 | } | ||
317 | unlock_kernel(); | ||
311 | /* | 318 | /* |
312 | * FIXME: unmap memory | 319 | * FIXME: unmap memory |
313 | */ | 320 | */ |
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 1772fd914fb9..261107d1457c 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
@@ -493,12 +493,18 @@ static struct cdrom_device_ops gdrom_ops = { | |||
493 | 493 | ||
494 | static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode) | 494 | static int gdrom_bdops_open(struct block_device *bdev, fmode_t mode) |
495 | { | 495 | { |
496 | return cdrom_open(gd.cd_info, bdev, mode); | 496 | int ret; |
497 | lock_kernel(); | ||
498 | ret = cdrom_open(gd.cd_info, bdev, mode); | ||
499 | unlock_kernel(); | ||
500 | return ret; | ||
497 | } | 501 | } |
498 | 502 | ||
499 | static int gdrom_bdops_release(struct gendisk *disk, fmode_t mode) | 503 | static int gdrom_bdops_release(struct gendisk *disk, fmode_t mode) |
500 | { | 504 | { |
505 | lock_kernel(); | ||
501 | cdrom_release(gd.cd_info, mode); | 506 | cdrom_release(gd.cd_info, mode); |
507 | unlock_kernel(); | ||
502 | return 0; | 508 | return 0; |
503 | } | 509 | } |
504 | 510 | ||
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index 16dada0627ee..56bf9f44700c 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -154,13 +154,21 @@ static const struct file_operations proc_viocd_operations = { | |||
154 | static int viocd_blk_open(struct block_device *bdev, fmode_t mode) | 154 | static int viocd_blk_open(struct block_device *bdev, fmode_t mode) |
155 | { | 155 | { |
156 | struct disk_info *di = bdev->bd_disk->private_data; | 156 | struct disk_info *di = bdev->bd_disk->private_data; |
157 | return cdrom_open(&di->viocd_info, bdev, mode); | 157 | int ret; |
158 | |||
159 | lock_kernel(); | ||
160 | ret = cdrom_open(&di->viocd_info, bdev, mode); | ||
161 | unlock_kernel(); | ||
162 | |||
163 | return ret; | ||
158 | } | 164 | } |
159 | 165 | ||
160 | static int viocd_blk_release(struct gendisk *disk, fmode_t mode) | 166 | static int viocd_blk_release(struct gendisk *disk, fmode_t mode) |
161 | { | 167 | { |
162 | struct disk_info *di = disk->private_data; | 168 | struct disk_info *di = disk->private_data; |
169 | lock_kernel(); | ||
163 | cdrom_release(&di->viocd_info, mode); | 170 | cdrom_release(&di->viocd_info, mode); |
171 | unlock_kernel(); | ||
164 | return 0; | 172 | return 0; |
165 | } | 173 | } |
166 | 174 | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index bf9f61a5c2f8..5108e9739c96 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1591,17 +1591,19 @@ static struct ide_driver ide_cdrom_driver = { | |||
1591 | 1591 | ||
1592 | static int idecd_open(struct block_device *bdev, fmode_t mode) | 1592 | static int idecd_open(struct block_device *bdev, fmode_t mode) |
1593 | { | 1593 | { |
1594 | struct cdrom_info *info = ide_cd_get(bdev->bd_disk); | 1594 | struct cdrom_info *info; |
1595 | int rc = -ENOMEM; | 1595 | int rc = -ENXIO; |
1596 | 1596 | ||
1597 | lock_kernel(); | ||
1598 | info = ide_cd_get(bdev->bd_disk); | ||
1597 | if (!info) | 1599 | if (!info) |
1598 | return -ENXIO; | 1600 | goto out; |
1599 | 1601 | ||
1600 | rc = cdrom_open(&info->devinfo, bdev, mode); | 1602 | rc = cdrom_open(&info->devinfo, bdev, mode); |
1601 | |||
1602 | if (rc < 0) | 1603 | if (rc < 0) |
1603 | ide_cd_put(info); | 1604 | ide_cd_put(info); |
1604 | 1605 | out: | |
1606 | unlock_kernel(); | ||
1605 | return rc; | 1607 | return rc; |
1606 | } | 1608 | } |
1607 | 1609 | ||
@@ -1609,9 +1611,11 @@ static int idecd_release(struct gendisk *disk, fmode_t mode) | |||
1609 | { | 1611 | { |
1610 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); | 1612 | struct cdrom_info *info = ide_drv_g(disk, cdrom_info); |
1611 | 1613 | ||
1614 | lock_kernel(); | ||
1612 | cdrom_release(&info->devinfo, mode); | 1615 | cdrom_release(&info->devinfo, mode); |
1613 | 1616 | ||
1614 | ide_cd_put(info); | 1617 | ide_cd_put(info); |
1618 | unlock_kernel(); | ||
1615 | 1619 | ||
1616 | return 0; | 1620 | return 0; |
1617 | } | 1621 | } |
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 883f0c979c9f..137337a795a9 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -1,3 +1,4 @@ | |||
1 | #include <linux/smp_lock.h> | ||
1 | #include <linux/module.h> | 2 | #include <linux/module.h> |
2 | #include <linux/types.h> | 3 | #include <linux/types.h> |
3 | #include <linux/string.h> | 4 | #include <linux/string.h> |
@@ -237,6 +238,18 @@ out_put_idkp: | |||
237 | return ret; | 238 | return ret; |
238 | } | 239 | } |
239 | 240 | ||
241 | static int ide_gd_unlocked_open(struct block_device *bdev, fmode_t mode) | ||
242 | { | ||
243 | int ret; | ||
244 | |||
245 | lock_kernel(); | ||
246 | ret = ide_gd_open(bdev, mode); | ||
247 | unlock_kernel(); | ||
248 | |||
249 | return ret; | ||
250 | } | ||
251 | |||
252 | |||
240 | static int ide_gd_release(struct gendisk *disk, fmode_t mode) | 253 | static int ide_gd_release(struct gendisk *disk, fmode_t mode) |
241 | { | 254 | { |
242 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); | 255 | struct ide_disk_obj *idkp = ide_drv_g(disk, ide_disk_obj); |
@@ -244,6 +257,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode) | |||
244 | 257 | ||
245 | ide_debug_log(IDE_DBG_FUNC, "enter"); | 258 | ide_debug_log(IDE_DBG_FUNC, "enter"); |
246 | 259 | ||
260 | lock_kernel(); | ||
247 | if (idkp->openers == 1) | 261 | if (idkp->openers == 1) |
248 | drive->disk_ops->flush(drive); | 262 | drive->disk_ops->flush(drive); |
249 | 263 | ||
@@ -255,6 +269,7 @@ static int ide_gd_release(struct gendisk *disk, fmode_t mode) | |||
255 | idkp->openers--; | 269 | idkp->openers--; |
256 | 270 | ||
257 | ide_disk_put(idkp); | 271 | ide_disk_put(idkp); |
272 | unlock_kernel(); | ||
258 | 273 | ||
259 | return 0; | 274 | return 0; |
260 | } | 275 | } |
@@ -321,7 +336,7 @@ static int ide_gd_ioctl(struct block_device *bdev, fmode_t mode, | |||
321 | 336 | ||
322 | static const struct block_device_operations ide_gd_ops = { | 337 | static const struct block_device_operations ide_gd_ops = { |
323 | .owner = THIS_MODULE, | 338 | .owner = THIS_MODULE, |
324 | .open = ide_gd_open, | 339 | .open = ide_gd_unlocked_open, |
325 | .release = ide_gd_release, | 340 | .release = ide_gd_release, |
326 | .ioctl = ide_gd_ioctl, | 341 | .ioctl = ide_gd_ioctl, |
327 | .getgeo = ide_gd_getgeo, | 342 | .getgeo = ide_gd_getgeo, |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 39b0a5c45f07..6d622cb5ac81 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -1907,7 +1907,11 @@ static const struct file_operations idetape_fops = { | |||
1907 | 1907 | ||
1908 | static int idetape_open(struct block_device *bdev, fmode_t mode) | 1908 | static int idetape_open(struct block_device *bdev, fmode_t mode) |
1909 | { | 1909 | { |
1910 | struct ide_tape_obj *tape = ide_tape_get(bdev->bd_disk, false, 0); | 1910 | struct ide_tape_obj *tape; |
1911 | |||
1912 | lock_kernel(); | ||
1913 | tape = ide_tape_get(bdev->bd_disk, false, 0); | ||
1914 | unlock_kernel(); | ||
1911 | 1915 | ||
1912 | if (!tape) | 1916 | if (!tape) |
1913 | return -ENXIO; | 1917 | return -ENXIO; |
@@ -1919,7 +1923,10 @@ static int idetape_release(struct gendisk *disk, fmode_t mode) | |||
1919 | { | 1923 | { |
1920 | struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); | 1924 | struct ide_tape_obj *tape = ide_drv_g(disk, ide_tape_obj); |
1921 | 1925 | ||
1926 | lock_kernel(); | ||
1922 | ide_tape_put(tape); | 1927 | ide_tape_put(tape); |
1928 | unlock_kernel(); | ||
1929 | |||
1923 | return 0; | 1930 | return 0; |
1924 | } | 1931 | } |
1925 | 1932 | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index d505a96845c1..a3f21dc02bd8 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/blkpg.h> | 15 | #include <linux/blkpg.h> |
16 | #include <linux/bio.h> | 16 | #include <linux/bio.h> |
17 | #include <linux/buffer_head.h> | 17 | #include <linux/buffer_head.h> |
18 | #include <linux/smp_lock.h> | ||
18 | #include <linux/mempool.h> | 19 | #include <linux/mempool.h> |
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
20 | #include <linux/idr.h> | 21 | #include <linux/idr.h> |
@@ -338,6 +339,7 @@ static int dm_blk_open(struct block_device *bdev, fmode_t mode) | |||
338 | { | 339 | { |
339 | struct mapped_device *md; | 340 | struct mapped_device *md; |
340 | 341 | ||
342 | lock_kernel(); | ||
341 | spin_lock(&_minor_lock); | 343 | spin_lock(&_minor_lock); |
342 | 344 | ||
343 | md = bdev->bd_disk->private_data; | 345 | md = bdev->bd_disk->private_data; |
@@ -355,6 +357,7 @@ static int dm_blk_open(struct block_device *bdev, fmode_t mode) | |||
355 | 357 | ||
356 | out: | 358 | out: |
357 | spin_unlock(&_minor_lock); | 359 | spin_unlock(&_minor_lock); |
360 | unlock_kernel(); | ||
358 | 361 | ||
359 | return md ? 0 : -ENXIO; | 362 | return md ? 0 : -ENXIO; |
360 | } | 363 | } |
@@ -362,8 +365,12 @@ out: | |||
362 | static int dm_blk_close(struct gendisk *disk, fmode_t mode) | 365 | static int dm_blk_close(struct gendisk *disk, fmode_t mode) |
363 | { | 366 | { |
364 | struct mapped_device *md = disk->private_data; | 367 | struct mapped_device *md = disk->private_data; |
368 | |||
369 | lock_kernel(); | ||
365 | atomic_dec(&md->open_count); | 370 | atomic_dec(&md->open_count); |
366 | dm_put(md); | 371 | dm_put(md); |
372 | unlock_kernel(); | ||
373 | |||
367 | return 0; | 374 | return 0; |
368 | } | 375 | } |
369 | 376 | ||
diff --git a/drivers/md/md.c b/drivers/md/md.c index 1893af678779..700c96edf9b2 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/blkdev.h> | 36 | #include <linux/blkdev.h> |
37 | #include <linux/sysctl.h> | 37 | #include <linux/sysctl.h> |
38 | #include <linux/seq_file.h> | 38 | #include <linux/seq_file.h> |
39 | #include <linux/smp_lock.h> | ||
39 | #include <linux/buffer_head.h> /* for invalidate_bdev */ | 40 | #include <linux/buffer_head.h> /* for invalidate_bdev */ |
40 | #include <linux/poll.h> | 41 | #include <linux/poll.h> |
41 | #include <linux/ctype.h> | 42 | #include <linux/ctype.h> |
@@ -5902,6 +5903,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5902 | mddev_t *mddev = mddev_find(bdev->bd_dev); | 5903 | mddev_t *mddev = mddev_find(bdev->bd_dev); |
5903 | int err; | 5904 | int err; |
5904 | 5905 | ||
5906 | lock_kernel(); | ||
5905 | if (mddev->gendisk != bdev->bd_disk) { | 5907 | if (mddev->gendisk != bdev->bd_disk) { |
5906 | /* we are racing with mddev_put which is discarding this | 5908 | /* we are racing with mddev_put which is discarding this |
5907 | * bd_disk. | 5909 | * bd_disk. |
@@ -5910,6 +5912,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5910 | /* Wait until bdev->bd_disk is definitely gone */ | 5912 | /* Wait until bdev->bd_disk is definitely gone */ |
5911 | flush_scheduled_work(); | 5913 | flush_scheduled_work(); |
5912 | /* Then retry the open from the top */ | 5914 | /* Then retry the open from the top */ |
5915 | unlock_kernel(); | ||
5913 | return -ERESTARTSYS; | 5916 | return -ERESTARTSYS; |
5914 | } | 5917 | } |
5915 | BUG_ON(mddev != bdev->bd_disk->private_data); | 5918 | BUG_ON(mddev != bdev->bd_disk->private_data); |
@@ -5923,6 +5926,7 @@ static int md_open(struct block_device *bdev, fmode_t mode) | |||
5923 | 5926 | ||
5924 | check_disk_size_change(mddev->gendisk, bdev); | 5927 | check_disk_size_change(mddev->gendisk, bdev); |
5925 | out: | 5928 | out: |
5929 | unlock_kernel(); | ||
5926 | return err; | 5930 | return err; |
5927 | } | 5931 | } |
5928 | 5932 | ||
@@ -5931,8 +5935,10 @@ static int md_release(struct gendisk *disk, fmode_t mode) | |||
5931 | mddev_t *mddev = disk->private_data; | 5935 | mddev_t *mddev = disk->private_data; |
5932 | 5936 | ||
5933 | BUG_ON(!mddev); | 5937 | BUG_ON(!mddev); |
5938 | lock_kernel(); | ||
5934 | atomic_dec(&mddev->openers); | 5939 | atomic_dec(&mddev->openers); |
5935 | mddev_put(mddev); | 5940 | mddev_put(mddev); |
5941 | unlock_kernel(); | ||
5936 | 5942 | ||
5937 | return 0; | 5943 | return 0; |
5938 | } | 5944 | } |
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 56645408d225..eef78a068fd1 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/kthread.h> | 18 | #include <linux/kthread.h> |
19 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/smp_lock.h> | ||
21 | #include <linux/memstick.h> | 22 | #include <linux/memstick.h> |
22 | 23 | ||
23 | #define DRIVER_NAME "mspro_block" | 24 | #define DRIVER_NAME "mspro_block" |
@@ -179,6 +180,7 @@ static int mspro_block_bd_open(struct block_device *bdev, fmode_t mode) | |||
179 | struct mspro_block_data *msb = disk->private_data; | 180 | struct mspro_block_data *msb = disk->private_data; |
180 | int rc = -ENXIO; | 181 | int rc = -ENXIO; |
181 | 182 | ||
183 | lock_kernel(); | ||
182 | mutex_lock(&mspro_block_disk_lock); | 184 | mutex_lock(&mspro_block_disk_lock); |
183 | 185 | ||
184 | if (msb && msb->card) { | 186 | if (msb && msb->card) { |
@@ -190,6 +192,7 @@ static int mspro_block_bd_open(struct block_device *bdev, fmode_t mode) | |||
190 | } | 192 | } |
191 | 193 | ||
192 | mutex_unlock(&mspro_block_disk_lock); | 194 | mutex_unlock(&mspro_block_disk_lock); |
195 | unlock_kernel(); | ||
193 | 196 | ||
194 | return rc; | 197 | return rc; |
195 | } | 198 | } |
@@ -221,7 +224,11 @@ static int mspro_block_disk_release(struct gendisk *disk) | |||
221 | 224 | ||
222 | static int mspro_block_bd_release(struct gendisk *disk, fmode_t mode) | 225 | static int mspro_block_bd_release(struct gendisk *disk, fmode_t mode) |
223 | { | 226 | { |
224 | return mspro_block_disk_release(disk); | 227 | int ret; |
228 | lock_kernel(); | ||
229 | ret = mspro_block_disk_release(disk); | ||
230 | unlock_kernel(); | ||
231 | return ret; | ||
225 | } | 232 | } |
226 | 233 | ||
227 | static int mspro_block_bd_getgeo(struct block_device *bdev, | 234 | static int mspro_block_bd_getgeo(struct block_device *bdev, |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index d1bdf8abe5db..a5bc3ee0d93e 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <linux/i2o.h> | 55 | #include <linux/i2o.h> |
56 | #include <linux/smp_lock.h> | ||
56 | 57 | ||
57 | #include <linux/mempool.h> | 58 | #include <linux/mempool.h> |
58 | 59 | ||
@@ -577,6 +578,7 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode) | |||
577 | if (!dev->i2o_dev) | 578 | if (!dev->i2o_dev) |
578 | return -ENODEV; | 579 | return -ENODEV; |
579 | 580 | ||
581 | lock_kernel(); | ||
580 | if (dev->power > 0x1f) | 582 | if (dev->power > 0x1f) |
581 | i2o_block_device_power(dev, 0x02); | 583 | i2o_block_device_power(dev, 0x02); |
582 | 584 | ||
@@ -585,6 +587,7 @@ static int i2o_block_open(struct block_device *bdev, fmode_t mode) | |||
585 | i2o_block_device_lock(dev->i2o_dev, -1); | 587 | i2o_block_device_lock(dev->i2o_dev, -1); |
586 | 588 | ||
587 | osm_debug("Ready.\n"); | 589 | osm_debug("Ready.\n"); |
590 | unlock_kernel(); | ||
588 | 591 | ||
589 | return 0; | 592 | return 0; |
590 | }; | 593 | }; |
@@ -615,6 +618,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode) | |||
615 | if (!dev->i2o_dev) | 618 | if (!dev->i2o_dev) |
616 | return 0; | 619 | return 0; |
617 | 620 | ||
621 | lock_kernel(); | ||
618 | i2o_block_device_flush(dev->i2o_dev); | 622 | i2o_block_device_flush(dev->i2o_dev); |
619 | 623 | ||
620 | i2o_block_device_unlock(dev->i2o_dev, -1); | 624 | i2o_block_device_unlock(dev->i2o_dev, -1); |
@@ -625,6 +629,7 @@ static int i2o_block_release(struct gendisk *disk, fmode_t mode) | |||
625 | operation = 0x24; | 629 | operation = 0x24; |
626 | 630 | ||
627 | i2o_block_device_power(dev, operation); | 631 | i2o_block_device_power(dev, operation); |
632 | unlock_kernel(); | ||
628 | 633 | ||
629 | return 0; | 634 | return 0; |
630 | } | 635 | } |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index cb9fbc83b090..8433cde29c8b 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/kdev_t.h> | 29 | #include <linux/kdev_t.h> |
30 | #include <linux/blkdev.h> | 30 | #include <linux/blkdev.h> |
31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
32 | #include <linux/smp_lock.h> | ||
32 | #include <linux/scatterlist.h> | 33 | #include <linux/scatterlist.h> |
33 | #include <linux/string_helpers.h> | 34 | #include <linux/string_helpers.h> |
34 | 35 | ||
@@ -107,6 +108,7 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode) | |||
107 | struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk); | 108 | struct mmc_blk_data *md = mmc_blk_get(bdev->bd_disk); |
108 | int ret = -ENXIO; | 109 | int ret = -ENXIO; |
109 | 110 | ||
111 | lock_kernel(); | ||
110 | if (md) { | 112 | if (md) { |
111 | if (md->usage == 2) | 113 | if (md->usage == 2) |
112 | check_disk_change(bdev); | 114 | check_disk_change(bdev); |
@@ -117,6 +119,7 @@ static int mmc_blk_open(struct block_device *bdev, fmode_t mode) | |||
117 | ret = -EROFS; | 119 | ret = -EROFS; |
118 | } | 120 | } |
119 | } | 121 | } |
122 | unlock_kernel(); | ||
120 | 123 | ||
121 | return ret; | 124 | return ret; |
122 | } | 125 | } |
@@ -125,7 +128,9 @@ static int mmc_blk_release(struct gendisk *disk, fmode_t mode) | |||
125 | { | 128 | { |
126 | struct mmc_blk_data *md = disk->private_data; | 129 | struct mmc_blk_data *md = disk->private_data; |
127 | 130 | ||
131 | lock_kernel(); | ||
128 | mmc_blk_put(md); | 132 | mmc_blk_put(md); |
133 | unlock_kernel(); | ||
129 | return 0; | 134 | return 0; |
130 | } | 135 | } |
131 | 136 | ||
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 8c83b11a77d5..5ca80aee2ed0 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -165,8 +165,9 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) | |||
165 | int ret; | 165 | int ret; |
166 | 166 | ||
167 | if (!dev) | 167 | if (!dev) |
168 | return -ERESTARTSYS; | 168 | return -ERESTARTSYS; /* FIXME: busy loop! -arnd*/ |
169 | 169 | ||
170 | lock_kernel(); | ||
170 | mutex_lock(&dev->lock); | 171 | mutex_lock(&dev->lock); |
171 | 172 | ||
172 | if (!dev->mtd) { | 173 | if (!dev->mtd) { |
@@ -183,6 +184,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) | |||
183 | unlock: | 184 | unlock: |
184 | mutex_unlock(&dev->lock); | 185 | mutex_unlock(&dev->lock); |
185 | blktrans_dev_put(dev); | 186 | blktrans_dev_put(dev); |
187 | unlock_kernel(); | ||
186 | return ret; | 188 | return ret; |
187 | } | 189 | } |
188 | 190 | ||
@@ -194,6 +196,7 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode) | |||
194 | if (!dev) | 196 | if (!dev) |
195 | return ret; | 197 | return ret; |
196 | 198 | ||
199 | lock_kernel(); | ||
197 | mutex_lock(&dev->lock); | 200 | mutex_lock(&dev->lock); |
198 | 201 | ||
199 | /* Release one reference, we sure its not the last one here*/ | 202 | /* Release one reference, we sure its not the last one here*/ |
@@ -206,6 +209,7 @@ static int blktrans_release(struct gendisk *disk, fmode_t mode) | |||
206 | unlock: | 209 | unlock: |
207 | mutex_unlock(&dev->lock); | 210 | mutex_unlock(&dev->lock); |
208 | blktrans_dev_put(dev); | 211 | blktrans_dev_put(dev); |
212 | unlock_kernel(); | ||
209 | return ret; | 213 | return ret; |
210 | } | 214 | } |
211 | 215 | ||
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 17b033d0e050..1a84fae155e1 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/hdreg.h> | 21 | #include <linux/hdreg.h> |
22 | #include <linux/async.h> | 22 | #include <linux/async.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/smp_lock.h> | ||
24 | 25 | ||
25 | #include <asm/ccwdev.h> | 26 | #include <asm/ccwdev.h> |
26 | #include <asm/ebcdic.h> | 27 | #include <asm/ebcdic.h> |
@@ -2235,6 +2236,7 @@ static int dasd_open(struct block_device *bdev, fmode_t mode) | |||
2235 | if (!block) | 2236 | if (!block) |
2236 | return -ENODEV; | 2237 | return -ENODEV; |
2237 | 2238 | ||
2239 | lock_kernel(); | ||
2238 | base = block->base; | 2240 | base = block->base; |
2239 | atomic_inc(&block->open_count); | 2241 | atomic_inc(&block->open_count); |
2240 | if (test_bit(DASD_FLAG_OFFLINE, &base->flags)) { | 2242 | if (test_bit(DASD_FLAG_OFFLINE, &base->flags)) { |
@@ -2269,12 +2271,14 @@ static int dasd_open(struct block_device *bdev, fmode_t mode) | |||
2269 | goto out; | 2271 | goto out; |
2270 | } | 2272 | } |
2271 | 2273 | ||
2274 | unlock_kernel(); | ||
2272 | return 0; | 2275 | return 0; |
2273 | 2276 | ||
2274 | out: | 2277 | out: |
2275 | module_put(base->discipline->owner); | 2278 | module_put(base->discipline->owner); |
2276 | unlock: | 2279 | unlock: |
2277 | atomic_dec(&block->open_count); | 2280 | atomic_dec(&block->open_count); |
2281 | unlock_kernel(); | ||
2278 | return rc; | 2282 | return rc; |
2279 | } | 2283 | } |
2280 | 2284 | ||
@@ -2282,8 +2286,10 @@ static int dasd_release(struct gendisk *disk, fmode_t mode) | |||
2282 | { | 2286 | { |
2283 | struct dasd_block *block = disk->private_data; | 2287 | struct dasd_block *block = disk->private_data; |
2284 | 2288 | ||
2289 | lock_kernel(); | ||
2285 | atomic_dec(&block->open_count); | 2290 | atomic_dec(&block->open_count); |
2286 | module_put(block->base->discipline->owner); | 2291 | module_put(block->base->discipline->owner); |
2292 | unlock_kernel(); | ||
2287 | return 0; | 2293 | return 0; |
2288 | } | 2294 | } |
2289 | 2295 | ||
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 9b43ae94beba..2bd72aa34c59 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/init.h> | 14 | #include <linux/init.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/blkdev.h> | 16 | #include <linux/blkdev.h> |
17 | #include <linux/smp_lock.h> | ||
17 | #include <linux/completion.h> | 18 | #include <linux/completion.h> |
18 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
19 | #include <linux/platform_device.h> | 20 | #include <linux/platform_device.h> |
@@ -775,6 +776,7 @@ dcssblk_open(struct block_device *bdev, fmode_t mode) | |||
775 | struct dcssblk_dev_info *dev_info; | 776 | struct dcssblk_dev_info *dev_info; |
776 | int rc; | 777 | int rc; |
777 | 778 | ||
779 | lock_kernel(); | ||
778 | dev_info = bdev->bd_disk->private_data; | 780 | dev_info = bdev->bd_disk->private_data; |
779 | if (NULL == dev_info) { | 781 | if (NULL == dev_info) { |
780 | rc = -ENODEV; | 782 | rc = -ENODEV; |
@@ -784,6 +786,7 @@ dcssblk_open(struct block_device *bdev, fmode_t mode) | |||
784 | bdev->bd_block_size = 4096; | 786 | bdev->bd_block_size = 4096; |
785 | rc = 0; | 787 | rc = 0; |
786 | out: | 788 | out: |
789 | unlock_kernel(); | ||
787 | return rc; | 790 | return rc; |
788 | } | 791 | } |
789 | 792 | ||
@@ -794,6 +797,7 @@ dcssblk_release(struct gendisk *disk, fmode_t mode) | |||
794 | struct segment_info *entry; | 797 | struct segment_info *entry; |
795 | int rc; | 798 | int rc; |
796 | 799 | ||
800 | lock_kernel(); | ||
797 | if (!dev_info) { | 801 | if (!dev_info) { |
798 | rc = -ENODEV; | 802 | rc = -ENODEV; |
799 | goto out; | 803 | goto out; |
@@ -811,6 +815,7 @@ dcssblk_release(struct gendisk *disk, fmode_t mode) | |||
811 | up_write(&dcssblk_devices_sem); | 815 | up_write(&dcssblk_devices_sem); |
812 | rc = 0; | 816 | rc = 0; |
813 | out: | 817 | out: |
818 | unlock_kernel(); | ||
814 | return rc; | 819 | return rc; |
815 | } | 820 | } |
816 | 821 | ||
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index 097da8ce6be6..b7de02525ec9 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/blkdev.h> | 18 | #include <linux/blkdev.h> |
19 | #include <linux/smp_lock.h> | ||
19 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
20 | #include <linux/buffer_head.h> | 21 | #include <linux/buffer_head.h> |
21 | #include <linux/kernel.h> | 22 | #include <linux/kernel.h> |
@@ -361,6 +362,7 @@ tapeblock_open(struct block_device *bdev, fmode_t mode) | |||
361 | struct tape_device * device; | 362 | struct tape_device * device; |
362 | int rc; | 363 | int rc; |
363 | 364 | ||
365 | lock_kernel(); | ||
364 | device = tape_get_device(disk->private_data); | 366 | device = tape_get_device(disk->private_data); |
365 | 367 | ||
366 | if (device->required_tapemarks) { | 368 | if (device->required_tapemarks) { |
@@ -384,12 +386,14 @@ tapeblock_open(struct block_device *bdev, fmode_t mode) | |||
384 | * is called. | 386 | * is called. |
385 | */ | 387 | */ |
386 | tape_state_set(device, TS_BLKUSE); | 388 | tape_state_set(device, TS_BLKUSE); |
389 | unlock_kernel(); | ||
387 | return 0; | 390 | return 0; |
388 | 391 | ||
389 | release: | 392 | release: |
390 | tape_release(device); | 393 | tape_release(device); |
391 | put_device: | 394 | put_device: |
392 | tape_put_device(device); | 395 | tape_put_device(device); |
396 | unlock_kernel(); | ||
393 | return rc; | 397 | return rc; |
394 | } | 398 | } |
395 | 399 | ||
@@ -403,10 +407,12 @@ static int | |||
403 | tapeblock_release(struct gendisk *disk, fmode_t mode) | 407 | tapeblock_release(struct gendisk *disk, fmode_t mode) |
404 | { | 408 | { |
405 | struct tape_device *device = disk->private_data; | 409 | struct tape_device *device = disk->private_data; |
406 | 410 | ||
411 | lock_kernel(); | ||
407 | tape_state_set(device, TS_IN_USE); | 412 | tape_state_set(device, TS_IN_USE); |
408 | tape_release(device); | 413 | tape_release(device); |
409 | tape_put_device(device); | 414 | tape_put_device(device); |
415 | unlock_kernel(); | ||
410 | 416 | ||
411 | return 0; | 417 | return 0; |
412 | } | 418 | } |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 633ac32b25c1..01680c7c8507 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -795,6 +795,7 @@ static int sd_open(struct block_device *bdev, fmode_t mode) | |||
795 | 795 | ||
796 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n")); | 796 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_open\n")); |
797 | 797 | ||
798 | lock_kernel(); | ||
798 | sdev = sdkp->device; | 799 | sdev = sdkp->device; |
799 | 800 | ||
800 | /* | 801 | /* |
@@ -838,10 +839,12 @@ static int sd_open(struct block_device *bdev, fmode_t mode) | |||
838 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT); | 839 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT); |
839 | } | 840 | } |
840 | 841 | ||
842 | unlock_kernel(); | ||
841 | return 0; | 843 | return 0; |
842 | 844 | ||
843 | error_out: | 845 | error_out: |
844 | scsi_disk_put(sdkp); | 846 | scsi_disk_put(sdkp); |
847 | unlock_kernel(); | ||
845 | return retval; | 848 | return retval; |
846 | } | 849 | } |
847 | 850 | ||
@@ -863,6 +866,7 @@ static int sd_release(struct gendisk *disk, fmode_t mode) | |||
863 | 866 | ||
864 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); | 867 | SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); |
865 | 868 | ||
869 | lock_kernel(); | ||
866 | if (!--sdkp->openers && sdev->removable) { | 870 | if (!--sdkp->openers && sdev->removable) { |
867 | if (scsi_block_when_processing_errors(sdev)) | 871 | if (scsi_block_when_processing_errors(sdev)) |
868 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); | 872 | scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); |
@@ -873,6 +877,7 @@ static int sd_release(struct gendisk *disk, fmode_t mode) | |||
873 | * XXX is followed by a "rmmod sd_mod"? | 877 | * XXX is followed by a "rmmod sd_mod"? |
874 | */ | 878 | */ |
875 | scsi_disk_put(sdkp); | 879 | scsi_disk_put(sdkp); |
880 | unlock_kernel(); | ||
876 | return 0; | 881 | return 0; |
877 | } | 882 | } |
878 | 883 | ||
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index d42fa6468f41..ba9c3e0387ce 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -467,22 +467,27 @@ static int sr_prep_fn(struct request_queue *q, struct request *rq) | |||
467 | 467 | ||
468 | static int sr_block_open(struct block_device *bdev, fmode_t mode) | 468 | static int sr_block_open(struct block_device *bdev, fmode_t mode) |
469 | { | 469 | { |
470 | struct scsi_cd *cd = scsi_cd_get(bdev->bd_disk); | 470 | struct scsi_cd *cd; |
471 | int ret = -ENXIO; | 471 | int ret = -ENXIO; |
472 | 472 | ||
473 | lock_kernel(); | ||
474 | cd = scsi_cd_get(bdev->bd_disk); | ||
473 | if (cd) { | 475 | if (cd) { |
474 | ret = cdrom_open(&cd->cdi, bdev, mode); | 476 | ret = cdrom_open(&cd->cdi, bdev, mode); |
475 | if (ret) | 477 | if (ret) |
476 | scsi_cd_put(cd); | 478 | scsi_cd_put(cd); |
477 | } | 479 | } |
480 | unlock_kernel(); | ||
478 | return ret; | 481 | return ret; |
479 | } | 482 | } |
480 | 483 | ||
481 | static int sr_block_release(struct gendisk *disk, fmode_t mode) | 484 | static int sr_block_release(struct gendisk *disk, fmode_t mode) |
482 | { | 485 | { |
483 | struct scsi_cd *cd = scsi_cd(disk); | 486 | struct scsi_cd *cd = scsi_cd(disk); |
487 | lock_kernel(); | ||
484 | cdrom_release(&cd->cdi, mode); | 488 | cdrom_release(&cd->cdi, mode); |
485 | scsi_cd_put(cd); | 489 | scsi_cd_put(cd); |
490 | unlock_kernel(); | ||
486 | return 0; | 491 | return 0; |
487 | } | 492 | } |
488 | 493 | ||
diff --git a/drivers/staging/hv/blkvsc_drv.c b/drivers/staging/hv/blkvsc_drv.c index a9aff90e58e0..87a11c9293e9 100644 --- a/drivers/staging/hv/blkvsc_drv.c +++ b/drivers/staging/hv/blkvsc_drv.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/major.h> | 25 | #include <linux/major.h> |
26 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
27 | #include <linux/hdreg.h> | 27 | #include <linux/hdreg.h> |
28 | #include <linux/smp_lock.h> | ||
28 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
29 | #include <scsi/scsi.h> | 30 | #include <scsi/scsi.h> |
30 | #include <scsi/scsi_cmnd.h> | 31 | #include <scsi/scsi_cmnd.h> |
@@ -1326,6 +1327,7 @@ static int blkvsc_open(struct block_device *bdev, fmode_t mode) | |||
1326 | DPRINT_DBG(BLKVSC_DRV, "- users %d disk %s\n", blkdev->users, | 1327 | DPRINT_DBG(BLKVSC_DRV, "- users %d disk %s\n", blkdev->users, |
1327 | blkdev->gd->disk_name); | 1328 | blkdev->gd->disk_name); |
1328 | 1329 | ||
1330 | lock_kernel(); | ||
1329 | spin_lock(&blkdev->lock); | 1331 | spin_lock(&blkdev->lock); |
1330 | 1332 | ||
1331 | if (!blkdev->users && blkdev->device_type == DVD_TYPE) { | 1333 | if (!blkdev->users && blkdev->device_type == DVD_TYPE) { |
@@ -1337,6 +1339,7 @@ static int blkvsc_open(struct block_device *bdev, fmode_t mode) | |||
1337 | blkdev->users++; | 1339 | blkdev->users++; |
1338 | 1340 | ||
1339 | spin_unlock(&blkdev->lock); | 1341 | spin_unlock(&blkdev->lock); |
1342 | unlock_kernel(); | ||
1340 | return 0; | 1343 | return 0; |
1341 | } | 1344 | } |
1342 | 1345 | ||
@@ -1347,6 +1350,7 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode) | |||
1347 | DPRINT_DBG(BLKVSC_DRV, "- users %d disk %s\n", blkdev->users, | 1350 | DPRINT_DBG(BLKVSC_DRV, "- users %d disk %s\n", blkdev->users, |
1348 | blkdev->gd->disk_name); | 1351 | blkdev->gd->disk_name); |
1349 | 1352 | ||
1353 | lock_kernel(); | ||
1350 | spin_lock(&blkdev->lock); | 1354 | spin_lock(&blkdev->lock); |
1351 | if (blkdev->users == 1) { | 1355 | if (blkdev->users == 1) { |
1352 | spin_unlock(&blkdev->lock); | 1356 | spin_unlock(&blkdev->lock); |
@@ -1357,6 +1361,7 @@ static int blkvsc_release(struct gendisk *disk, fmode_t mode) | |||
1357 | blkdev->users--; | 1361 | blkdev->users--; |
1358 | 1362 | ||
1359 | spin_unlock(&blkdev->lock); | 1363 | spin_unlock(&blkdev->lock); |
1364 | unlock_kernel(); | ||
1360 | return 0; | 1365 | return 0; |
1361 | } | 1366 | } |
1362 | 1367 | ||