Skip to contentSkip to conversation

s390: dasd open counter.

PATCH In review Heiko Carstens 2 participants 3 messages Jan 18, 2006 – Jan 19, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 6/7 s390: dasd open counter.

From: Horst Hummel <[email protected]>

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.

---

 drivers/s390/block/dasd_ioctl.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)
drivers/s390/block/dasd_ioctl.c +8 -1
diff -urpN linux-2.6/drivers/s390/block/dasd_ioctl.c linux-2.6-patched/drivers/s390/block/dasd_ioctl.c
@@ -421,8 +421,15 @@ dasd_ioctl_information(struct block_devi
 	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
#1 lore raw
Quoted 22 lines · Heiko Carstens

From: Horst Hummel <[email protected]>

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.

---

 drivers/s390/block/dasd_ioctl.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletion(-)

diff -urpN linux-2.6/drivers/s390/block/dasd_ioctl.c linux-2.6-patched/drivers/s390/block/dasd_ioctl.c

drivers/s390/block/dasd_ioctl.c +0 -0
@@ -421,8 +421,15 @@ dasd_ioctl_information(struct block_devi
 	dasd_info->cu_model = cdev->id.cu_model;
 	dasd_info->dev_type = cdev->id.dev_type;
 	dasd_info->dev_model = cdev->id.dev_model;

drivers/s390/block/dasd_ioctl.c dasd_ioctl_information(struct block_devi · line 432

Quoted 10 lines
drivers/s390/block/dasd_ioctl.c +8 -1
-	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++;

I'll change the above to atomic_inc().

#2 lore raw
Quoted 6 lines · Andrew Morton

drivers/s390/block/dasd_ioctl.c dasd_ioctl_information(struct block_devi · line 432

Quoted 4 lines
drivers/s390/block/dasd_ioctl.c +3 -0
+	dasd_info->open_count = atomic_read(&device->open_count);
+	if (!device->bdev)
+		dasd_info->open_count++;

I'll change the above to atomic_inc().

oops, misread it, sorry.