]> err.no Git - linux-2.6/commitdiff
[PATCH] s390: dasd open counter
authorHorst Hummel <horst.hummel@de.ibm.com>
Wed, 1 Feb 2006 11:06:36 +0000 (03:06 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 1 Feb 2006 16:53:24 +0000 (08:53 -0800)
The open_count is increased for every opener, that includes the blkdev_get in
dasd_scan_partitions.  This tampers the open_count in BIODASDINFO.  Hide the
internal open from user-space.

Signed-off-by: Horst Hummel <horst.hummel@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/s390/block/dasd_ioctl.c

index 74ed5f4dd5e0e9f0e2df8ca46b59bc24a184a8b4..fafeeae52675ea396a1c71c67f9395fc635b78af 100644 (file)
@@ -421,8 +421,15 @@ dasd_ioctl_information(struct block_device *bdev, int no, long args)
        dasd_info->cu_model = cdev->id.cu_model;
        dasd_info->dev_type = cdev->id.dev_type;
        dasd_info->dev_model = cdev->id.dev_model;
-       dasd_info->open_count = atomic_read(&device->open_count);
        dasd_info->status = device->state;
+       /*
+        * The open_count is increased for every opener, that includes
+        * the blkdev_get in dasd_scan_partitions.
+        * This must be hidden from user-space.
+        */
+       dasd_info->open_count = atomic_read(&device->open_count);
+       if (!device->bdev)
+               dasd_info->open_count++;
        
        /*
         * check if device is really formatted