[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/5] hw/9pfs: Reset server state during TVERSION
From: |
Aneesh Kumar K.V |
Subject: |
[Qemu-devel] [PATCH 3/5] hw/9pfs: Reset server state during TVERSION |
Date: |
Mon, 5 Dec 2011 14:34:39 +0530 |
From: Deepak C Shetty <address@hidden>
As per the 9p rfc, during TVERSION its necessary to clean all the active
fids, so that we start the session from a clean state. Its also needed in
scenarios where the guest is booting off 9p, and boot fails, and client
restarts, without any knowledge of the past, it will issue a TVERSION again
so this ensures that we always start from a clean state.
Signed-off-by: Deepak C Shetty <address@hidden>
Signed-off-by: Aneesh Kumar K.V <address@hidden>
---
hw/9pfs/virtio-9p.c | 26 ++++++++++++++++++++++++++
1 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/hw/9pfs/virtio-9p.c b/hw/9pfs/virtio-9p.c
index 32b98dd..dd43209 100644
--- a/hw/9pfs/virtio-9p.c
+++ b/hw/9pfs/virtio-9p.c
@@ -523,6 +523,30 @@ static int v9fs_mark_fids_unreclaim(V9fsPDU *pdu, V9fsPath
*path)
return 0;
}
+static void virtfs_reset(V9fsPDU *pdu)
+{
+ V9fsState *s = pdu->s;
+ V9fsFidState *fidp = NULL;
+
+ /* Free all fids */
+ while (s->fid_list) {
+ fidp = s->fid_list;
+ s->fid_list = fidp->next;
+
+ if (fidp->ref) {
+ fidp->clunked = 1;
+ } else {
+ free_fid(pdu, fidp);
+ }
+ }
+ if (fidp) {
+ /* One or more unclunked fids found... */
+ error_report("9pfs:%s: One or more uncluncked fids "
+ "found during reset", __func__);
+ }
+ return;
+}
+
#define P9_QID_TYPE_DIR 0x80
#define P9_QID_TYPE_SYMLINK 0x02
@@ -1196,6 +1220,8 @@ static void v9fs_version(void *opaque)
pdu_unmarshal(pdu, offset, "ds", &s->msize, &version);
trace_v9fs_version(pdu->tag, pdu->id, s->msize, version.data);
+ virtfs_reset(pdu);
+
if (!strcmp(version.data, "9P2000.u")) {
s->proto_version = V9FS_PROTO_2000U;
} else if (!strcmp(version.data, "9P2000.L")) {
--
1.7.5.4
- [Qemu-devel] [PULL] VirtFS update, Aneesh Kumar K.V, 2011/12/05
- [Qemu-devel] [PULL] VirtFS update, Aneesh Kumar K.V, 2011/12/17
- [Qemu-devel] [PULL] VirtFS update, Aneesh Kumar K.V, 2011/12/21
- [Qemu-devel] [PATCH 3/4] hw/9pfs: iattr_valid flags are kernel internal flags map them to 9p values., Aneesh Kumar K.V, 2011/12/21
- [Qemu-devel] [PATCH 1/4] hw/9pfs: replace iovec manipulation with QEMUIOVector, Aneesh Kumar K.V, 2011/12/21
- [Qemu-devel] [PATCH 4/4] scripts/analyse-9p-simpletrace.py: Add symbolic names for 9p operations., Aneesh Kumar K.V, 2011/12/21
- [Qemu-devel] [PATCH 2/4] hw/9pfs: Use the correct signed type for different variables, Aneesh Kumar K.V, 2011/12/21
- Re: [Qemu-devel] [PULL] VirtFS update, Anthony Liguori, 2011/12/27