On Wed, 12 Mar 2025 15:11:41 +0100 Christian Schoenebeck <qemu_...@crudebyte.com> wrote:
> On Tuesday, March 11, 2025 6:28:09 PM CET Greg Kurz wrote: > > Enhance the `use-after-unlink` test with a new check for the > > case where the client wants to alter the size of an unlinked > > file for which it still has an active fid. > > > > Suggested-by: Christian Schoenebeck <qemu_...@crudebyte.com> > > Signed-off-by: Greg Kurz <gr...@kaod.org> > > --- > > tests/qtest/virtio-9p-test.c | 8 ++++++++ > > 1 file changed, 8 insertions(+) > > > > diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c > > index f515a9bb157b..20c0d744fa56 100644 > > --- a/tests/qtest/virtio-9p-test.c > > +++ b/tests/qtest/virtio-9p-test.c > > @@ -736,6 +736,14 @@ static void fs_use_after_unlink(void *obj, void *data, > > .data = buf > > }).count; > > g_assert_cmpint(count, ==, write_count); > > + > > + /* truncate file to (arbitrarily chosen) size 2001 */ > > + tsetattr({ > > + .client = v9p, .fid = fid_file, .attr = (v9fs_attr) { > > + .valid = P9_SETATTR_SIZE, > > + .size = 2001 > > + } > > + }); > > } > > > > static void cleanup_9p_local_driver(void *data) > > > > Ah, I just meant the code snippet as a starting point, like I would have also > checked with a stat() call whether 9p server really did what it promised. > > But OK, better some test coverage than nothing. :) > FWIW the server returns ENOENT if it doesn't have the fix which causes the check to fail. I was assuming this would be enough but I'm fine with adding an extra check if you want. > /Christian > > -- Greg