]> sourceware.org Git - lvm2.git/commitdiff
lvmlockd: automatically remove the dlm global lockspace
authorDavid Teigland <teigland@redhat.com>
Fri, 31 Jul 2015 21:45:43 +0000 (16:45 -0500)
committerDavid Teigland <teigland@redhat.com>
Mon, 3 Aug 2015 15:23:01 +0000 (10:23 -0500)
The dlm global lockspace is automatically added when the
first dlm VG lockspace is added.  Reverse this by removing
the dlm global lockspace after the last dlm VG lockspace
is removed.  (Remove old non-working code that did this
based on an old command that could explicitly add/remove
the dlm global lockspace.)

daemons/lvmlockd/lvmlockd-core.c
daemons/lvmlockd/lvmlockd-dlm.c
daemons/lvmlockd/lvmlockd-internal.h

index b299050505c3626e41c1bb1f12408a329ef8aa6b..2f470f5788d49d7b287a4eb2365ce74b36a29bc9 100644 (file)
@@ -2506,18 +2506,8 @@ static int add_dlm_global_lockspace(struct action *act)
 
        if (gl_running_dlm)
                return -EEXIST;
-
        gl_running_dlm = 1;
 
-       /* Keep track of whether we automatically added
-          the global ls, so we know to automatically
-          remove it. */
-
-       if (act)
-               gl_auto_dlm = 0;
-       else
-               gl_auto_dlm = 1;
-
        /*
         * There's a short period after which a previous gl lockspace thread
         * has set gl_running_dlm = 0, but before its ls struct has been
@@ -2526,11 +2516,9 @@ static int add_dlm_global_lockspace(struct action *act)
         */
 
        rv = add_lockspace_thread(gl_lsname_dlm, NULL, NULL, LD_LM_DLM, NULL, act);
-
        if (rv < 0) {
                log_error("add_dlm_global_lockspace add_lockspace_thread %d", rv);
                gl_running_dlm = 0;
-               gl_auto_dlm = 0;
        }
 
        return rv;
@@ -2583,28 +2571,12 @@ out:
 }
 
 /*
- * When the first dlm lockspace is added for a vg,
- * automatically add a separate dlm lockspace for the
- * global lock if it hasn't been done explicitly.
- * This is to make the dlm global lockspace work similarly to
- * the sanlock global lockspace, which is "automatic" by
- * nature of being one of the vg lockspaces.
+ * When the first dlm lockspace is added for a vg, automatically add a separate
+ * dlm lockspace for the global lock.
  *
- * For sanlock, a separate lockspace is not used for
- * the global lock, but the gl lock lives in a vg
- * lockspace, (although it's recommended to create a
+ * For sanlock, a separate lockspace is not used for the global lock, but the
+ * gl lock lives in a vg lockspace, (although it's recommended to create a
  * special vg dedicated to holding the gl).
- *
- * N.B. for dlm, if this is an add+WAIT action for a vg
- * lockspace, and this triggered the automatic addition
- * of the global lockspace, then the action may complete
- * for the vg ls add, while the gl ls add is still in
- * progress.  If the caller wants to ensure that the
- * gl ls add is complete, they should explicitly add+WAIT
- * the gl ls.
- *
- * If this function returns and error, the caller
- * will queue the act with that error for the client.
  */
 
 static int add_lockspace(struct action *act)
@@ -2614,6 +2586,11 @@ static int add_lockspace(struct action *act)
 
        memset(ls_name, 0, sizeof(ls_name));
 
+       /*
+        * FIXME: I don't think this is used any more.
+        * Remove it, or add the ability to start the global
+        * dlm lockspace using lvmlockctl?
+        */
        if (act->rt == LD_RT_GL) {
                if (gl_use_dlm) {
                        rv = add_dlm_global_lockspace(act);
@@ -2697,13 +2674,13 @@ static int rem_lockspace(struct action *act)
        pthread_mutex_unlock(&lockspaces_mutex);
 
        /*
-        * If the dlm global lockspace was automatically added when
-        * the first dlm vg lockspace was added, then reverse that
+        * The dlm global lockspace was automatically added when
+        * the first dlm vg lockspace was added, now reverse that
         * by automatically removing the dlm global lockspace when
         * the last dlm vg lockspace is removed.
         */
 
-       if (rt == LD_RT_VG && gl_use_dlm && gl_auto_dlm)
+       if (rt == LD_RT_VG && gl_use_dlm)
                rem_dlm_global_lockspace();
 
        return 0;
index eaa26570cd212c0e8fc3ec9d5e961ede6033bac7..f1b060a1156e1289f65f278684fc5c567908986e 100644 (file)
@@ -247,10 +247,8 @@ int lm_rem_lockspace_dlm(struct lockspace *ls, int free_vg)
        free(lmd);
        ls->lm_data = NULL;
 
-       if (!strcmp(ls->name, gl_lsname_dlm)) {
+       if (!strcmp(ls->name, gl_lsname_dlm))
                gl_running_dlm = 0;
-               gl_auto_dlm = 0;
-       }
 
        return 0;
 }
index 1ecb5dcf135f1f9435a375f2e480da588c0bb356..78ae88decf048a7fa23c4506c6520b3466a16887 100644 (file)
@@ -307,6 +307,7 @@ static inline int list_empty(const struct list_head *head)
  * or when disable_gl matches.
  */
 
+EXTERN int gl_running_dlm;
 EXTERN int gl_type_static;
 EXTERN int gl_use_dlm;
 EXTERN int gl_use_sanlock;
@@ -315,9 +316,6 @@ EXTERN pthread_mutex_t gl_type_mutex;
 EXTERN char gl_lsname_dlm[MAX_NAME+1];
 EXTERN char gl_lsname_sanlock[MAX_NAME+1];
 
-EXTERN int gl_running_dlm;
-EXTERN int gl_auto_dlm;
-
 EXTERN int daemon_test; /* run as much as possible without a live lock manager */
 EXTERN int daemon_debug;
 EXTERN int daemon_host_id;
This page took 0.049598 seconds and 5 git commands to generate.