From e3ed3b302c5165ed29a569073b82f92e8d09efdc Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Thu, 6 Feb 2025 10:02:53 -0500 Subject: [PATCH] qa: do read checks with non-empty file Linux will optimize out reads to a file known to be empty. Fixes: https://tracker.ceph.com/issues/53859 Signed-off-by: Patrick Donnelly --- qa/tasks/cephfs/test_pool_perm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/qa/tasks/cephfs/test_pool_perm.py b/qa/tasks/cephfs/test_pool_perm.py index b55052b826e8..d923d5ee3b69 100644 --- a/qa/tasks/cephfs/test_pool_perm.py +++ b/qa/tasks/cephfs/test_pool_perm.py @@ -6,7 +6,7 @@ import os class TestPoolPerm(CephFSTestCase): def test_pool_perm(self): - self.mount_a.run_shell(["touch", "test_file"]) + self.mount_a.run_shell_payload("dd if=/dev/urandom of=test_file bs=4k count=1") file_path = os.path.join(self.mount_a.mountpoint, "test_file") @@ -14,12 +14,12 @@ class TestPoolPerm(CephFSTestCase): import os import errno - fd = os.open("{path}", os.O_RDWR) + fd = os.open("{path}", os.O_RDWR | os.O_SYNC) try: if {check_read}: ret = os.read(fd, 1024) else: - os.write(fd, b'content') + os.pwrite(fd, b'content', 0) except OSError as e: if e.errno != errno.EPERM: raise -- 2.47.3