loop: use LOOP_CONFIGURE instead of LOOP_SET_FD
LOOP_CONFIGURE allows to atomically configure the decive when opening it. This avoid the possibility of a race condition where between set_fd and set_status some operations are already accepted by the loopback device. See https://lwn.net/Articles/820408/ This feature was included in the linux kernel 5.8 however it is safe to not include any kind of fallback to the previous method as @obudai points out that: LOOP_CONFIGURE was backported into RHEL 8 kernel in RHEL 8.4 as a part of https://bugzilla.redhat.com/show_bug.cgi?id=1881760 (block layer: update to upstream v5.8). Since RHEL 8.4 is currently the oldest supported release that we support running osbuild on, it might be just fine implementing this without the fallback. From a centos stream 8 container: kernel-4.18.0-448.el8.x86_64 - loop: Fix missing discard support when using LOOP_CONFIGURE (Ming Lei) [1997338] - [block] loop: Set correct device size when using LOOP_CONFIGURE (Ming Lei) [1881760] - [block] loop: unset GENHD_FL_NO_PART_SCAN on LOOP_CONFIGURE (Ming Lei) [1881760] - [block] loop: Add LOOP_CONFIGURE ioctl (Ming Lei) [1881760]
This commit is contained in:
parent
04eab998b7
commit
da11ef4eb0
3 changed files with 108 additions and 52 deletions
|
|
@ -67,7 +67,7 @@ def test_loopback_basic(tmpdir):
|
|||
with pytest.raises(OSError):
|
||||
with open(testfile, "wb") as f:
|
||||
f.truncate(1)
|
||||
lo.set_fd(f.fileno())
|
||||
lo.configure(f.fileno())
|
||||
|
||||
lo.close()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue