]> sourceware.org Git - lvm2.git/commitdiff
lvmlockd: fix sparse snapshot case
authorDavid Teigland <teigland@redhat.com>
Tue, 23 Feb 2016 21:44:14 +0000 (15:44 -0600)
committerDavid Teigland <teigland@redhat.com>
Tue, 23 Feb 2016 21:45:25 +0000 (15:45 -0600)
A snapshot can be created without a real origin LV
in this case, so there's no lock to use.

lib/locking/lvmlockd.c

index e78e2cb46d77e533aebd860538d3d1ddeee58396..c55f2b50df0c44b5a6d666ac9c32437e26599d36 100644 (file)
@@ -2331,6 +2331,12 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
                 * represents itself and all associated cow snapshots.
                 */
 
+               if (!lp->origin_name) {
+                       /* Sparse LV case. We require a lock from the origin LV. */
+                       log_error("Cannot create snapshot without origin LV in shared VG.");
+                       return 0;
+               }
+
                if (!(origin_lv = find_lv(vg, lp->origin_name))) {
                        log_error("Failed to find origin LV %s/%s", vg->name, lp->origin_name);
                        return 0;
This page took 1.706585 seconds and 5 git commands to generate.