From: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Cc: <dsterba@suse.cz>, Fan Chengniang <fancn.fnst@cn.fujitsu.com>
Subject: [PATCH v2 2/2] btrfs-progs:btrfstune:fix multiple options error
Date: Mon, 19 Jan 2015 15:27:31 +0800 [thread overview]
Message-ID: <1421652451-994-2-git-send-email-fancn.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <1421652451-994-1-git-send-email-fancn.fnst@cn.fujitsu.com>
when we use multiple options, error return status will be override by the
last option status.
example: btrfstune -S 1 -r /dev/loop0
when -S option fails and -r option succeeds, return value is 0, rather than
1, where 1 is the right return status.
Reported-by: Chen Hanxiao <chenhanxiao@cn.fujitsu.com>
Signed-off-by: Fan Chengniang <fancn.fnst@cn.fujitsu.com>
---
btrfstune.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/btrfstune.c b/btrfstune.c
index 15f68c8..075fbc6 100644
--- a/btrfstune.c
+++ b/btrfstune.c
@@ -114,6 +114,7 @@ int main(int argc, char *argv[])
{
struct btrfs_root *root;
int success = 0;
+ int total = 0;
int extrefs_flag = 0;
int seeding_flag = 0;
u64 seeding_value = 0;
@@ -190,19 +191,22 @@ int main(int argc, char *argv[])
ret = update_seeding_flag(root, seeding_value);
if (!ret)
success++;
+ total++;
}
if (extrefs_flag) {
enable_extrefs_flag(root);
success++;
+ total++;
}
if (skinny_flag) {
enable_skinny_metadata(root);
success++;
+ total++;
}
- if (success > 0) {
+ if (success == total) {
ret = 0;
} else {
root->fs_info->readonly = 1;
--
1.9.1
prev parent reply other threads:[~2015-01-19 7:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-19 7:27 [PATCH v2 1/2] btrfs-progs:btrfstune:force to set seeding flags Fan Chengniang
2015-01-19 7:27 ` Fan Chengniang [this message]
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=1421652451-994-2-git-send-email-fancn.fnst@cn.fujitsu.com \
--to=fancn.fnst@cn.fujitsu.com \
--cc=dsterba@suse.cz \
--cc=linux-btrfs@vger.kernel.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: link
Be 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 NNTP newsgroup(s).