If the client is using 9p2000.u, the following occurs: $ cd ${virtfs_shared_dir} $ mkdir -p a/b/c $ ls a/b ls: cannot access 'a/b/a': No such file or directory ls: cannot access 'a/b/b': No such file or directory a b c
instead of the expected: $ ls a/b c This is a regression introduced by commit f57f5878578a; local_name_to_path() now resolves ".." and "." in paths, and v9fs_do_readdir_with_stat()->stat_to_v9stat() then copies the basename of the resulting path to the response. With the example above, this means that "." and ".." are turned into "b" and "a" respectively... Actually, the name we need to pass is the d_name field of the dirent. Signed-off-by: Greg Kurz <gr...@kaod.org> --- Hi Jan, I found this will testing your patches. I'd appreciate if you could review this. Then I'll push all these patches to 9p-next and send a pull request. Thanks, -- Greg hw/9pfs/9p.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 0a37c8bd1361..0474e9e787c0 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -1748,6 +1748,9 @@ static int coroutine_fn v9fs_do_readdir_with_stat(V9fsPDU *pdu, if (err < 0) { break; } + v9fs_path_free(&path); + + v9fs_path_sprintf(&path, "%s", dent->d_name); err = stat_to_v9stat(pdu, &path, &stbuf, &v9stat); if (err < 0) { break;