提交 926487b7 编写于 作者: S Sripathi Kodi 提交者: Aneesh Kumar K.V

virtio-9p: Return correct error from v9fs_remove

Signed-off-by: NSripathi Kodi <sripathik@in.ibm.com>

In v9fs_remove_post_remove() we currently ignore the error returned by
the previous call to remove() and return an error only if freeing the
fid fails. However, the client expects to see the error from remove().
Currently the client falsely thinks that the remove call has always
succeeded. For example, doing rmdir on a non-empty directory does
not return ENOTEMPTY.

With this patch we ignore the error from free_fid(). The client cannot
use this error value anyway.
Signed-off-by: NSripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: NVenkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
上级 be940c87
...@@ -1877,14 +1877,15 @@ static void v9fs_flush(V9fsState *s, V9fsPDU *pdu) ...@@ -1877,14 +1877,15 @@ static void v9fs_flush(V9fsState *s, V9fsPDU *pdu)
static void v9fs_remove_post_remove(V9fsState *s, V9fsRemoveState *vs, static void v9fs_remove_post_remove(V9fsState *s, V9fsRemoveState *vs,
int err) int err)
{ {
/* For TREMOVE we need to clunk the fid even on failed remove */
err = free_fid(s, vs->fidp->fid);
if (err < 0) { if (err < 0) {
goto out; err = -errno;
} else {
err = vs->offset;
} }
err = vs->offset; /* For TREMOVE we need to clunk the fid even on failed remove */
out: free_fid(s, vs->fidp->fid);
complete_pdu(s, vs->pdu, err); complete_pdu(s, vs->pdu, err);
qemu_free(vs); qemu_free(vs);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册