Current inode coherence protocol validates all invalidated nodes when
one node validate itself. This behavior is incorrect so this patch
fixes it.

Signed-off-by: Hitoshi Mitake <[email protected]>
---
 sheep/vdi.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/sheep/vdi.c b/sheep/vdi.c
index 6d0a80f..2166b74 100644
--- a/sheep/vdi.c
+++ b/sheep/vdi.c
@@ -790,8 +790,18 @@ main_fn int inode_coherence_update(uint32_t vid, bool 
validate,
        assert(entry->lock_state == LOCK_STATE_SHARED);
 
        if (validate) {
-               for (int i = 0; i < entry->nr_participants; i++)
+               for (int i = 0; i < entry->nr_participants; i++) {
+                       if (node_id_cmp(&entry->participants[i], sender)
+                           && entry->participants_state[i] ==
+                           SHARED_LOCK_STATE_INVALIDATED)
+                               /*
+                                * don't validate other invalidated, they need
+                                * to validate by themselves
+                                */
+                               continue;
+
                        entry->participants_state[i] = SHARED_LOCK_STATE_SHARED;
+               }
        } else {
                for (int i = 0; i < entry->nr_participants; i++) {
                        if (node_id_cmp(&entry->participants[i], sender))
-- 
1.8.3.2

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to