block: Add BDRV_O_NO_SHARE for blk_new_open()
commit35b7f4abd5afe159f91ddeb4f2a40c20d2f48367
authorKevin Wolf <kwolf@redhat.com>
Thu, 22 Apr 2021 16:43:43 +0000 (22 18:43 +0200)
committerKevin Wolf <kwolf@redhat.com>
Fri, 30 Apr 2021 10:27:48 +0000 (30 12:27 +0200)
tree1a594852fc368c3b7f6d1bfc70353274248011de
parentc20555e15fdb84172254dbbde393f07ee0f44af3
block: Add BDRV_O_NO_SHARE for blk_new_open()

Normally, blk_new_open() just shares all permissions. This was fine
originally when permissions only protected against uses in the same
process because no other part of the code would actually get to access
the block nodes opened with blk_new_open(). However, since we use it for
file locking now, unsharing permissions becomes desirable.

Add a new BDRV_O_NO_SHARE flag that is used in blk_new_open() to unshare
any permissions that can be unshared.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20210422164344.283389-2-kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block/block-backend.c
include/block/block.h