public inbox for lvm2-cvs@sourceware.org help / color / mirror / Atom feed
From: jbrassow@sourceware.org To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org Subject: LVM2 ./WHATS_NEW lib/metadata/mirror.c Date: Fri, 09 Jul 2010 15:08:00 -0000 [thread overview] Message-ID: <20100709150816.3655.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2010-07-09 15:08:15 Modified files: . : WHATS_NEW lib/metadata : mirror.c Log message: Finish fix for bug 607347: failing both redundant mirror log legs... A previous check-in added logic to handle the case where both images of a mirrored log failed. It solved the problem by simply removing the log entirely - leaving the parent mirror with a 'core' log. This worked for most cases. However, if there was a small delay between the failures of the two mirrored log devices, the mirror would hang, LVM would hang, and no additional LVM commands could be issued. When the first leg of the log fails, it signals the need for repair. Before 'lvconvert --repair' is run by dmeventd, the second leg fails. 'lvconvert' would see both devices as failed and try to remove the log entirely. When it came time to suspend the parent mirror to update the configuration, the suspend would hang because it couldn't get any I/O through the mirrored log, which was plugged waiting for corrective action. The solution is to replace the log with an error target to clear any pending writes before removing it. This allows the parent mirror to suspend and make the proper changes. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1659&r2=1.1660 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/mirror.c.diff?cvsroot=lvm2&r1=1.122&r2=1.123 --- LVM2/WHATS_NEW 2010/07/08 12:24:04 1.1659 +++ LVM2/WHATS_NEW 2010/07/09 15:08:12 1.1660 @@ -1,5 +1,6 @@ Version 2.02.71 - =============================== + Fix possible hang when all mirror images of a mirrored log fail. Do not log backtrace in valid _lv_resume() code path. Cleanup help strings in configure.in. Prompt if metadataignore with vgextend or pvchange would adjust vg_mda_copies. --- LVM2/lib/metadata/mirror.c 2010/07/02 21:16:50 1.122 +++ LVM2/lib/metadata/mirror.c 2010/07/09 15:08:15 1.123 @@ -864,9 +864,72 @@ lv->status &= ~MIRROR_NOTSYNCED; if (!replace_lv_with_error_segment(lv)) return_0; - } else if (remove_log) + } else if (remove_log) { detached_log_lv = detach_mirror_log(mirrored_seg); + /* + * The log may be removed due to repair. If the log + * happens to be a mirrored log, then there is a special + * case we need to consider. One of the images of a + * mirrored log can fail followed shortly afterwards by + * a failure of the second. This means that the top-level + * mirror is waiting for writes to the log to finish, but + * they never will unless the mirrored log can be repaired + * or replaced with an error target. Since both the devices + * have failed, we must replace with error target - it is + * the only way to release the pending writes. + */ + if (lv_is_mirrored(detached_log_lv) && + (detached_log_lv->status & PARTIAL_LV)) { + struct lv_segment *seg = first_seg(detached_log_lv); + + log_very_verbose("%s being removed due to failures", + detached_log_lv->name); + + /* + * We are going to replace the mirror with an + * error segment, but before we do, we must remember + * all of the LVs that must be deleted later (i.e. + * the sub-lv's) + */ + for (m = 0; m < seg->area_count; m++) { + seg_lv(seg, m)->status &= ~MIRROR_IMAGE; + lv_set_visible(seg_lv(seg, m)); + if (!(lvl = dm_pool_alloc(lv->vg->cmd->mem, + sizeof(*lvl)))) + return 0; + lvl->lv = seg_lv(seg, m); + dm_list_add(&tmp_orphan_lvs, &lvl->list); + } + + if (!replace_lv_with_error_segment(detached_log_lv)) { + log_error("Failed error target substitution for %s", + detached_log_lv->name); + return_0; + } + + if (!vg_write(detached_log_lv->vg)) { + log_error("intermediate VG write fail."); + return 0; + } + + if (!suspend_lv(detached_log_lv->vg->cmd, + detached_log_lv)) { + log_error("Failed to suspend %s", + detached_log_lv->name); + vg_revert(detached_log_lv->vg); + return 0; + } + + if (!vg_commit(detached_log_lv->vg)) + return_0; + + if (!resume_lv(detached_log_lv->vg->cmd, + detached_log_lv)) + return 0; + } + } + /* * To successfully remove these unwanted LVs we need to * remove the LVs from the mirror set, commit that metadata
next reply other threads:[~2010-07-09 15:08 UTC|newest] Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-07-09 15:08 jbrassow [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-03-23 16:28 mbroz 2012-02-01 13:50 zkabelac 2011-10-25 13:17 jbrassow 2011-10-06 14:49 jbrassow 2011-09-14 2:45 jbrassow 2011-09-13 21:13 jbrassow 2011-09-13 14:37 jbrassow 2011-09-13 13:59 jbrassow 2011-09-01 19:22 jbrassow 2011-06-17 14:27 zkabelac 2010-08-16 18:02 jbrassow 2010-07-13 22:24 jbrassow 2010-07-13 21:48 jbrassow 2010-06-28 14:19 jbrassow 2010-06-21 16:12 jbrassow 2010-04-27 15:27 jbrassow 2010-04-27 14:57 jbrassow 2009-12-09 19:53 mbroz 2009-12-09 18:09 mbroz 2009-04-10 9:53 mbroz 2008-10-17 10:50 agk 2008-09-18 19:09 agk 2008-06-13 12:15 meyering 2008-02-22 13:28 agk 2007-11-22 13:57 agk 2006-11-30 17:52 agk 2006-11-10 19:35 agk 2006-07-20 20:37 agk
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=20100709150816.3655.qmail@sourceware.org \ --to=jbrassow@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).