[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1293557352-10592-3-git-send-email-tj@kernel.org>
Date: Tue, 28 Dec 2010 18:28:58 +0100
From: Tejun Heo <tj@...nel.org>
To: axboe@...nel.dk, linux-kernel@...r.kernel.org,
kay.sievers@...y.org, hch@...radead.org
Cc: Tejun Heo <tj@...nel.org>
Subject: [PATCH 02/16] block: don't check events on close unless it was blocked
The block event mechanism currently always checks events when the
device is being closed regardless of the open mode. The intention was
to allow detection of EJECT_REQUEST when a device is closed whether
disk event polling is enabled or not.
This is unnecessary as, for devices of interest, events are checked
from either userland or kernel and in the former case ->check_events()
is performed on open of each poll attempt anyway. Furthermore, this
unconditional event check on close makes the code susceptible to event
loop if the block driver doesn't clear reported events correctly - an
event triggers userland to open and close the device which in turn
causes another event, rinse and repeat.
Check events on close only if it was blocked by excl write open.
Signed-off-by: Tejun Heo <tj@...nel.org>
Cc: Jens Axboe <axboe@...nel.dk>
Cc: Kay Sievers <kay.sievers@...y.org>
---
fs/block_dev.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index c620628..58026da 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1379,13 +1379,11 @@ int blkdev_put(struct block_device *bdev, fmode_t mode)
disk_unblock_events(bdev->bd_disk);
disk_check_events(bdev->bd_disk);
bdev->bd_write_holder = false;
- } else
- disk_check_events(bdev->bd_disk);
+ }
}
mutex_unlock(&bdev->bd_mutex);
- } else
- disk_check_events(bdev->bd_disk);
+ }
return __blkdev_put(bdev, mode, 0);
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists