All of lore.kernel.org
 help / color / mirror / Atom feed
From: snitzer@sourceware.org <snitzer@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2 ./WHATS_NEW lib/format_text/format-text.c
Date: 30 Jul 2009 17:19:33 -0000	[thread overview]
Message-ID: <20090730171933.19164.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer at sourceware.org	2009-07-30 17:19:31

Modified files:
	.              : WHATS_NEW 
	lib/format_text: format-text.c 

Log message:
	Fix _mda_setup() to not check first mda's size before pe_align rounding.
	
	Without this fix rounding the end of the first mda to a pe_align
	boundary could silently exceed the disk_size.
	
	Final 'if (start1 + mda_size1 > disk_size)' block serves as a safety
	net.
	
	Signed-off-by: Mike Snitzer <snitzer@redhat.com>

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1213&r2=1.1214
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/format_text/format-text.c.diff?cvsroot=lvm2&r1=1.107&r2=1.108

--- LVM2/WHATS_NEW	2009/07/30 17:18:03	1.1213
+++ LVM2/WHATS_NEW	2009/07/30 17:19:31	1.1214
@@ -1,5 +1,6 @@
 Version 2.02.51 - 
 ================================
+  Fix _mda_setup() to not check first mda's size before pe_align rounding.
   Formalize pe_start policy as split between .pv_setup and .pv_write.
   Document -I option of clvmd in the man page.
   Fix configure script to handle multiple clvmd selections.
--- LVM2/lib/format_text/format-text.c	2009/07/30 17:18:08	1.107
+++ LVM2/lib/format_text/format-text.c	2009/07/30 17:19:31	1.108
@@ -1214,6 +1214,15 @@
 			start1 += (pagesize - mda_adjustment);
 	}
 
+	/* Round up to pe_align boundary */
+	mda_adjustment = (mda_size1 + start1) % alignment;
+	if (mda_adjustment) {
+		mda_size1 += (alignment - mda_adjustment);
+		/* Revert if it's now too large */
+		if (start1 + mda_size1 > disk_size)
+			mda_size1 -= (alignment - mda_adjustment);
+	}
+
 	/* Ensure it's not going to be bigger than the disk! */
 	if (start1 + mda_size1 > disk_size) {
 		log_warn("WARNING: metadata area fills disk leaving no "
@@ -1221,15 +1230,19 @@
 		/* Leave some free space for rounding */
 		/* Avoid empty data area as could cause tools problems */
 		mda_size1 = disk_size - start1 - alignment * 2;
+		if (start1 + mda_size1 > disk_size) {
+			log_error("Insufficient space for first mda on %s",
+				  pv_dev_name(pv));
+			return 0;
+		}
+		/* Round up to pe_align boundary */
+		mda_adjustment = (mda_size1 + start1) % alignment;
+		if (mda_adjustment)
+			mda_size1 += (alignment - mda_adjustment);
 		/* Only have 1 mda in this case */
 		pvmetadatacopies = 1;
 	}
 
-	/* Round up to pe_align() boundary */
-	mda_adjustment = (mda_size1 + start1) % alignment;
-	if (mda_adjustment)
-		mda_size1 += (alignment - mda_adjustment);
-
 	/* If we already have PEs, avoid overlap */
 	if (pe_start || pe_end) {
 		if (pe_start <= start1)



             reply	other threads:[~2009-07-30 17:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-30 17:19 snitzer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-02-13 11:09 LVM2 ./WHATS_NEW lib/format_text/format-text.c zkabelac
2011-08-29 13:37 prajnoha
2011-02-03  1:41 zkabelac
2010-10-26  9:13 zkabelac
2010-09-30 14:12 prajnoha
2010-06-01 12:08 prajnoha
2009-07-30 21:15 snitzer
2009-07-30 18:40 snitzer
2009-07-30 17:42 snitzer
2009-07-30 17:18 snitzer
2009-03-23 21:13 taka
2009-03-03 16:35 mbroz
2008-10-17  0:55 agk
2008-09-30 20:37 agk
2008-08-16  9:46 mbroz
2008-07-31 10:50 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=20090730171933.19164.qmail@sourceware.org \
    --to=snitzer@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /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: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.