All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: Fix a bug which makes unfinished fsid change unrecoverable.
@ 2015-05-15  6:36 Qu Wenruo
  2015-05-21  2:24 ` Qu Wenruo
  2015-05-26 15:26 ` David Sterba
  0 siblings, 2 replies; 4+ messages in thread
From: Qu Wenruo @ 2015-05-15  6:36 UTC (permalink / raw)
  To: linux-btrfs; +Cc: dsterba

This bug is found by making break point after change_fsid_prepare() and
then kill the unfinished change, then try to restore the unfinished fsid
change.

If fsid change is canceled, open_ctree will still fail even with
IGNORE_FSID_MIMATCH open ctree flag, since it can't find device with
mismatched fsid, making it unable to restoring.

Now add ignore_fsid_mismatch judgment in btrfs_find_device() to fix the
bug and allow later restore to work as expected.

Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
 volumes.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/volumes.c b/volumes.c
index 14ce33e..f7462c5 100644
--- a/volumes.c
+++ b/volumes.c
@@ -1510,7 +1510,8 @@ struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid,
 	cur_devices = root->fs_info->fs_devices;
 	while (cur_devices) {
 		if (!fsid ||
-		    !memcmp(cur_devices->fsid, fsid, BTRFS_UUID_SIZE)) {
+		    (!memcmp(cur_devices->fsid, fsid, BTRFS_UUID_SIZE) ||
+		     root->fs_info->ignore_fsid_mismatch)) {
 			device = __find_device(&cur_devices->devices,
 					       devid, uuid);
 			if (device)
-- 
2.4.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: Fix a bug which makes unfinished fsid change unrecoverable.
  2015-05-15  6:36 [PATCH] btrfs-progs: Fix a bug which makes unfinished fsid change unrecoverable Qu Wenruo
@ 2015-05-21  2:24 ` Qu Wenruo
  2015-05-21  8:52   ` David Sterba
  2015-05-26 15:26 ` David Sterba
  1 sibling, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2015-05-21  2:24 UTC (permalink / raw)
  To: linux-btrfs, dsterba

Hi David,

I didn't see this patch merged into 4.0.1.

As without this patch, canceled fsid change process can't be recovered.

I totally understand that it's not good to merge a patch into the
already fully tested tree.
So would you please consider add this patch to next release(even 4.1 is OK)?

Thanks,
Qu

-------- Original Message  --------
Subject: [PATCH] btrfs-progs: Fix a bug which makes unfinished fsid 
change unrecoverable.
From: Qu Wenruo <quwenruo@cn.fujitsu.com>
To: <linux-btrfs@vger.kernel.org>
Date: 2015年05月15日 14:36

> This bug is found by making break point after change_fsid_prepare() and
> then kill the unfinished change, then try to restore the unfinished fsid
> change.
>
> If fsid change is canceled, open_ctree will still fail even with
> IGNORE_FSID_MIMATCH open ctree flag, since it can't find device with
> mismatched fsid, making it unable to restoring.
>
> Now add ignore_fsid_mismatch judgment in btrfs_find_device() to fix the
> bug and allow later restore to work as expected.
>
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
> ---
>   volumes.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/volumes.c b/volumes.c
> index 14ce33e..f7462c5 100644
> --- a/volumes.c
> +++ b/volumes.c
> @@ -1510,7 +1510,8 @@ struct btrfs_device *btrfs_find_device(struct btrfs_root *root, u64 devid,
>   	cur_devices = root->fs_info->fs_devices;
>   	while (cur_devices) {
>   		if (!fsid ||
> -		    !memcmp(cur_devices->fsid, fsid, BTRFS_UUID_SIZE)) {
> +		    (!memcmp(cur_devices->fsid, fsid, BTRFS_UUID_SIZE) ||
> +		     root->fs_info->ignore_fsid_mismatch)) {
>   			device = __find_device(&cur_devices->devices,
>   					       devid, uuid);
>   			if (device)
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: Fix a bug which makes unfinished fsid change unrecoverable.
  2015-05-21  2:24 ` Qu Wenruo
@ 2015-05-21  8:52   ` David Sterba
  0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-05-21  8:52 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs

On Thu, May 21, 2015 at 10:24:21AM +0800, Qu Wenruo wrote:
> I didn't see this patch merged into 4.0.1.
> 
> As without this patch, canceled fsid change process can't be recovered.

There are only some of the fsid patches merged, the preparatory work.
When the series looks ok up to some patch I think it's better to merge
it so you don't have to resend it again.

The commandline interface is not present yet so it's not even possible
to start the fsid change.

> I totally understand that it's not good to merge a patch into the
> already fully tested tree.
> So would you please consider add this patch to next release(even 4.1 is OK)?

Yes, that's the plan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] btrfs-progs: Fix a bug which makes unfinished fsid change unrecoverable.
  2015-05-15  6:36 [PATCH] btrfs-progs: Fix a bug which makes unfinished fsid change unrecoverable Qu Wenruo
  2015-05-21  2:24 ` Qu Wenruo
@ 2015-05-26 15:26 ` David Sterba
  1 sibling, 0 replies; 4+ messages in thread
From: David Sterba @ 2015-05-26 15:26 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: linux-btrfs, dsterba

On Fri, May 15, 2015 at 02:36:35PM +0800, Qu Wenruo wrote:
> This bug is found by making break point after change_fsid_prepare() and
> then kill the unfinished change, then try to restore the unfinished fsid
> change.
> 
> If fsid change is canceled, open_ctree will still fail even with
> IGNORE_FSID_MIMATCH open ctree flag, since it can't find device with
> mismatched fsid, making it unable to restoring.
> 
> Now add ignore_fsid_mismatch judgment in btrfs_find_device() to fix the
> bug and allow later restore to work as expected.
> 
> Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-26 15:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-15  6:36 [PATCH] btrfs-progs: Fix a bug which makes unfinished fsid change unrecoverable Qu Wenruo
2015-05-21  2:24 ` Qu Wenruo
2015-05-21  8:52   ` David Sterba
2015-05-26 15:26 ` David Sterba

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.