public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: zkabelac@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/format1/format1.c lib/for ... Date: Mon, 13 Feb 2012 10:56:00 -0000 [thread overview] Message-ID: <20120213105632.8238.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-02-13 10:56:31 Modified files: . : WHATS_NEW lib/format1 : format1.c lib/format_pool: format_pool.c lib/format_text: format-text.c Log message: Clean error paths for format instance With updated orphan VG code this code needed some updates. Add missing log_error for allocation failures. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2282&r2=1.2283 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format1/format1.c.diff?cvsroot=lvm2&r1=1.144&r2=1.145 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_pool/format_pool.c.diff?cvsroot=lvm2&r1=1.48&r2=1.49 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.190&r2=1.191 --- LVM2/WHATS_NEW 2012/02/13 10:53:31 1.2282 +++ LVM2/WHATS_NEW 2012/02/13 10:56:31 1.2283 @@ -1,5 +1,6 @@ Version 2.02.92 - ==================================== + Clean error paths for format instance creation (2.02.91). Release vg in error path of _format1_vg_read() instead of just free(). Report allocation failure for allocation of PV structure. Add clvmd init dependency on dlm service when running with new corosync. --- LVM2/lib/format1/format1.c 2012/02/13 10:53:32 1.144 +++ LVM2/lib/format1/format1.c 2012/02/13 10:56:31 1.145 @@ -580,8 +580,10 @@ struct format_instance_ctx fic; struct format_instance *fid; - if (!fmt) - return_NULL; + if (!fmt) { + log_error("Failed to allocate format1 format type structure."); + return NULL; + } fmt->cmd = cmd; fmt->ops = &_format1_ops; @@ -607,15 +609,19 @@ if (!(fmt->orphan_vg = alloc_vg("text_orphan", cmd, fmt->orphan_vg_name))) { log_error("Couldn't create lvm1 orphan VG."); + dm_free(fmt); return NULL; } + fic.type = FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = fmt->orphan_vg_name; fic.context.vg_ref.vg_id = NULL; + if (!(fid = _format1_create_instance(fmt, &fic))) { - log_error("Couldn't create lvm1 orphan VG format instance."); - return NULL; + _format1_destroy(fmt); + return_NULL; } + vg_set_fid(fmt->orphan_vg, fid); log_very_verbose("Initialised format: %s", fmt->name); --- LVM2/lib/format_pool/format_pool.c 2012/02/12 23:01:19 1.48 +++ LVM2/lib/format_pool/format_pool.c 2012/02/13 10:56:31 1.49 @@ -320,15 +320,19 @@ if (!(fmt->orphan_vg = alloc_vg("text_orphan", cmd, fmt->orphan_vg_name))) { log_error("Couldn't create lvm1 orphan VG."); + dm_free(fmt); return NULL; } + fic.type = FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = fmt->orphan_vg_name; fic.context.vg_ref.vg_id = NULL; + if (!(fid = _pool_create_instance(fmt, &fic))) { - log_error("Couldn't create lvm1 orphan VG format instance."); + _pool_destroy(fmt); return NULL; } + vg_set_fid(fmt->orphan_vg, fid); log_very_verbose("Initialised format: %s", fmt->name); --- LVM2/lib/format_text/format-text.c 2012/02/12 23:01:19 1.190 +++ LVM2/lib/format_text/format-text.c 2012/02/13 10:56:31 1.191 @@ -2270,8 +2270,10 @@ const struct dm_config_value *cv; struct mda_lists *mda_lists; - if (!(fmt = dm_malloc(sizeof(*fmt)))) - return_NULL; + if (!(fmt = dm_malloc(sizeof(*fmt)))) { + log_error("Failed to allocate text format type structure."); + return NULL; + } fmt->cmd = cmd; fmt->ops = &_text_handler; @@ -2296,13 +2298,13 @@ if (!(fmt->labeller = text_labeller_create(fmt))) { log_error("Couldn't create text label handler."); - goto err; + goto bad; } if (!(label_register_handler(FMT_TEXT_NAME, fmt->labeller))) { log_error("Couldn't register text label handler."); fmt->labeller->ops->destroy(fmt->labeller); - goto err; + goto bad; } if ((cn = find_config_tree_node(cmd, "metadata/dirs"))) { @@ -2310,13 +2312,13 @@ if (cv->type != DM_CFG_STRING) { log_error("Invalid string in config file: " "metadata/dirs"); - goto err; + goto bad; } if (!_add_dir(cv->v.str, &mda_lists->dirs)) { log_error("Failed to add %s to text format " "metadata directory list ", cv->v.str); - goto err; + goto bad; } cmd->independent_metadata_areas = 1; } @@ -2325,31 +2327,26 @@ if ((cn = find_config_tree_node(cmd, "metadata/disk_areas"))) { for (cn = cn->child; cn; cn = cn->sib) { if (!_get_config_disk_area(cmd, cn, &mda_lists->raws)) - goto err; + goto_bad; cmd->independent_metadata_areas = 1; } } - if (!(fmt->orphan_vg = alloc_vg("text_orphan", cmd, fmt->orphan_vg_name))) { - dm_free(fmt); - return NULL; - } + if (!(fmt->orphan_vg = alloc_vg("text_orphan", cmd, fmt->orphan_vg_name))) + goto_bad; fic.type = FMT_INSTANCE_AUX_MDAS; fic.context.vg_ref.vg_name = fmt->orphan_vg_name; fic.context.vg_ref.vg_id = NULL; - if (!(fid = _text_create_text_instance(fmt, &fic))) { - log_error("Failed to create format instance"); - release_vg(fmt->orphan_vg); - goto err; - } + if (!(fid = _text_create_text_instance(fmt, &fic))) + goto_bad; + vg_set_fid(fmt->orphan_vg, fid); log_very_verbose("Initialised format: %s", fmt->name); return fmt; - - err: +bad: _text_destroy(fmt); return NULL;
next reply other threads:[~2012-02-13 10:56 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-02-13 10:56 zkabelac [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-02-27 11:23 zkabelac 2012-02-13 11:04 zkabelac 2012-02-08 10:49 zkabelac 2011-03-11 15:10 prajnoha 2011-03-11 14:50 prajnoha 2011-03-11 14:38 prajnoha 2011-03-11 14:30 prajnoha 2010-10-05 17:34 wysochanski 2009-07-30 17:45 snitzer 2009-04-10 9:59 mbroz 2009-02-25 23:29 mbroz
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=20120213105632.8238.qmail@sourceware.org \ --to=zkabelac@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).