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 daemons/cmirrord/functions.c Date: Wed, 04 Aug 2010 18:18:00 -0000 [thread overview] Message-ID: <20100804181818.18735.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: jbrassow@sourceware.org 2010-08-04 18:18:18 Modified files: . : WHATS_NEW daemons/cmirrord: functions.c Log message: A misunderstanding of the return value of 'dm_bit' has been causing a data corruption bug in cmirror. 'dm_bit' is only ever used as a boolean operation within LVM, but it can return a range of values. If the bit is set, a power of 2 is returned. If the bit is unset, 0 is returned. 'log_test_bit' (a function in the cluster mirror log daemon code) has switched to using the dm bit operations in rhel6. There are two places in the daemon code where 'log_test_bit' is not used merely as a boolean, but rather the return value is used as the return value for the log functions 'is_clean' and 'in_sync' - having assumed that 'dm_bit' was returning 0 or 1 only. One place the 'in_sync' function is utilized is in 'dm_rh_get_state' - a function that informs the mirroring code how to treat I/O and which devices to read/write from. 'dm_rh_get_state' was checking if the return value of 'in_sync' was 1 to determine if the region was DM_RH_CLEAN. Since 'dm_bit' (and by extension 'log_test_bit' and 'in_sync') was returning powers of 2, DM_RH_CLEAN was rarely being reported as it should have been. Thinking the region was out-of-sync, the mirroring code would write only to the primary device. When the primary device was failed, all of those writes were lost - leaving the entire mirror corrupted. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1695&r2=1.1696 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/cmirrord/functions.c.diff?cvsroot=lvm2&r1=1.21&r2=1.22 --- LVM2/WHATS_NEW 2010/08/03 20:22:31 1.1695 +++ LVM2/WHATS_NEW 2010/08/04 18:18:18 1.1696 @@ -1,5 +1,6 @@ Version 2.02.73 - ================================ + Fix data corruption bug in cluster mirrors. Require logical volume(s) to be explicitly named for lvconvert --merge. Avoid changing aligned pe_start as a side-effect of very verbose logging. Fix 'void*' arithmetic warnings in dbg_malloc.c. --- LVM2/daemons/cmirrord/functions.c 2010/07/09 15:34:41 1.21 +++ LVM2/daemons/cmirrord/functions.c 2010/08/04 18:18:18 1.22 @@ -106,7 +106,7 @@ static int log_test_bit(dm_bitset_t bs, int bit) { - return dm_bit(bs, bit); + return dm_bit(bs, bit) ? 1 : 0; } static void log_set_bit(struct log_c *lc, dm_bitset_t bs, int bit)
next reply other threads:[~2010-08-04 18:18 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-08-04 18:18 jbrassow [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-02-08 11:34 zkabelac 2011-09-06 18:24 zkabelac 2010-12-20 13:57 zkabelac 2010-08-30 18:37 jbrassow 2010-08-17 23:56 jbrassow 2010-06-18 20:58 jbrassow 2010-01-15 18:48 jbrassow
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=20100804181818.18735.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).