]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[DLM] fix add_requestqueue checking nodes list
authorDavid Teigland <teigland@redhat.com>
Mon, 27 Nov 2006 17:31:22 +0000 (11:31 -0600)
committerSteven Whitehouse <swhiteho@redhat.com>
Thu, 30 Nov 2006 15:37:00 +0000 (10:37 -0500)
Requests that arrive after recovery has started are saved in the
requestqueue and processed after recovery is done.  Some of these requests
are purged during recovery if they are from nodes that have been removed.
We move the purging of the requests (dlm_purge_requestqueue) to later in
the recovery sequence which allows the routine saving requests
(dlm_add_requestqueue) to avoid filtering out requests by nodeid since the
same will be done by the purge.  The current code has add_requestqueue
filtering by nodeid but doesn't hold any locks when accessing the list of
current nodes.  This also means that we need to call the purge routine
when the lockspace is being shut down since the add routine will not be
rejecting requests itself any more.

Signed-off-by: David Teigland <teigland@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
fs/dlm/lockspace.c
fs/dlm/recoverd.c
fs/dlm/requestqueue.c

index f8842ca443c24dda7e24344ee38a5a61e560acf3..791388b25c353751f95df82c6db6e1de9d04df87 100644 (file)
@@ -22,6 +22,7 @@
 #include "memory.h"
 #include "lock.h"
 #include "recover.h"
+#include "requestqueue.h"
 
 #ifdef CONFIG_DLM_DEBUG
 int dlm_create_debug_file(struct dlm_ls *ls);
@@ -684,6 +685,7 @@ static int release_lockspace(struct dlm_ls *ls, int force)
         * Free structures on any other lists
         */
 
+       dlm_purge_requestqueue(ls);
        kfree(ls->ls_recover_args);
        dlm_clear_free_entries(ls);
        dlm_clear_members(ls);
index 8bb895ffd90ea27a073eac0a77733352d6fe326b..9dc2f9156f15bb7494d2a4d45731b953c62e2633 100644 (file)
@@ -93,14 +93,6 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)
                goto fail;
        }
 
-       /*
-        * Purge directory-related requests that are saved in requestqueue.
-        * All dir requests from before recovery are invalid now due to the dir
-        * rebuild and will be resent by the requesting nodes.
-        */
-
-       dlm_purge_requestqueue(ls);
-
        /*
         * Wait for all nodes to complete directory rebuild.
         */
@@ -181,6 +173,14 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)
 
        dlm_release_root_list(ls);
 
+       /*
+        * Purge directory-related requests that are saved in requestqueue.
+        * All dir requests from before recovery are invalid now due to the dir
+        * rebuild and will be resent by the requesting nodes.
+        */
+
+       dlm_purge_requestqueue(ls);
+
        dlm_set_recover_status(ls, DLM_RS_DONE);
        error = dlm_recover_done_wait(ls);
        if (error) {
index 0226d2a0a0faf8107fa5dcbc912c971545bd1048..65008d79c96d2e651091dbd7bcbe47f1e17221ec 100644 (file)
@@ -36,9 +36,6 @@ int dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_header *hd)
        int length = hd->h_length;
        int rv = 0;
 
-       if (dlm_is_removed(ls, nodeid))
-               return 0;
-
        e = kmalloc(sizeof(struct rq_entry) + length, GFP_KERNEL);
        if (!e) {
                log_print("dlm_add_requestqueue: out of memory\n");
@@ -133,6 +130,10 @@ static int purge_request(struct dlm_ls *ls, struct dlm_message *ms, int nodeid)
 {
        uint32_t type = ms->m_type;
 
+       /* the ls is being cleaned up and freed by release_lockspace */
+       if (!ls->ls_count)
+               return 1;
+
        if (dlm_is_removed(ls, nodeid))
                return 1;