]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
block: allow IOC_PR_READ_* ioctls with BLK_OPEN_READ
authorStefan Hajnoczi <stefanha@redhat.com>
Tue, 10 Feb 2026 16:36:17 +0000 (11:36 -0500)
committerJens Axboe <axboe@kernel.dk>
Wed, 11 Feb 2026 17:36:54 +0000 (10:36 -0700)
commit5b88af7113feba2f0ae3402bb57cb5c94eea7dc3
treef9efb98024d560a427e26d9713cdebf2d2a57292
parent2ebc8d600fb907fa6b1e7095c0b6d84fc47e91ea
block: allow IOC_PR_READ_* ioctls with BLK_OPEN_READ

The recently added IOC_PR_READ_* ioctls require the same BLK_OPEN_WRITE
permission as the older persistent reservation ioctls. This has the
drawback that udev triggers when the file descriptor is closed,
resulting in unnecessary activity like scanning partitions even though
these read-only ioctls do not modify the device.

Change IOC_PR_READ_KEYS and IOC_PR_READ_RESERVATION to require
BLK_OPEN_READ. This prevents unnecessary activity every time `blkpr
--read-keys` or `blkpr --read-reservation` is invoked by shell scripts,
for example.

It is safe to reduce the permission requirement from BLK_OPEN_WRITE to
BLK_OPEN_READ since these two ioctls do not modify the persistent
reservation state. Userspace cannot use the information fetched by these
ioctls to make changes to the device unless it later opens the device
with BLK_OPEN_WRITE.

Fixes: 3e2cb9ee76c2 ("block: add IOC_PR_READ_RESERVATION ioctl")
Fixes: 22a1ffea5f80 ("block: add IOC_PR_READ_KEYS ioctl")
Cc: Christoph Hellwig <hch@lst.de>
Cc: Martin Wilck <mwilck@suse.com>
Cc: Benjamin Marzinski <bmarzins@redhat.com>
Suggested-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/ioctl.c