public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: mbroz@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/uuid/uuid.c lib/uuid/uuid ... Date: Thu, 28 Aug 2008 18:41:00 -0000 [thread overview] Message-ID: <20080828184151.15620.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: mbroz@sourceware.org 2008-08-28 18:41:51 Modified files: . : WHATS_NEW lib/uuid : uuid.c uuid.h tools : vgconvert.c Log message: Fix vgconvert logical volume id metadata validation. If volume group is downconverted to lvm1 format, check if lvid has supported format for conversion to lv_num in lvm1. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.948&r2=1.949 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/uuid/uuid.c.diff?cvsroot=lvm2&r1=1.25&r2=1.26 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/uuid/uuid.h.diff?cvsroot=lvm2&r1=1.15&r2=1.16 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/vgconvert.c.diff?cvsroot=lvm2&r1=1.28&r2=1.29 --- LVM2/WHATS_NEW 2008/08/28 10:40:44 1.948 +++ LVM2/WHATS_NEW 2008/08/28 18:41:50 1.949 @@ -1,5 +1,6 @@ Version 2.02.40 - ================================ + Fix vgconvert logical volume id metadata validation. Fix lvmdump metadata gather option (-m) to work correctly. Fix allocation bug in text metadata format write error path. Fix vgcfgbackup to properly check filename if template is used. --- LVM2/lib/uuid/uuid.c 2008/08/07 13:59:49 1.25 +++ LVM2/lib/uuid/uuid.c 2008/08/28 18:41:51 1.26 @@ -67,11 +67,29 @@ lv_num *= sizeof(_c) - 1; if ((c = strchr(_c, lvid->id[1].uuid[i]))) lv_num += (int) (c - _c); + if (lv_num < 0) + lv_num = 0; } return lv_num; } +int lvid_in_restricted_range(union lvid *lvid) +{ + int i; + + for (i = 0; i < ID_LEN - 3; i++) + if (lvid->id[1].uuid[i] != '0') + return 0; + + for (i = ID_LEN - 3; i < ID_LEN; i++) + if (!isdigit(lvid->id[1].uuid[i])) + return 0; + + return 1; +} + + int id_create(struct id *id) { int randomfile; --- LVM2/lib/uuid/uuid.h 2007/08/20 20:55:27 1.15 +++ LVM2/lib/uuid/uuid.h 2008/08/28 18:41:51 1.16 @@ -34,6 +34,7 @@ int lvid_from_lvnum(union lvid *lvid, struct id *vgid, uint32_t lv_num); int lvnum_from_lvid(union lvid *lvid); +int lvid_in_restricted_range(union lvid *lvid); void uuid_from_num(char *uuid, uint32_t num); --- LVM2/tools/vgconvert.c 2008/06/24 20:10:32 1.28 +++ LVM2/tools/vgconvert.c 2008/08/28 18:41:51 1.29 @@ -81,6 +81,17 @@ return ECMD_FAILED; } + /* If converting to restricted lvid, check if lvid is compatible */ + if (!(vg->fid->fmt->features & FMT_RESTRICTED_LVIDS) && + cmd->fmt->features & FMT_RESTRICTED_LVIDS) + list_iterate_items(lvl, &vg->lvs) + if (!lvid_in_restricted_range(&lvl->lv->lvid)) { + log_error("Logical volume %s lvid format is" + " incompatible with requested" + " metadata format.", lvl->lv->name); + return ECMD_FAILED; + } + /* Attempt to change any LVIDs that are too big */ if (cmd->fmt->features & FMT_RESTRICTED_LVIDS) { list_iterate_items(lvl, &vg->lvs) {
reply other threads:[~2008-08-28 18:41 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080828184151.15620.qmail@sourceware.org \ --to=mbroz@sourceware.org \ --cc=lvm-devel@redhat.com \ --cc=lvm2-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).