From: Petr Rockai <mornfall@fedoraproject.org>
To: lvm-devel@redhat.com
Subject: dev-mornfall-lvmcache - CLEAN-UP: Better string checking to avoid substring matches
Date: Wed, 5 Jun 2013 12:00:58 +0000 (UTC) [thread overview]
Message-ID: <20130605120058.2CE346140D@fedorahosted.org> (raw)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c363c74a251a5745e8ac6e274d1f7a1e32fa1843
Commit: c363c74a251a5745e8ac6e274d1f7a1e32fa1843
Parent: 58734d2538854ef79e6605ba69c57723737d12c2
Author: Jonathan Brassow <jbrassow@redhat.com>
AuthorDate: Fri Apr 12 11:30:04 2013 -0500
Committer: Jonathan Brassow <jbrassow@redhat.com>
CommitterDate: Fri Apr 12 11:30:04 2013 -0500
CLEAN-UP: Better string checking to avoid substring matches
Commit 9fd7ac7d035f0b2f8dcc3cb19935eb181816bd76 introduced a way a
method of avoiding reading from mirrors with a device failure. If
a device was found to be dead, the mapping table was checked for
'handle_errors' or 'block_on_error'. These strings were checked for
in the table string via 'strstr', which could also match on strings
like, 'no_handle_errors' or 'no_block_on_error'. No such strings
exist, but we don't want to have problems in the future if they do.
So, we check for ' <string>{'\0'|' '}'.
---
lib/activate/dev_manager.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 8c06476..00c0126 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -239,7 +239,7 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
dev_t log_dev;
char *images_health, *log_health;
uint64_t s,l;
- char *params, *target_type = NULL;
+ char *p, *params, *target_type = NULL;
void *next = NULL;
struct dm_task *dmt = NULL;
int r = 0;
@@ -306,8 +306,10 @@ static int _ignore_blocked_mirror_devices(struct device *dev,
if (strcmp(target_type, "mirror"))
goto_out;
- if (strstr(params, "block_on_error") ||
- strstr(params, "handle_errors")) {
+ if (((p = strstr(params, " block_on_error")) &&
+ (p[15] == '\0' || p[15] == ' ')) ||
+ ((p = strstr(params, " handle_errors")) &&
+ (p[14] == '\0' || p[14] == ' '))) {
log_debug_activation("%s: I/O blocked to mirror device",
dev_name(dev));
goto out;
reply other threads:[~2013-06-05 12:00 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=20130605120058.2CE346140D@fedorahosted.org \
--to=mornfall@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.