diff mbox series

[6/6] tests/9p: also check 'Tgetattr' in 'use-after-unlink' test

Message ID 7017658155c517b9665b75333a97c79aa2d4f3df.1732465720.git.qemu_oss@crudebyte.com (mailing list archive)
State New
Headers show
Series 9pfs: fix fstat() after unlink() (with a Linux guest) | expand

Commit Message

Christian Schoenebeck Nov. 24, 2024, 4:05 p.m. UTC
This verifies expected behaviour of previous bug fix patch.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
---
 tests/qtest/virtio-9p-test.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Greg Kurz Nov. 26, 2024, 5:02 p.m. UTC | #1
On Sun, 24 Nov 2024 17:05:32 +0100
Christian Schoenebeck <qemu_oss@crudebyte.com> wrote:

> This verifies expected behaviour of previous bug fix patch.
> 
> Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
> ---

Reviewed-by: Greg Kurz <groug@kaod.org>

>  tests/qtest/virtio-9p-test.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c
> index f6d7400a87..ab3a12c816 100644
> --- a/tests/qtest/virtio-9p-test.c
> +++ b/tests/qtest/virtio-9p-test.c
> @@ -702,6 +702,7 @@ static void fs_use_after_unlink(void *obj, void *data,
>      g_autofree char *real_file = virtio_9p_test_path("09/doa_file");
>      g_autofree char *buf = g_malloc0(write_count);
>      struct stat st_file;
> +    struct v9fs_attr attr;
>      uint32_t fid_file;
>      uint32_t count;
>  
> @@ -725,6 +726,10 @@ static void fs_use_after_unlink(void *obj, void *data,
>      tunlinkat({ .client = v9p, .atPath = "09", .name = "doa_file" });
>  
>      /* file is removed, but we still have it open, so this should succeed */
> +    tgetattr({
> +        .client = v9p, .fid = fid_file, .request_mask = P9_GETATTR_BASIC,
> +        .rgetattr.attr = &attr
> +    });
>      count = twrite({
>          .client = v9p, .fid = fid_file, .offset = 0, .count = write_count,
>          .data = buf
diff mbox series

Patch

diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c
index f6d7400a87..ab3a12c816 100644
--- a/tests/qtest/virtio-9p-test.c
+++ b/tests/qtest/virtio-9p-test.c
@@ -702,6 +702,7 @@  static void fs_use_after_unlink(void *obj, void *data,
     g_autofree char *real_file = virtio_9p_test_path("09/doa_file");
     g_autofree char *buf = g_malloc0(write_count);
     struct stat st_file;
+    struct v9fs_attr attr;
     uint32_t fid_file;
     uint32_t count;
 
@@ -725,6 +726,10 @@  static void fs_use_after_unlink(void *obj, void *data,
     tunlinkat({ .client = v9p, .atPath = "09", .name = "doa_file" });
 
     /* file is removed, but we still have it open, so this should succeed */
+    tgetattr({
+        .client = v9p, .fid = fid_file, .request_mask = P9_GETATTR_BASIC,
+        .rgetattr.attr = &attr
+    });
     count = twrite({
         .client = v9p, .fid = fid_file, .offset = 0, .count = write_count,
         .data = buf