[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT PATCH v3 8/8] lib/uk9p: Clunk fids on fid release



On fid release, the 9p server is sent a clunk message to disassociate
the fid from its previous association, such that it has a clean slate
on both the server and the client when it will eventually be reused.

Signed-off-by: Cristian Banu <cristb@xxxxxxxxx>
---
 lib/uk9p/9pdev.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/lib/uk9p/9pdev.c b/lib/uk9p/9pdev.c
index 4735253e2a1e..14ea7cad358a 100644
--- a/lib/uk9p/9pdev.c
+++ b/lib/uk9p/9pdev.c
@@ -42,6 +42,7 @@
 #include <uk/bitmap.h>
 #include <uk/refcount.h>
 #include <uk/wait.h>
+#include <uk/9p.h>
 #include <uk/9pdev.h>
 #include <uk/9pdev_trans.h>
 #include <uk/9preq.h>
@@ -418,9 +419,23 @@ void uk_9pdev_fid_release(struct uk_9pfid *fid)
 {
        struct uk_9pdev *dev = fid->_dev;
        unsigned long flags;
+       bool move_to_freelist = false;
+       int rc;
+
+       /* First clunk the fid. */
+       rc = uk_9p_clunk(fid->_dev, fid);
+       if (rc < 0) {
+               uk_pr_warn("Could not clunk fid %d: %d\n", fid->fid, rc);
+               goto out;
+       }
+
+       /* If successfully clunked, move it to a freelist. */
+       move_to_freelist = true;
 
+out:
+       /* Then remove it from any internal data structures. */
        ukplat_spin_lock_irqsave(&dev->_fid_mgmt.spinlock, flags);
-       _fid_mgmt_del_fid_locked(&dev->_fid_mgmt, fid, 1);
+       _fid_mgmt_del_fid_locked(&dev->_fid_mgmt, fid, move_to_freelist);
        ukplat_spin_unlock_irqrestore(&dev->_fid_mgmt.spinlock, flags);
 }
 
-- 
2.11.0


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.