All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alasdair Kergon <agk@fedoraproject.org>
To: lvm-devel@redhat.com
Subject: master - thin: tighten discard string conversions
Date: Tue,  7 Aug 2012 20:30:27 +0000 (UTC)	[thread overview]
Message-ID: <20120807203027.688103283@fedorahosted.org> (raw)

Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7b5ea9a5a89b4eff41520142f719a7d89435f7df
Commit:        7b5ea9a5a89b4eff41520142f719a7d89435f7df
Parent:        adfa778a58719cb78971526b68a93cee56a18cc4
Author:        Alasdair G Kergon <agk@redhat.com>
AuthorDate:    Tue Aug 7 18:37:35 2012 +0100
Committer:     Alasdair G Kergon <agk@redhat.com>
CommitterDate: Tue Aug 7 18:37:35 2012 +0100

thin: tighten discard string conversions

Respond with "unknown" rather than a NULL pointer if there's an
internal error and the discard value is invalid.

Don't accept 'no_passdown' or 'no-passdown' variants in the LVM
metadata: this is written by the program so should only ever contain
"nopassdown" and should be validated strictly against that.
---
 lib/metadata/thin_manip.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 8d1744c..0395b48 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -433,10 +433,7 @@ int get_pool_discard(const char *str, thin_discard_t *discard)
 {
 	if (!strcasecmp(str, "passdown"))
 		*discard = THIN_DISCARD_PASSDOWN;
-        /* Allow some variation in thin parameter */
-	else if (!strcasecmp(str, "nopassdown") ||
-		 !strcasecmp(str, "no-passdown") ||
-		 !strcasecmp(str, "no_passdown"))
+	else if (!strcasecmp(str, "nopassdown"))
 		*discard = THIN_DISCARD_NO_PASSDOWN;
 	else if (!strcasecmp(str, "ignore"))
 		*discard = THIN_DISCARD_IGNORE;
@@ -459,7 +456,7 @@ const char *get_pool_discard_name(thin_discard_t discard)
 		return "ignore";
 	}
 
-	log_error(INTERNAL_ERROR "Uknown discard type.");
+	log_error(INTERNAL_ERROR "Uknown discard type encountered.");
 
-	return NULL;
+	return "unknown";
 }



                 reply	other threads:[~2012-08-07 20:30 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=20120807203027.688103283@fedorahosted.org \
    --to=agk@fedoraproject.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.