]> git.proxmox.com Git - mirror_qemu.git/commit
9pfs: fix 'Twalk' to only send error if no component walked
authorChristian Schoenebeck <qemu_oss@crudebyte.com>
Tue, 15 Mar 2022 10:08:39 +0000 (11:08 +0100)
committerChristian Schoenebeck <qemu_oss@crudebyte.com>
Thu, 16 Jun 2022 10:44:52 +0000 (12:44 +0200)
commita93d2e89e59e67ac5796679fdcef9467e6b2cc55
tree13ade21bbacf90e3cae00fe2187de243d2cc2e72
parentfd6c979e651a2163062b746e01adf6f267c8e874
9pfs: fix 'Twalk' to only send error if no component walked

Current implementation of 'Twalk' request handling always sends an 'Rerror'
response if any error occured. The 9p2000 protocol spec says though:

  "
  If the first element cannot be walked for any reason, Rerror is returned.
  Otherwise, the walk will return an Rwalk message containing nwqid qids
  corresponding, in order, to the files that are visited by the nwqid
  successful elementwise walks; nwqid is therefore either nwname or the index
  of the first elementwise walk that failed.
  "

  http://ericvh.github.io/9p-rfc/rfc9p2000.html#anchor33

For that reason we are no longer leaving from an error path in function
v9fs_walk(), unless really no path component could be walked successfully or
if the request has been interrupted.

Local variable 'nwalked' counts and reflects the number of path components
successfully processed by background I/O thread, whereas local variable
'name_idx' subsequently counts and reflects the number of path components
eventually accepted successfully by 9p server controller portion.

New local variable 'any_err' is an aggregate variable reflecting whether any
error occurred at all, while already existing variable 'err' only reflects
the last error.

Despite QIDs being delivered to client in a more relaxed way now, it is
important to note though that fid still must remain unaffected if any error
occurred.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <bc73e24258a75dc29458024c7936c8a036c3eac5.1647339025.git.qemu_oss@crudebyte.com>
hw/9pfs/9p.c