* [PATCH] btrfs-progs: convert: Open the fs readonly for rollback
@ 2017-10-26 7:28 Qu Wenruo
2017-10-26 8:35 ` Gu, Jinxiang
0 siblings, 1 reply; 3+ messages in thread
From: Qu Wenruo @ 2017-10-26 7:28 UTC (permalink / raw)
To: linux-btrfs; +Cc: dsterba
For rollback, we only needs to open the fs to check if it meets the
condition to rollback.
And this RW read makes us failed to rollback btrfs with v2 space cache.
In fact, we don't even start a transaction during rollback.
So open the fs RO for rollback, to avoid v2 space cache problem.
Reported-by: Gu Jinxiang <gujx@cn.fujitsu.com>
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 882daf7ced53..3ec10f233915 100644
--- a/convert/main.c
+++ b/convert/main.c
@@ -1529,7 +1529,13 @@ static int do_rollback(const char *devname)
goto free_mem;
}
fsize = lseek(fd, 0, SEEK_END);
- root = open_ctree_fd(fd, devname, 0, OPEN_CTREE_WRITES);
+
+ /*
+ * For rollback, we don't really need write anything into btrfs,
+ * so open it RO.
+ * The write part will happen after we close the btrfs.
+ */
+ root = open_ctree_fd(fd, devname, 0, 0);
if (!root) {
error("unable to open ctree");
ret = -EIO;
--
2.14.3
^ permalink raw reply related [flat|nested] 3+ messages in thread* RE: [PATCH] btrfs-progs: convert: Open the fs readonly for rollback
2017-10-26 7:28 [PATCH] btrfs-progs: convert: Open the fs readonly for rollback Qu Wenruo
@ 2017-10-26 8:35 ` Gu, Jinxiang
2017-10-26 17:16 ` David Sterba
0 siblings, 1 reply; 3+ messages in thread
From: Gu, Jinxiang @ 2017-10-26 8:35 UTC (permalink / raw)
To: Qu Wenruo, linux-btrfs@vger.kernel.org; +Cc: dsterba@suse.cz
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb2312", Size: 1857 bytes --]
> -----Original Message-----
> From: linux-btrfs-owner@vger.kernel.org [mailto:linux-btrfs-owner@vger.kernel.org] On Behalf Of Qu Wenruo
> Sent: Thursday, October 26, 2017 3:29 PM
> To: linux-btrfs@vger.kernel.org
> Cc: dsterba@suse.cz
> Subject: [PATCH] btrfs-progs: convert: Open the fs readonly for rollback
>
> For rollback, we only needs to open the fs to check if it meets the condition to rollback.
> And this RW read makes us failed to rollback btrfs with v2 space cache.
>
> In fact, we don't even start a transaction during rollback.
>
> So open the fs RO for rollback, to avoid v2 space cache problem.
>
> Reported-by: Gu Jinxiang <gujx@cn.fujitsu.com>
> 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 882daf7ced53..3ec10f233915 100644
> --- a/convert/main.c
> +++ b/convert/main.c
> @@ -1529,7 +1529,13 @@ static int do_rollback(const char *devname)
> goto free_mem;
> }
> fsize = lseek(fd, 0, SEEK_END);
> - root = open_ctree_fd(fd, devname, 0, OPEN_CTREE_WRITES);
> +
> + /*
> + * For rollback, we don't really need write anything into btrfs,
> + * so open it RO.
> + * The write part will happen after we close the btrfs.
> + */
> + root = open_ctree_fd(fd, devname, 0, 0);
> if (!root) {
> error("unable to open ctree");
> ret = -EIO;
Reviewed-by: Gu JinXiang <gujx@cn.fujitsu.com>
Tested-by: Gu JinXiang <gujx@cn.fujitsu.com>
> --
> 2.14.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±ý»k~ÏâØ^nr¡ö¦zË\x1aëh¨èÚ&£ûàz¿äz¹Þú+Ê+zf£¢·h§~Ûiÿÿïêÿêçz_è®\x0fæj:+v¨þ)ߣøm
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] btrfs-progs: convert: Open the fs readonly for rollback
2017-10-26 8:35 ` Gu, Jinxiang
@ 2017-10-26 17:16 ` David Sterba
0 siblings, 0 replies; 3+ messages in thread
From: David Sterba @ 2017-10-26 17:16 UTC (permalink / raw)
To: Gu, Jinxiang; +Cc: Qu Wenruo, linux-btrfs@vger.kernel.org, dsterba@suse.cz
On Thu, Oct 26, 2017 at 08:35:29AM +0000, Gu, Jinxiang wrote:
> > Cc: dsterba@suse.cz
> > Subject: [PATCH] btrfs-progs: convert: Open the fs readonly for rollback
> >
> > For rollback, we only needs to open the fs to check if it meets the condition to rollback.
> > And this RW read makes us failed to rollback btrfs with v2 space cache.
> >
> > In fact, we don't even start a transaction during rollback.
> >
> > So open the fs RO for rollback, to avoid v2 space cache problem.
> >
> > Reported-by: Gu Jinxiang <gujx@cn.fujitsu.com>
> > Signed-off-by: Qu Wenruo <wqu@suse.com>
> Reviewed-by: Gu JinXiang <gujx@cn.fujitsu.com>
> Tested-by: Gu JinXiang <gujx@cn.fujitsu.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-26 17:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26 7:28 [PATCH] btrfs-progs: convert: Open the fs readonly for rollback Qu Wenruo
2017-10-26 8:35 ` Gu, Jinxiang
2017-10-26 17:16 ` David Sterba
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).