提交 7918f0f6 编写于 作者: C Christoph Hellwig 提交者: Jens Axboe

block: opencode devcgroup_inode_permission

Just call devcgroup_check_permission to avoid various superflous checks
and a double conversion of the access flags.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Acked-by: NTejun Heo <tj@kernel.org>
Reviewed-by: NJan Kara <jack@suse.cz>
Reviewed-by: NHannes Reinecke <hare@suse.de>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 63d9932c
......@@ -1520,15 +1520,13 @@ static int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)
struct block_device *claiming;
bool unblock_events = true;
struct gendisk *disk;
int perm = 0;
int partno;
int ret;
if (mode & FMODE_READ)
perm |= MAY_READ;
if (mode & FMODE_WRITE)
perm |= MAY_WRITE;
ret = devcgroup_inode_permission(bdev->bd_inode, perm);
ret = devcgroup_check_permission(DEVCG_DEV_BLOCK,
imajor(bdev->bd_inode), iminor(bdev->bd_inode),
((mode & FMODE_READ) ? DEVCG_ACC_READ : 0) |
((mode & FMODE_WRITE) ? DEVCG_ACC_WRITE : 0));
if (ret)
goto bdput;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册