btrfs-progs: convert: Open the fs readonly for rollback
PATCH 1/1 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.
--- convert/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
convert/main.c +7 -1
@@ -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 ;
Signature · 1 line
2.14.3
Quoted 30 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Qu Wenruo
Sent: Thursday, October 26, 2017 3:29 PM
To: [email protected]
Cc: [email protected]
Subject: [PATCH] btrfs-progs: convert: Open the fs readonly for rollbackFor 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 <[email protected]>Signed-off-by Qu Wenruo <[email protected]>--- convert/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)convert/main.c +0
-1@@ -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 );
convert/main.c static int do_rollback(const char *devname) · line 1541
Quoted 10 lines
convert/main.c +7
-0+ +/* +* 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 ;
Quoted 7 lines
--
2.14.3--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
�翳簕.n�+壏煯壄�+%娝�遍荻w�簕.n�+壏{饼籯~镶炟^n噐■�侂h櫒璀�&{鄗夸z罐楘+€�+zf"穐殘啳嗃i��飦�戧鐉_璁鎗:+v墾�)撸鴐
David Sterba
AppliedQuoted 8 lines · Jinxiang
Quoted 8 lines
Cc: [email protected]
Subject: [PATCH] btrfs-progs: convert: Open the fs readonly for rollbackFor 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.
Quoted 7 lines
Quoted 4 lines
So open the fs RO for rollback, to avoid v2 space cache problem.
Reported-by Gu Jinxiang <[email protected]>Signed-off-by Qu Wenruo <[email protected]>Reviewed-by Gu JinXiang <[email protected]>Tested-by Gu JinXiang <[email protected]>
Applied, thanks.