linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH 2/3] btrfs-progs: convert: update error message to reflect original fs unmodified cases
Date: Wed, 29 Jul 2020 16:40:37 +0800	[thread overview]
Message-ID: <20200729084038.78151-3-wqu@suse.com> (raw)
In-Reply-To: <20200729084038.78151-1-wqu@suse.com>

The original fs is not touched until we migrate the super blocks.

Under most error cases, we fail before that thus the original fs is
still safe.

So change the error message according the stages we failed to reflect
that.

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 convert/main.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/convert/main.c b/convert/main.c
index df6a2ae32722..451e4f158689 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -1123,6 +1123,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
 	struct task_ctx ctx;
 	char features_buf[64];
 	struct btrfs_mkfs_config mkfs_cfg;
+	bool btrfs_sb_commited = false;
 
 	init_convert_context(&cctx);
 	ret = convert_open_fs(devname, &cctx);
@@ -1270,6 +1271,7 @@ static int do_convert(const char *devname, u32 convert_flags, u32 nodesize,
 		error("unable to migrate super block: %d", ret);
 		goto fail;
 	}
+	btrfs_sb_commited = true;
 
 	root = open_ctree_fd(fd, devname, 0,
 			     OPEN_CTREE_WRITES | OPEN_CTREE_TEMPORARY_SUPER);
@@ -1287,8 +1289,12 @@ fail:
 	clean_convert_context(&cctx);
 	if (fd != -1)
 		close(fd);
-	warning(
+	if (btrfs_sb_commited)
+		warning(
 "an error occurred during conversion, filesystem is partially created but not finalized and not mountable");
+	else
+		warning(
+"an error occurred during conversion, the original filesystem is not modified");
 	return -1;
 }
 
-- 
2.27.0


  parent reply	other threads:[~2020-07-29  8:40 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-29  8:40 [PATCH 0/3] btrfs-progs: convert: better ENOSPC handling Qu Wenruo
2020-07-29  8:40 ` [PATCH 1/3] btrfs-progs: convert: handle errors better in ext2_copy_inodes() Qu Wenruo
2020-07-29  8:40 ` Qu Wenruo [this message]
2020-07-29  8:40 ` [PATCH 3/3] btrfs-progs: convert: report available space before convertion happens Qu Wenruo
2020-07-29  9:05   ` Su Yue
2020-07-29  9:13     ` Qu Wenruo
2020-07-31 15:35       ` David Sterba
2020-07-31 16:16 ` [PATCH 0/3] btrfs-progs: convert: better ENOSPC handling David Sterba
2020-07-31 23:37   ` Qu Wenruo

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=20200729084038.78151-3-wqu@suse.com \
    --to=wqu@suse.com \
    --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).