From: David Teigland Date: Tue, 23 Feb 2016 21:44:14 +0000 (-0600) Subject: lvmlockd: fix sparse snapshot case X-Git-Tag: v2_02_144~50 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=e79325308454814d968dd3e06cd261a269716675;p=lvm2.git lvmlockd: fix sparse snapshot case A snapshot can be created without a real origin LV in this case, so there's no lock to use. --- diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c index e78e2cb46..c55f2b50d 100644 --- a/lib/locking/lvmlockd.c +++ b/lib/locking/lvmlockd.c @@ -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;