diff options
45 files changed, 167 insertions, 131 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index b58fb8941d8d..72569cc3cbb7 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -108,9 +108,9 @@ static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo); | |||
108 | 108 | ||
109 | static struct block_device_operations ubd_blops = { | 109 | static struct block_device_operations ubd_blops = { |
110 | .owner = THIS_MODULE, | 110 | .owner = THIS_MODULE, |
111 | .open = ubd_open, | 111 | .__open = ubd_open, |
112 | .release = ubd_release, | 112 | .__release = ubd_release, |
113 | .ioctl = ubd_ioctl, | 113 | .__ioctl = ubd_ioctl, |
114 | .getgeo = ubd_getgeo, | 114 | .getgeo = ubd_getgeo, |
115 | }; | 115 | }; |
116 | 116 | ||
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index 1e559fba7bdf..576c4fd15463 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c | |||
@@ -708,17 +708,17 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file, | |||
708 | return -ENOIOCTLCMD; | 708 | return -ENOIOCTLCMD; |
709 | } | 709 | } |
710 | 710 | ||
711 | if (disk->fops->unlocked_ioctl) | 711 | if (disk->fops->__unlocked_ioctl) |
712 | return disk->fops->unlocked_ioctl(file, cmd, arg); | 712 | return disk->fops->__unlocked_ioctl(file, cmd, arg); |
713 | 713 | ||
714 | if (disk->fops->ioctl) { | 714 | if (disk->fops->__ioctl) { |
715 | lock_kernel(); | 715 | lock_kernel(); |
716 | ret = disk->fops->ioctl(inode, file, cmd, arg); | 716 | ret = disk->fops->__ioctl(inode, file, cmd, arg); |
717 | unlock_kernel(); | 717 | unlock_kernel(); |
718 | return ret; | 718 | return ret; |
719 | } | 719 | } |
720 | 720 | ||
721 | return -ENOTTY; | 721 | return __blkdev_driver_ioctl(inode->i_bdev, file->f_mode, cmd, arg); |
722 | } | 722 | } |
723 | 723 | ||
724 | static int compat_blkdev_locked_ioctl(struct inode *inode, struct file *file, | 724 | static int compat_blkdev_locked_ioctl(struct inode *inode, struct file *file, |
@@ -805,10 +805,11 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) | |||
805 | 805 | ||
806 | lock_kernel(); | 806 | lock_kernel(); |
807 | ret = compat_blkdev_locked_ioctl(inode, file, bdev, cmd, arg); | 807 | ret = compat_blkdev_locked_ioctl(inode, file, bdev, cmd, arg); |
808 | /* FIXME: why do we assume -> compat_ioctl needs the BKL? */ | 808 | if (ret == -ENOIOCTLCMD && disk->fops->__compat_ioctl) |
809 | if (ret == -ENOIOCTLCMD && disk->fops->compat_ioctl) | 809 | ret = disk->fops->__compat_ioctl(file, cmd, arg); |
810 | ret = disk->fops->compat_ioctl(file, cmd, arg); | ||
811 | unlock_kernel(); | 810 | unlock_kernel(); |
811 | if (ret == -ENOIOCTLCMD && disk->fops->compat_ioctl) | ||
812 | ret = disk->fops->compat_ioctl(bdev, file->f_mode, cmd, arg); | ||
812 | 813 | ||
813 | if (ret != -ENOIOCTLCMD) | 814 | if (ret != -ENOIOCTLCMD) |
814 | return ret; | 815 | return ret; |
diff --git a/block/ioctl.c b/block/ioctl.c index 9a26ace6d042..01ff463bc801 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -269,17 +269,24 @@ int blkdev_driver_ioctl(struct inode *inode, struct file *file, | |||
269 | struct gendisk *disk, unsigned cmd, unsigned long arg) | 269 | struct gendisk *disk, unsigned cmd, unsigned long arg) |
270 | { | 270 | { |
271 | int ret; | 271 | int ret; |
272 | if (disk->fops->unlocked_ioctl) | 272 | fmode_t mode = 0; |
273 | return disk->fops->unlocked_ioctl(file, cmd, arg); | 273 | if (file) { |
274 | mode = file->f_mode; | ||
275 | if (file->f_flags & O_NDELAY) | ||
276 | mode |= FMODE_NDELAY_NOW; | ||
277 | } | ||
278 | |||
279 | if (disk->fops->__unlocked_ioctl) | ||
280 | return disk->fops->__unlocked_ioctl(file, cmd, arg); | ||
274 | 281 | ||
275 | if (disk->fops->ioctl) { | 282 | if (disk->fops->__ioctl) { |
276 | lock_kernel(); | 283 | lock_kernel(); |
277 | ret = disk->fops->ioctl(inode, file, cmd, arg); | 284 | ret = disk->fops->__ioctl(inode, file, cmd, arg); |
278 | unlock_kernel(); | 285 | unlock_kernel(); |
279 | return ret; | 286 | return ret; |
280 | } | 287 | } |
281 | 288 | ||
282 | return -ENOTTY; | 289 | return __blkdev_driver_ioctl(inode->i_bdev, mode, cmd, arg); |
283 | } | 290 | } |
284 | EXPORT_SYMBOL_GPL(blkdev_driver_ioctl); | 291 | EXPORT_SYMBOL_GPL(blkdev_driver_ioctl); |
285 | 292 | ||
@@ -295,12 +302,22 @@ int __blkdev_driver_ioctl(struct block_device *bdev, fmode_t mode, | |||
295 | fake_file.f_path.dentry = &fake_dentry; | 302 | fake_file.f_path.dentry = &fake_dentry; |
296 | fake_dentry.d_inode = bdev->bd_inode; | 303 | fake_dentry.d_inode = bdev->bd_inode; |
297 | 304 | ||
298 | if (disk->fops->unlocked_ioctl) | 305 | if (disk->fops->__unlocked_ioctl) |
299 | return disk->fops->unlocked_ioctl(&fake_file, cmd, arg); | 306 | return disk->fops->__unlocked_ioctl(&fake_file, cmd, arg); |
307 | |||
308 | if (disk->fops->__ioctl) { | ||
309 | lock_kernel(); | ||
310 | ret = disk->fops->__ioctl(bdev->bd_inode, &fake_file, cmd, arg); | ||
311 | unlock_kernel(); | ||
312 | return ret; | ||
313 | } | ||
314 | |||
315 | if (disk->fops->ioctl) | ||
316 | return disk->fops->ioctl(bdev, mode, cmd, arg); | ||
300 | 317 | ||
301 | if (disk->fops->ioctl) { | 318 | if (disk->fops->locked_ioctl) { |
302 | lock_kernel(); | 319 | lock_kernel(); |
303 | ret = disk->fops->ioctl(bdev->bd_inode, &fake_file, cmd, arg); | 320 | ret = disk->fops->locked_ioctl(bdev, mode, cmd, arg); |
304 | unlock_kernel(); | 321 | unlock_kernel(); |
305 | return ret; | 322 | return ret; |
306 | } | 323 | } |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index a002a381df92..4b90ebfa6676 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -153,7 +153,7 @@ static int DAC960_revalidate_disk(struct gendisk *disk) | |||
153 | 153 | ||
154 | static struct block_device_operations DAC960_BlockDeviceOperations = { | 154 | static struct block_device_operations DAC960_BlockDeviceOperations = { |
155 | .owner = THIS_MODULE, | 155 | .owner = THIS_MODULE, |
156 | .open = DAC960_open, | 156 | .__open = DAC960_open, |
157 | .getgeo = DAC960_getgeo, | 157 | .getgeo = DAC960_getgeo, |
158 | .media_changed = DAC960_media_changed, | 158 | .media_changed = DAC960_media_changed, |
159 | .revalidate_disk = DAC960_revalidate_disk, | 159 | .revalidate_disk = DAC960_revalidate_disk, |
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index d19c5a939fe8..d5da4e3cb2ad 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1648,9 +1648,9 @@ static int amiga_floppy_change(struct gendisk *disk) | |||
1648 | 1648 | ||
1649 | static struct block_device_operations floppy_fops = { | 1649 | static struct block_device_operations floppy_fops = { |
1650 | .owner = THIS_MODULE, | 1650 | .owner = THIS_MODULE, |
1651 | .open = floppy_open, | 1651 | .__open = floppy_open, |
1652 | .release = floppy_release, | 1652 | .__release = floppy_release, |
1653 | .ioctl = fd_ioctl, | 1653 | .__ioctl = fd_ioctl, |
1654 | .getgeo = fd_getgeo, | 1654 | .getgeo = fd_getgeo, |
1655 | .media_changed = amiga_floppy_change, | 1655 | .media_changed = amiga_floppy_change, |
1656 | }; | 1656 | }; |
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c index d876ad861237..d4d9796d5ddd 100644 --- a/drivers/block/aoe/aoeblk.c +++ b/drivers/block/aoe/aoeblk.c | |||
@@ -239,8 +239,8 @@ aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
239 | } | 239 | } |
240 | 240 | ||
241 | static struct block_device_operations aoe_bdops = { | 241 | static struct block_device_operations aoe_bdops = { |
242 | .open = aoeblk_open, | 242 | .__open = aoeblk_open, |
243 | .release = aoeblk_release, | 243 | .__release = aoeblk_release, |
244 | .getgeo = aoeblk_getgeo, | 244 | .getgeo = aoeblk_getgeo, |
245 | .owner = THIS_MODULE, | 245 | .owner = THIS_MODULE, |
246 | }; | 246 | }; |
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index 85d56a26f7c6..30166774327d 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -1857,9 +1857,9 @@ static int floppy_release( struct inode * inode, struct file * filp ) | |||
1857 | 1857 | ||
1858 | static struct block_device_operations floppy_fops = { | 1858 | static struct block_device_operations floppy_fops = { |
1859 | .owner = THIS_MODULE, | 1859 | .owner = THIS_MODULE, |
1860 | .open = floppy_open, | 1860 | .__open = floppy_open, |
1861 | .release = floppy_release, | 1861 | .__release = floppy_release, |
1862 | .ioctl = fd_ioctl, | 1862 | .__ioctl = fd_ioctl, |
1863 | .media_changed = check_floppy_change, | 1863 | .media_changed = check_floppy_change, |
1864 | .revalidate_disk= floppy_revalidate, | 1864 | .revalidate_disk= floppy_revalidate, |
1865 | }; | 1865 | }; |
diff --git a/drivers/block/brd.c b/drivers/block/brd.c index d070d492e385..2ea99f947667 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c | |||
@@ -376,7 +376,7 @@ static int brd_ioctl(struct inode *inode, struct file *file, | |||
376 | 376 | ||
377 | static struct block_device_operations brd_fops = { | 377 | static struct block_device_operations brd_fops = { |
378 | .owner = THIS_MODULE, | 378 | .owner = THIS_MODULE, |
379 | .ioctl = brd_ioctl, | 379 | .__ioctl = brd_ioctl, |
380 | #ifdef CONFIG_BLK_DEV_XIP | 380 | #ifdef CONFIG_BLK_DEV_XIP |
381 | .direct_access = brd_direct_access, | 381 | .direct_access = brd_direct_access, |
382 | #endif | 382 | #endif |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index d9b1c15b8113..781b745181d2 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -197,12 +197,12 @@ static long cciss_compat_ioctl(struct file *f, unsigned cmd, unsigned long arg); | |||
197 | 197 | ||
198 | static struct block_device_operations cciss_fops = { | 198 | static struct block_device_operations cciss_fops = { |
199 | .owner = THIS_MODULE, | 199 | .owner = THIS_MODULE, |
200 | .open = cciss_open, | 200 | .__open = cciss_open, |
201 | .release = cciss_release, | 201 | .__release = cciss_release, |
202 | .ioctl = cciss_ioctl, | 202 | .__ioctl = cciss_ioctl, |
203 | .getgeo = cciss_getgeo, | 203 | .getgeo = cciss_getgeo, |
204 | #ifdef CONFIG_COMPAT | 204 | #ifdef CONFIG_COMPAT |
205 | .compat_ioctl = cciss_compat_ioctl, | 205 | .__compat_ioctl = cciss_compat_ioctl, |
206 | #endif | 206 | #endif |
207 | .revalidate_disk = cciss_revalidate, | 207 | .revalidate_disk = cciss_revalidate, |
208 | }; | 208 | }; |
diff --git a/drivers/block/cpqarray.c b/drivers/block/cpqarray.c index 3d967525e9a9..b71334b968b6 100644 --- a/drivers/block/cpqarray.c +++ b/drivers/block/cpqarray.c | |||
@@ -195,9 +195,9 @@ static inline ctlr_info_t *get_host(struct gendisk *disk) | |||
195 | 195 | ||
196 | static struct block_device_operations ida_fops = { | 196 | static struct block_device_operations ida_fops = { |
197 | .owner = THIS_MODULE, | 197 | .owner = THIS_MODULE, |
198 | .open = ida_open, | 198 | .__open = ida_open, |
199 | .release = ida_release, | 199 | .__release = ida_release, |
200 | .ioctl = ida_ioctl, | 200 | .__ioctl = ida_ioctl, |
201 | .getgeo = ida_getgeo, | 201 | .getgeo = ida_getgeo, |
202 | .revalidate_disk= ida_revalidate, | 202 | .revalidate_disk= ida_revalidate, |
203 | }; | 203 | }; |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 5d60c05a736a..72363df58953 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -3902,9 +3902,9 @@ static int floppy_revalidate(struct gendisk *disk) | |||
3902 | 3902 | ||
3903 | static struct block_device_operations floppy_fops = { | 3903 | static struct block_device_operations floppy_fops = { |
3904 | .owner = THIS_MODULE, | 3904 | .owner = THIS_MODULE, |
3905 | .open = floppy_open, | 3905 | .__open = floppy_open, |
3906 | .release = floppy_release, | 3906 | .__release = floppy_release, |
3907 | .ioctl = fd_ioctl, | 3907 | .__ioctl = fd_ioctl, |
3908 | .getgeo = fd_getgeo, | 3908 | .getgeo = fd_getgeo, |
3909 | .media_changed = check_floppy_change, | 3909 | .media_changed = check_floppy_change, |
3910 | .revalidate_disk = floppy_revalidate, | 3910 | .revalidate_disk = floppy_revalidate, |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index d3a25b027ff9..6faca2b7ae37 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -1355,11 +1355,11 @@ static int lo_release(struct inode *inode, struct file *file) | |||
1355 | 1355 | ||
1356 | static struct block_device_operations lo_fops = { | 1356 | static struct block_device_operations lo_fops = { |
1357 | .owner = THIS_MODULE, | 1357 | .owner = THIS_MODULE, |
1358 | .open = lo_open, | 1358 | .__open = lo_open, |
1359 | .release = lo_release, | 1359 | .__release = lo_release, |
1360 | .ioctl = lo_ioctl, | 1360 | .__ioctl = lo_ioctl, |
1361 | #ifdef CONFIG_COMPAT | 1361 | #ifdef CONFIG_COMPAT |
1362 | .compat_ioctl = lo_compat_ioctl, | 1362 | .__compat_ioctl = lo_compat_ioctl, |
1363 | #endif | 1363 | #endif |
1364 | }; | 1364 | }; |
1365 | 1365 | ||
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 9034ca585afd..36015e0945b1 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -691,7 +691,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file, | |||
691 | static struct block_device_operations nbd_fops = | 691 | static struct block_device_operations nbd_fops = |
692 | { | 692 | { |
693 | .owner = THIS_MODULE, | 693 | .owner = THIS_MODULE, |
694 | .ioctl = nbd_ioctl, | 694 | .__ioctl = nbd_ioctl, |
695 | }; | 695 | }; |
696 | 696 | ||
697 | /* | 697 | /* |
diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index 8bd557e2a659..6e6dcc1d4328 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c | |||
@@ -252,9 +252,9 @@ static int pcd_block_media_changed(struct gendisk *disk) | |||
252 | 252 | ||
253 | static struct block_device_operations pcd_bdops = { | 253 | static struct block_device_operations pcd_bdops = { |
254 | .owner = THIS_MODULE, | 254 | .owner = THIS_MODULE, |
255 | .open = pcd_block_open, | 255 | .__open = pcd_block_open, |
256 | .release = pcd_block_release, | 256 | .__release = pcd_block_release, |
257 | .ioctl = pcd_block_ioctl, | 257 | .__ioctl = pcd_block_ioctl, |
258 | .media_changed = pcd_block_media_changed, | 258 | .media_changed = pcd_block_media_changed, |
259 | }; | 259 | }; |
260 | 260 | ||
diff --git a/drivers/block/paride/pd.c b/drivers/block/paride/pd.c index 5fdfa7c888ce..b3023844947c 100644 --- a/drivers/block/paride/pd.c +++ b/drivers/block/paride/pd.c | |||
@@ -807,9 +807,9 @@ static int pd_revalidate(struct gendisk *p) | |||
807 | 807 | ||
808 | static struct block_device_operations pd_fops = { | 808 | static struct block_device_operations pd_fops = { |
809 | .owner = THIS_MODULE, | 809 | .owner = THIS_MODULE, |
810 | .open = pd_open, | 810 | .__open = pd_open, |
811 | .release = pd_release, | 811 | .__release = pd_release, |
812 | .ioctl = pd_ioctl, | 812 | .__ioctl = pd_ioctl, |
813 | .getgeo = pd_getgeo, | 813 | .getgeo = pd_getgeo, |
814 | .media_changed = pd_check_media, | 814 | .media_changed = pd_check_media, |
815 | .revalidate_disk= pd_revalidate | 815 | .revalidate_disk= pd_revalidate |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index a902d84fd330..e08ca5161ad8 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -264,9 +264,9 @@ static char *pf_buf; /* buffer for request in progress */ | |||
264 | 264 | ||
265 | static struct block_device_operations pf_fops = { | 265 | static struct block_device_operations pf_fops = { |
266 | .owner = THIS_MODULE, | 266 | .owner = THIS_MODULE, |
267 | .open = pf_open, | 267 | .__open = pf_open, |
268 | .release = pf_release, | 268 | .__release = pf_release, |
269 | .ioctl = pf_ioctl, | 269 | .__ioctl = pf_ioctl, |
270 | .getgeo = pf_getgeo, | 270 | .getgeo = pf_getgeo, |
271 | .media_changed = pf_check_media, | 271 | .media_changed = pf_check_media, |
272 | }; | 272 | }; |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index a0ba4023953b..33ac8ddf4912 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2847,9 +2847,9 @@ static int pkt_media_changed(struct gendisk *disk) | |||
2847 | 2847 | ||
2848 | static struct block_device_operations pktcdvd_ops = { | 2848 | static struct block_device_operations pktcdvd_ops = { |
2849 | .owner = THIS_MODULE, | 2849 | .owner = THIS_MODULE, |
2850 | .open = pkt_open, | 2850 | .__open = pkt_open, |
2851 | .release = pkt_close, | 2851 | .__release = pkt_close, |
2852 | .ioctl = pkt_ioctl, | 2852 | .__ioctl = pkt_ioctl, |
2853 | .media_changed = pkt_media_changed, | 2853 | .media_changed = pkt_media_changed, |
2854 | }; | 2854 | }; |
2855 | 2855 | ||
diff --git a/drivers/block/swim3.c b/drivers/block/swim3.c index 5c45d5556ae8..9398af86a7aa 100644 --- a/drivers/block/swim3.c +++ b/drivers/block/swim3.c | |||
@@ -998,9 +998,9 @@ static int floppy_revalidate(struct gendisk *disk) | |||
998 | } | 998 | } |
999 | 999 | ||
1000 | static struct block_device_operations floppy_fops = { | 1000 | static struct block_device_operations floppy_fops = { |
1001 | .open = floppy_open, | 1001 | .__open = floppy_open, |
1002 | .release = floppy_release, | 1002 | .__release = floppy_release, |
1003 | .ioctl = floppy_ioctl, | 1003 | .__ioctl = floppy_ioctl, |
1004 | .media_changed = floppy_check_change, | 1004 | .media_changed = floppy_check_change, |
1005 | .revalidate_disk= floppy_revalidate, | 1005 | .revalidate_disk= floppy_revalidate, |
1006 | }; | 1006 | }; |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index bc04330f3683..5261773407da 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -1791,9 +1791,9 @@ static int ub_bd_media_changed(struct gendisk *disk) | |||
1791 | 1791 | ||
1792 | static struct block_device_operations ub_bd_fops = { | 1792 | static struct block_device_operations ub_bd_fops = { |
1793 | .owner = THIS_MODULE, | 1793 | .owner = THIS_MODULE, |
1794 | .open = ub_bd_open, | 1794 | .__open = ub_bd_open, |
1795 | .release = ub_bd_release, | 1795 | .__release = ub_bd_release, |
1796 | .ioctl = ub_bd_ioctl, | 1796 | .__ioctl = ub_bd_ioctl, |
1797 | .media_changed = ub_bd_media_changed, | 1797 | .media_changed = ub_bd_media_changed, |
1798 | .revalidate_disk = ub_bd_revalidate, | 1798 | .revalidate_disk = ub_bd_revalidate, |
1799 | }; | 1799 | }; |
diff --git a/drivers/block/viodasd.c b/drivers/block/viodasd.c index 1730d29e6044..7f7beec29ebb 100644 --- a/drivers/block/viodasd.c +++ b/drivers/block/viodasd.c | |||
@@ -221,8 +221,8 @@ static int viodasd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
221 | */ | 221 | */ |
222 | static struct block_device_operations viodasd_fops = { | 222 | static struct block_device_operations viodasd_fops = { |
223 | .owner = THIS_MODULE, | 223 | .owner = THIS_MODULE, |
224 | .open = viodasd_open, | 224 | .__open = viodasd_open, |
225 | .release = viodasd_release, | 225 | .__release = viodasd_release, |
226 | .getgeo = viodasd_getgeo, | 226 | .getgeo = viodasd_getgeo, |
227 | }; | 227 | }; |
228 | 228 | ||
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 7643cd16fd67..10f157ea7b0b 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -180,7 +180,7 @@ static int virtblk_getgeo(struct block_device *bd, struct hd_geometry *geo) | |||
180 | } | 180 | } |
181 | 181 | ||
182 | static struct block_device_operations virtblk_fops = { | 182 | static struct block_device_operations virtblk_fops = { |
183 | .ioctl = virtblk_ioctl, | 183 | .__ioctl = virtblk_ioctl, |
184 | .owner = THIS_MODULE, | 184 | .owner = THIS_MODULE, |
185 | .getgeo = virtblk_getgeo, | 185 | .getgeo = virtblk_getgeo, |
186 | }; | 186 | }; |
diff --git a/drivers/block/xd.c b/drivers/block/xd.c index 624d30f7da3f..316fa1da4b9c 100644 --- a/drivers/block/xd.c +++ b/drivers/block/xd.c | |||
@@ -132,7 +132,7 @@ static int xd_getgeo(struct block_device *bdev, struct hd_geometry *geo); | |||
132 | 132 | ||
133 | static struct block_device_operations xd_fops = { | 133 | static struct block_device_operations xd_fops = { |
134 | .owner = THIS_MODULE, | 134 | .owner = THIS_MODULE, |
135 | .ioctl = xd_ioctl, | 135 | .__ioctl = xd_ioctl, |
136 | .getgeo = xd_getgeo, | 136 | .getgeo = xd_getgeo, |
137 | }; | 137 | }; |
138 | static DECLARE_WAIT_QUEUE_HEAD(xd_wait_int); | 138 | static DECLARE_WAIT_QUEUE_HEAD(xd_wait_int); |
diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c index 1a50ae70f716..7efac80c8dde 100644 --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c | |||
@@ -1041,8 +1041,8 @@ static int blkif_release(struct inode *inode, struct file *filep) | |||
1041 | static struct block_device_operations xlvbd_block_fops = | 1041 | static struct block_device_operations xlvbd_block_fops = |
1042 | { | 1042 | { |
1043 | .owner = THIS_MODULE, | 1043 | .owner = THIS_MODULE, |
1044 | .open = blkif_open, | 1044 | .__open = blkif_open, |
1045 | .release = blkif_release, | 1045 | .__release = blkif_release, |
1046 | .getgeo = blkif_getgeo, | 1046 | .getgeo = blkif_getgeo, |
1047 | .ioctl = blkif_ioctl, | 1047 | .ioctl = blkif_ioctl, |
1048 | }; | 1048 | }; |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index 4a7a059ebaf7..e4efe5b7ec22 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -919,8 +919,8 @@ static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
919 | 919 | ||
920 | static struct block_device_operations ace_fops = { | 920 | static struct block_device_operations ace_fops = { |
921 | .owner = THIS_MODULE, | 921 | .owner = THIS_MODULE, |
922 | .open = ace_open, | 922 | .__open = ace_open, |
923 | .release = ace_release, | 923 | .__release = ace_release, |
924 | .media_changed = ace_media_changed, | 924 | .media_changed = ace_media_changed, |
925 | .revalidate_disk = ace_revalidate_disk, | 925 | .revalidate_disk = ace_revalidate_disk, |
926 | .getgeo = ace_getgeo, | 926 | .getgeo = ace_getgeo, |
diff --git a/drivers/block/z2ram.c b/drivers/block/z2ram.c index be20a67f1fa8..4860d0f36870 100644 --- a/drivers/block/z2ram.c +++ b/drivers/block/z2ram.c | |||
@@ -314,8 +314,8 @@ z2_release( struct inode *inode, struct file *filp ) | |||
314 | static struct block_device_operations z2_fops = | 314 | static struct block_device_operations z2_fops = |
315 | { | 315 | { |
316 | .owner = THIS_MODULE, | 316 | .owner = THIS_MODULE, |
317 | .open = z2_open, | 317 | .__open = z2_open, |
318 | .release = z2_release, | 318 | .__release = z2_release, |
319 | }; | 319 | }; |
320 | 320 | ||
321 | static struct kobject *z2_find(dev_t dev, int *part, void *data) | 321 | static struct kobject *z2_find(dev_t dev, int *part, void *data) |
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 0959edf2afdb..ab0c637f58be 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c | |||
@@ -514,10 +514,10 @@ static int gdrom_bdops_ioctl(struct inode *inode, struct file *file, | |||
514 | 514 | ||
515 | static struct block_device_operations gdrom_bdops = { | 515 | static struct block_device_operations gdrom_bdops = { |
516 | .owner = THIS_MODULE, | 516 | .owner = THIS_MODULE, |
517 | .open = gdrom_bdops_open, | 517 | .__open = gdrom_bdops_open, |
518 | .release = gdrom_bdops_release, | 518 | .__release = gdrom_bdops_release, |
519 | .media_changed = gdrom_bdops_mediachanged, | 519 | .media_changed = gdrom_bdops_mediachanged, |
520 | .ioctl = gdrom_bdops_ioctl, | 520 | .__ioctl = gdrom_bdops_ioctl, |
521 | }; | 521 | }; |
522 | 522 | ||
523 | static irqreturn_t gdrom_command_interrupt(int irq, void *dev_id) | 523 | static irqreturn_t gdrom_command_interrupt(int irq, void *dev_id) |
diff --git a/drivers/cdrom/viocd.c b/drivers/cdrom/viocd.c index abc4079c3f41..57c2dced3e9d 100644 --- a/drivers/cdrom/viocd.c +++ b/drivers/cdrom/viocd.c | |||
@@ -180,9 +180,9 @@ static int viocd_blk_media_changed(struct gendisk *disk) | |||
180 | 180 | ||
181 | struct block_device_operations viocd_fops = { | 181 | struct block_device_operations viocd_fops = { |
182 | .owner = THIS_MODULE, | 182 | .owner = THIS_MODULE, |
183 | .open = viocd_blk_open, | 183 | .__open = viocd_blk_open, |
184 | .release = viocd_blk_release, | 184 | .__release = viocd_blk_release, |
185 | .ioctl = viocd_blk_ioctl, | 185 | .__ioctl = viocd_blk_ioctl, |
186 | .media_changed = viocd_blk_media_changed, | 186 | .media_changed = viocd_blk_media_changed, |
187 | }; | 187 | }; |
188 | 188 | ||
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index 87d90200b169..3533984355a6 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -2200,9 +2200,9 @@ static int idecd_revalidate_disk(struct gendisk *disk) | |||
2200 | 2200 | ||
2201 | static struct block_device_operations idecd_ops = { | 2201 | static struct block_device_operations idecd_ops = { |
2202 | .owner = THIS_MODULE, | 2202 | .owner = THIS_MODULE, |
2203 | .open = idecd_open, | 2203 | .__open = idecd_open, |
2204 | .release = idecd_release, | 2204 | .__release = idecd_release, |
2205 | .ioctl = idecd_ioctl, | 2205 | .__ioctl = idecd_ioctl, |
2206 | .media_changed = idecd_media_changed, | 2206 | .media_changed = idecd_media_changed, |
2207 | .revalidate_disk = idecd_revalidate_disk | 2207 | .revalidate_disk = idecd_revalidate_disk |
2208 | }; | 2208 | }; |
diff --git a/drivers/ide/ide-gd.c b/drivers/ide/ide-gd.c index 948af08abe23..d118bbed7cd3 100644 --- a/drivers/ide/ide-gd.c +++ b/drivers/ide/ide-gd.c | |||
@@ -298,9 +298,9 @@ static int ide_gd_ioctl(struct inode *inode, struct file *file, | |||
298 | 298 | ||
299 | static struct block_device_operations ide_gd_ops = { | 299 | static struct block_device_operations ide_gd_ops = { |
300 | .owner = THIS_MODULE, | 300 | .owner = THIS_MODULE, |
301 | .open = ide_gd_open, | 301 | .__open = ide_gd_open, |
302 | .release = ide_gd_release, | 302 | .__release = ide_gd_release, |
303 | .ioctl = ide_gd_ioctl, | 303 | .__ioctl = ide_gd_ioctl, |
304 | .getgeo = ide_gd_getgeo, | 304 | .getgeo = ide_gd_getgeo, |
305 | .media_changed = ide_gd_media_changed, | 305 | .media_changed = ide_gd_media_changed, |
306 | .revalidate_disk = ide_gd_revalidate_disk | 306 | .revalidate_disk = ide_gd_revalidate_disk |
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c index 2b263281ffea..c5df53c4838c 100644 --- a/drivers/ide/ide-tape.c +++ b/drivers/ide/ide-tape.c | |||
@@ -2376,9 +2376,9 @@ static int idetape_ioctl(struct inode *inode, struct file *file, | |||
2376 | 2376 | ||
2377 | static struct block_device_operations idetape_block_ops = { | 2377 | static struct block_device_operations idetape_block_ops = { |
2378 | .owner = THIS_MODULE, | 2378 | .owner = THIS_MODULE, |
2379 | .open = idetape_open, | 2379 | .__open = idetape_open, |
2380 | .release = idetape_release, | 2380 | .__release = idetape_release, |
2381 | .ioctl = idetape_ioctl, | 2381 | .__ioctl = idetape_ioctl, |
2382 | }; | 2382 | }; |
2383 | 2383 | ||
2384 | static int ide_tape_probe(ide_drive_t *drive) | 2384 | static int ide_tape_probe(ide_drive_t *drive) |
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 5f0f4c8bcd3e..8b4c92b1b6db 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -1698,9 +1698,9 @@ int dm_noflush_suspending(struct dm_target *ti) | |||
1698 | EXPORT_SYMBOL_GPL(dm_noflush_suspending); | 1698 | EXPORT_SYMBOL_GPL(dm_noflush_suspending); |
1699 | 1699 | ||
1700 | static struct block_device_operations dm_blk_dops = { | 1700 | static struct block_device_operations dm_blk_dops = { |
1701 | .open = dm_blk_open, | 1701 | .__open = dm_blk_open, |
1702 | .release = dm_blk_close, | 1702 | .__release = dm_blk_close, |
1703 | .ioctl = dm_blk_ioctl, | 1703 | .__ioctl = dm_blk_ioctl, |
1704 | .getgeo = dm_blk_getgeo, | 1704 | .getgeo = dm_blk_getgeo, |
1705 | .owner = THIS_MODULE | 1705 | .owner = THIS_MODULE |
1706 | }; | 1706 | }; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index aaa3d465de4e..21b04d39ba3b 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -5046,9 +5046,9 @@ static int md_revalidate(struct gendisk *disk) | |||
5046 | static struct block_device_operations md_fops = | 5046 | static struct block_device_operations md_fops = |
5047 | { | 5047 | { |
5048 | .owner = THIS_MODULE, | 5048 | .owner = THIS_MODULE, |
5049 | .open = md_open, | 5049 | .__open = md_open, |
5050 | .release = md_release, | 5050 | .__release = md_release, |
5051 | .ioctl = md_ioctl, | 5051 | .__ioctl = md_ioctl, |
5052 | .getgeo = md_getgeo, | 5052 | .getgeo = md_getgeo, |
5053 | .media_changed = md_media_changed, | 5053 | .media_changed = md_media_changed, |
5054 | .revalidate_disk= md_revalidate, | 5054 | .revalidate_disk= md_revalidate, |
diff --git a/drivers/memstick/core/mspro_block.c b/drivers/memstick/core/mspro_block.c index 5263913e0c69..fbe5919789d0 100644 --- a/drivers/memstick/core/mspro_block.c +++ b/drivers/memstick/core/mspro_block.c | |||
@@ -237,8 +237,8 @@ static int mspro_block_bd_getgeo(struct block_device *bdev, | |||
237 | } | 237 | } |
238 | 238 | ||
239 | static struct block_device_operations ms_block_bdops = { | 239 | static struct block_device_operations ms_block_bdops = { |
240 | .open = mspro_block_bd_open, | 240 | .__open = mspro_block_bd_open, |
241 | .release = mspro_block_bd_release, | 241 | .__release = mspro_block_bd_release, |
242 | .getgeo = mspro_block_bd_getgeo, | 242 | .getgeo = mspro_block_bd_getgeo, |
243 | .owner = THIS_MODULE | 243 | .owner = THIS_MODULE |
244 | }; | 244 | }; |
diff --git a/drivers/message/i2o/i2o_block.c b/drivers/message/i2o/i2o_block.c index 81483de8c0fd..71500dda8eb3 100644 --- a/drivers/message/i2o/i2o_block.c +++ b/drivers/message/i2o/i2o_block.c | |||
@@ -931,9 +931,9 @@ static void i2o_block_request_fn(struct request_queue *q) | |||
931 | /* I2O Block device operations definition */ | 931 | /* I2O Block device operations definition */ |
932 | static struct block_device_operations i2o_block_fops = { | 932 | static struct block_device_operations i2o_block_fops = { |
933 | .owner = THIS_MODULE, | 933 | .owner = THIS_MODULE, |
934 | .open = i2o_block_open, | 934 | .__open = i2o_block_open, |
935 | .release = i2o_block_release, | 935 | .__release = i2o_block_release, |
936 | .ioctl = i2o_block_ioctl, | 936 | .__ioctl = i2o_block_ioctl, |
937 | .getgeo = i2o_block_getgeo, | 937 | .getgeo = i2o_block_getgeo, |
938 | .media_changed = i2o_block_media_changed | 938 | .media_changed = i2o_block_media_changed |
939 | }; | 939 | }; |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 24c97d3d16bb..8cba06f5e11d 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -130,8 +130,8 @@ mmc_blk_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
130 | } | 130 | } |
131 | 131 | ||
132 | static struct block_device_operations mmc_bdops = { | 132 | static struct block_device_operations mmc_bdops = { |
133 | .open = mmc_blk_open, | 133 | .__open = mmc_blk_open, |
134 | .release = mmc_blk_release, | 134 | .__release = mmc_blk_release, |
135 | .getgeo = mmc_blk_getgeo, | 135 | .getgeo = mmc_blk_getgeo, |
136 | .owner = THIS_MODULE, | 136 | .owner = THIS_MODULE, |
137 | }; | 137 | }; |
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c index 681d5aca2af4..b00d07c53753 100644 --- a/drivers/mtd/mtd_blkdevs.c +++ b/drivers/mtd/mtd_blkdevs.c | |||
@@ -213,9 +213,9 @@ static int blktrans_ioctl(struct inode *inode, struct file *file, | |||
213 | 213 | ||
214 | static struct block_device_operations mtd_blktrans_ops = { | 214 | static struct block_device_operations mtd_blktrans_ops = { |
215 | .owner = THIS_MODULE, | 215 | .owner = THIS_MODULE, |
216 | .open = blktrans_open, | 216 | .__open = blktrans_open, |
217 | .release = blktrans_release, | 217 | .__release = blktrans_release, |
218 | .ioctl = blktrans_ioctl, | 218 | .__ioctl = blktrans_ioctl, |
219 | .getgeo = blktrans_getgeo, | 219 | .getgeo = blktrans_getgeo, |
220 | }; | 220 | }; |
221 | 221 | ||
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 0a225ccda026..6bf68e5fe89f 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -2087,10 +2087,10 @@ static int dasd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
2087 | struct block_device_operations | 2087 | struct block_device_operations |
2088 | dasd_device_operations = { | 2088 | dasd_device_operations = { |
2089 | .owner = THIS_MODULE, | 2089 | .owner = THIS_MODULE, |
2090 | .open = dasd_open, | 2090 | .__open = dasd_open, |
2091 | .release = dasd_release, | 2091 | .__release = dasd_release, |
2092 | .ioctl = dasd_ioctl, | 2092 | .__ioctl = dasd_ioctl, |
2093 | .compat_ioctl = dasd_compat_ioctl, | 2093 | .__compat_ioctl = dasd_compat_ioctl, |
2094 | .getgeo = dasd_getgeo, | 2094 | .getgeo = dasd_getgeo, |
2095 | }; | 2095 | }; |
2096 | 2096 | ||
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index a7ff167d5b81..413460cc3dd8 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -42,8 +42,8 @@ static char dcssblk_segments[DCSSBLK_PARM_LEN] = "\0"; | |||
42 | static int dcssblk_major; | 42 | static int dcssblk_major; |
43 | static struct block_device_operations dcssblk_devops = { | 43 | static struct block_device_operations dcssblk_devops = { |
44 | .owner = THIS_MODULE, | 44 | .owner = THIS_MODULE, |
45 | .open = dcssblk_open, | 45 | .__open = dcssblk_open, |
46 | .release = dcssblk_release, | 46 | .__release = dcssblk_release, |
47 | .direct_access = dcssblk_direct_access, | 47 | .direct_access = dcssblk_direct_access, |
48 | }; | 48 | }; |
49 | 49 | ||
diff --git a/drivers/s390/char/tape_block.c b/drivers/s390/char/tape_block.c index a25b8bf54f41..f1a741c9a6f0 100644 --- a/drivers/s390/char/tape_block.c +++ b/drivers/s390/char/tape_block.c | |||
@@ -52,9 +52,9 @@ static int tapeblock_revalidate_disk(struct gendisk *); | |||
52 | 52 | ||
53 | static struct block_device_operations tapeblock_fops = { | 53 | static struct block_device_operations tapeblock_fops = { |
54 | .owner = THIS_MODULE, | 54 | .owner = THIS_MODULE, |
55 | .open = tapeblock_open, | 55 | .__open = tapeblock_open, |
56 | .release = tapeblock_release, | 56 | .__release = tapeblock_release, |
57 | .ioctl = tapeblock_ioctl, | 57 | .__ioctl = tapeblock_ioctl, |
58 | .media_changed = tapeblock_medium_changed, | 58 | .media_changed = tapeblock_medium_changed, |
59 | .revalidate_disk = tapeblock_revalidate_disk, | 59 | .revalidate_disk = tapeblock_revalidate_disk, |
60 | }; | 60 | }; |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 5bcc04e82c28..9069afbad9d3 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -483,9 +483,9 @@ static int idescsi_ide_ioctl(struct inode *inode, struct file *file, | |||
483 | 483 | ||
484 | static struct block_device_operations idescsi_ops = { | 484 | static struct block_device_operations idescsi_ops = { |
485 | .owner = THIS_MODULE, | 485 | .owner = THIS_MODULE, |
486 | .open = idescsi_ide_open, | 486 | .__open = idescsi_ide_open, |
487 | .release = idescsi_ide_release, | 487 | .__release = idescsi_ide_release, |
488 | .ioctl = idescsi_ide_ioctl, | 488 | .__ioctl = idescsi_ide_ioctl, |
489 | }; | 489 | }; |
490 | 490 | ||
491 | static int idescsi_slave_configure(struct scsi_device * sdp) | 491 | static int idescsi_slave_configure(struct scsi_device * sdp) |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 5a18528a69d0..c8b95e8d2859 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -962,12 +962,12 @@ static long sd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a | |||
962 | 962 | ||
963 | static struct block_device_operations sd_fops = { | 963 | static struct block_device_operations sd_fops = { |
964 | .owner = THIS_MODULE, | 964 | .owner = THIS_MODULE, |
965 | .open = sd_open, | 965 | .__open = sd_open, |
966 | .release = sd_release, | 966 | .__release = sd_release, |
967 | .ioctl = sd_ioctl, | 967 | .__ioctl = sd_ioctl, |
968 | .getgeo = sd_getgeo, | 968 | .getgeo = sd_getgeo, |
969 | #ifdef CONFIG_COMPAT | 969 | #ifdef CONFIG_COMPAT |
970 | .compat_ioctl = sd_compat_ioctl, | 970 | .__compat_ioctl = sd_compat_ioctl, |
971 | #endif | 971 | #endif |
972 | .media_changed = sd_media_changed, | 972 | .media_changed = sd_media_changed, |
973 | .revalidate_disk = sd_revalidate_disk, | 973 | .revalidate_disk = sd_revalidate_disk, |
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 2fb8d4d2d6f6..9446cbf4de84 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -540,9 +540,9 @@ static int sr_block_media_changed(struct gendisk *disk) | |||
540 | static struct block_device_operations sr_bdops = | 540 | static struct block_device_operations sr_bdops = |
541 | { | 541 | { |
542 | .owner = THIS_MODULE, | 542 | .owner = THIS_MODULE, |
543 | .open = sr_block_open, | 543 | .__open = sr_block_open, |
544 | .release = sr_block_release, | 544 | .__release = sr_block_release, |
545 | .ioctl = sr_block_ioctl, | 545 | .__ioctl = sr_block_ioctl, |
546 | .media_changed = sr_block_media_changed, | 546 | .media_changed = sr_block_media_changed, |
547 | /* | 547 | /* |
548 | * No compat_ioctl for now because sr_block_ioctl never | 548 | * No compat_ioctl for now because sr_block_ioctl never |
diff --git a/fs/block_dev.c b/fs/block_dev.c index b9022694e9f7..73b6ce47c861 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1033,8 +1033,13 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
1033 | bdev->bd_contains = bdev; | 1033 | bdev->bd_contains = bdev; |
1034 | if (!partno) { | 1034 | if (!partno) { |
1035 | struct backing_dev_info *bdi; | 1035 | struct backing_dev_info *bdi; |
1036 | if (disk->fops->__open) { | ||
1037 | ret = disk->fops->__open(bdev->bd_inode, file); | ||
1038 | if (ret) | ||
1039 | goto out_first; | ||
1040 | } | ||
1036 | if (disk->fops->open) { | 1041 | if (disk->fops->open) { |
1037 | ret = disk->fops->open(bdev->bd_inode, file); | 1042 | ret = disk->fops->open(bdev, file->f_mode); |
1038 | if (ret) | 1043 | if (ret) |
1039 | goto out_clear; | 1044 | goto out_clear; |
1040 | } | 1045 | } |
@@ -1074,8 +1079,13 @@ static int do_open(struct block_device *bdev, struct file *file, int for_part) | |||
1074 | part = NULL; | 1079 | part = NULL; |
1075 | disk = NULL; | 1080 | disk = NULL; |
1076 | if (bdev->bd_contains == bdev) { | 1081 | if (bdev->bd_contains == bdev) { |
1082 | if (bdev->bd_disk->fops->__open) { | ||
1083 | ret = bdev->bd_disk->fops->__open(bdev->bd_inode, file); | ||
1084 | if (ret) | ||
1085 | goto out; | ||
1086 | } | ||
1077 | if (bdev->bd_disk->fops->open) { | 1087 | if (bdev->bd_disk->fops->open) { |
1078 | ret = bdev->bd_disk->fops->open(bdev->bd_inode, file); | 1088 | ret = bdev->bd_disk->fops->open(bdev, file->f_mode); |
1079 | if (ret) | 1089 | if (ret) |
1080 | goto out_unlock_bdev; | 1090 | goto out_unlock_bdev; |
1081 | } | 1091 | } |
@@ -1184,8 +1194,10 @@ static int __blkdev_put(struct block_device *bdev, int for_part) | |||
1184 | kill_bdev(bdev); | 1194 | kill_bdev(bdev); |
1185 | } | 1195 | } |
1186 | if (bdev->bd_contains == bdev) { | 1196 | if (bdev->bd_contains == bdev) { |
1197 | if (disk->fops->__release) | ||
1198 | ret = disk->fops->__release(bd_inode, NULL); | ||
1187 | if (disk->fops->release) | 1199 | if (disk->fops->release) |
1188 | ret = disk->fops->release(bd_inode, NULL); | 1200 | ret = disk->fops->release(disk, 0); |
1189 | } | 1201 | } |
1190 | if (!bdev->bd_openers) { | 1202 | if (!bdev->bd_openers) { |
1191 | struct module *owner = disk->fops->owner; | 1203 | struct module *owner = disk->fops->owner; |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 2bad616b9949..b573186ff1a1 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -1061,11 +1061,16 @@ struct file; | |||
1061 | struct inode; | 1061 | struct inode; |
1062 | 1062 | ||
1063 | struct block_device_operations { | 1063 | struct block_device_operations { |
1064 | int (*open) (struct inode *, struct file *); | 1064 | int (*__open) (struct inode *, struct file *); |
1065 | int (*release) (struct inode *, struct file *); | 1065 | int (*__release) (struct inode *, struct file *); |
1066 | int (*ioctl) (struct inode *, struct file *, unsigned, unsigned long); | 1066 | int (*__ioctl) (struct inode *, struct file *, unsigned, unsigned long); |
1067 | long (*unlocked_ioctl) (struct file *, unsigned, unsigned long); | 1067 | long (*__unlocked_ioctl) (struct file *, unsigned, unsigned long); |
1068 | long (*compat_ioctl) (struct file *, unsigned, unsigned long); | 1068 | long (*__compat_ioctl) (struct file *, unsigned, unsigned long); |
1069 | int (*open) (struct block_device *, fmode_t); | ||
1070 | int (*release) (struct gendisk *, fmode_t); | ||
1071 | int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1072 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1073 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1069 | int (*direct_access) (struct block_device *, sector_t, | 1074 | int (*direct_access) (struct block_device *, sector_t, |
1070 | void **, unsigned long *); | 1075 | void **, unsigned long *); |
1071 | int (*media_changed) (struct gendisk *); | 1076 | int (*media_changed) (struct gendisk *); |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 58bbf689fef7..b5894604ba5e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -79,6 +79,7 @@ extern int dir_notify_enable; | |||
79 | #define FMODE_NDELAY ((__force fmode_t)32) | 79 | #define FMODE_NDELAY ((__force fmode_t)32) |
80 | #define FMODE_EXCL ((__force fmode_t)64) | 80 | #define FMODE_EXCL ((__force fmode_t)64) |
81 | #define FMODE_WRITE_IOCTL ((__force fmode_t)128) | 81 | #define FMODE_WRITE_IOCTL ((__force fmode_t)128) |
82 | #define FMODE_NDELAY_NOW ((__force fmode_t)256) | ||
82 | 83 | ||
83 | #define RW_MASK 1 | 84 | #define RW_MASK 1 |
84 | #define RWA_MASK 2 | 85 | #define RWA_MASK 2 |