From: Horst Hummel Date: Wed, 1 Feb 2006 11:06:36 +0000 (-0800) Subject: [PATCH] s390: dasd open counter X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=57467195d1581e354998d5cc35dfd7a12d6e0a24;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] s390: dasd open counter 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 Signed-off-by: Martin Schwidefsky Signed-off-by: Heiko Carstens Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 74ed5f4dd5e0..fafeeae52675 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c @@ -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