diff mbox series

[PULL,6/7] tests/9p: extend use_dir_after_unlink test with Treaddir

Message ID 6eadd8767ab9422942c3c5e8d70c923e5ee3aa3f.1738860115.git.qemu_oss@crudebyte.com (mailing list archive)
State New
Headers show
Series [PULL,1/7] 9pfs: improve v9fs_walk() tracing | expand

Commit Message

Christian Schoenebeck Feb. 6, 2025, 4:41 p.m. UTC
Sending a Treaddir request on an unlinked directory should also succeed
if the directory was alread opened before unlink. We just check that no
error occurs and that we get some kind of Treaddir result, but completely
ignore the actual Treaddir result content. In fact, there should be no
system as of to date that would allow a removed directory to have any
content (files, links, devices, subdirectories) and POSIX specifies that
a directory must be empty when trying to remove it from the file system.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Message-Id: <f1b91e3a33a6502be816d88dfb6b719101b69d41.1736427878.git.qemu_oss@crudebyte.com>
---
 tests/qtest/virtio-9p-test.c | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c
index 35c42cd0d7..10243247ab 100644
--- a/tests/qtest/virtio-9p-test.c
+++ b/tests/qtest/virtio-9p-test.c
@@ -772,6 +772,9 @@  static void fs_use_dir_after_unlink(void *obj, void *data,
         .client = v9p, .fid = fid_dir, .request_mask = P9_GETATTR_BASIC,
         .rgetattr.attr = &attr
     });
+    treaddir({
+        .client = v9p, .fid = fid_dir, .offset = 0, .count = P9_MAX_SIZE - 11
+    });
 }
 
 static void cleanup_9p_local_driver(void *data)