diff options
author | Kevin Wolf <kwolf@redhat.com> | 2020-07-17 12:54:25 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2020-07-17 14:20:57 +0200 |
commit | bca5283bd4a086bcbfaddc024491a400cc9b2fa9 (patch) | |
tree | 38fd2929ac16434c9c3e9cfa835f2d4e7ea6cb8a /block/blklogwrites.c | |
parent | 20eaf1bf6ef1df916cb7ea2d06d1e868f238835f (diff) |
file-posix: Fix check_hdev_writable() with auto-read-only
For Linux block devices, being able to open the device read-write
doesn't necessarily mean that the device is actually writable (one
example is a read-only LV, as you get with lvchange -pr <device>). We
have check_hdev_writable() to check this condition and fail opening the
image read-write if it's not actually writable.
However, this check doesn't take auto-read-only into account, but
results in a hard failure instead of downgrading to read-only where
possible.
Fix this and do the writable check not based on BDRV_O_RDWR, but only
when this actually results in opening the file read-write. A second
check is inserted in raw_reconfigure_getfd() to have the same check when
dynamic auto-read-only upgrades an image file from read-only to
read-write.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20200717105426.51134-3-kwolf@redhat.com>
Reviewed-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block/blklogwrites.c')
0 files changed, 0 insertions, 0 deletions