]> sourceware.org Git - lvm2.git/commitdiff
Validate orphan and VG_GLOBAL lock order too.
authorAlasdair Kergon <agk@redhat.com>
Wed, 19 May 2010 02:08:50 +0000 (02:08 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 19 May 2010 02:08:50 +0000 (02:08 +0000)
WHATS_NEW
lib/cache/lvmcache.c
lib/locking/locking.c
lib/metadata/metadata-exported.h
lib/metadata/metadata.c

index ae23b31a114a554e36ad400c0f4f59a48f02e8c7..56cc42a1041a5dd012cd25a892385e24bef83194 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
 Version 2.02.66 - 
 ===============================
+  Validate orphan and VG_GLOBAL lock order too.
   Accept orphan VG names as parameters to lock_vol() and related functions.
   Use is_orphan_vg in place of hard-coded prefix tests.
 
index 34c54ad6ee67d20cf88b7d6ed6483946b1a9e8f8..1f1e1e6aacf21556d5ac4864d995f1b02f9dbee3 100644 (file)
@@ -224,11 +224,21 @@ void lvmcache_drop_metadata(const char *vgname, int drop_precommitted)
 
 /*
  * Ensure vgname2 comes after vgname1 alphabetically.
- * Orphans don't count.
+ * Orphan locks come last.
+ * VG_GLOBAL comes first.
  */
 static int _vgname_order_correct(const char *vgname1, const char *vgname2)
 {
-       if (is_orphan_vg(vgname1) || is_orphan_vg(vgname2))
+       if (is_global_vg(vgname1))
+               return 1;
+
+       if (is_global_vg(vgname2))
+               return 0;
+
+       if (is_orphan_vg(vgname1))
+               return 0;
+
+       if (is_orphan_vg(vgname2))
                return 1;
 
        if (strcmp(vgname1, vgname2) < 0)
index 032d97dab6ad4dab94bf780d49d0232bfbdc691f..cbafa4540741c5c4fa9cce655b2bdf992cd22f85 100644 (file)
@@ -424,7 +424,7 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags)
                if (is_orphan_vg(vol))
                        vol = VG_ORPHANS;
                /* VG locks alphabetical, ORPHAN lock last */
-               else if (((flags & LCK_TYPE_MASK) != LCK_UNLOCK) &&
+               if (((flags & LCK_TYPE_MASK) != LCK_UNLOCK) &&
                         !(flags & LCK_CACHE) &&
                         !lvmcache_verify_lock_order(vol))
                        return 0;
index fe3266a88dcd571d75225070b7d9459b609b9909..ae23b9bfc4c02f5a0efb3694096f25914ac2ca60 100644 (file)
@@ -423,6 +423,7 @@ int move_pv(struct volume_group *vg_from, struct volume_group *vg_to,
 int move_pvs_used_by_lv(struct volume_group *vg_from,
                        struct volume_group *vg_to,
                        const char *lv_name);
+int is_global_vg(const char *vg_name);
 int is_orphan_vg(const char *vg_name);
 int is_orphan(const struct physical_volume *pv);
 int is_missing_pv(const struct physical_volume *pv);
index 0bd7455fc7fe752378dae21d72c33cff69028f50..63b921e474ebe40cd00e6c196ca153807a2dd8bb 100644 (file)
@@ -3326,6 +3326,11 @@ int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv)
        return 1;
 }
 
+int is_global_vg(const char *vg_name)
+{
+       return (vg_name && !strcmp(vg_name, VG_GLOBAL)) ? 1 : 0;
+}
+
 /**
  * is_orphan_vg - Determine whether a vg_name is an orphan
  * @vg_name: pointer to the vg_name
This page took 0.042438 seconds and 5 git commands to generate.