[1/5] btrfs-progs: mkfs: treat btrfs_add_to_fsid as fatal error
diff mbox series

Message ID 20190814010402.22546-1-jeffm@suse.com
State New
Headers show
Series
  • [1/5] btrfs-progs: mkfs: treat btrfs_add_to_fsid as fatal error
Related show

Commit Message

Jeff Mahoney Aug. 14, 2019, 1:03 a.m. UTC
When btrfs_add_to_fsid fails in mkfs we try to close the ctree.  That
complains that we already have a transaction open.  We should be taking
the error path and exit cleanly without writing.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 mkfs/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Qu Wenruo Aug. 14, 2019, 1:48 a.m. UTC | #1
On 2019/8/14 上午9:03, Jeff Mahoney wrote:
> When btrfs_add_to_fsid fails in mkfs we try to close the ctree.  That
> complains that we already have a transaction open.  We should be taking
> the error path and exit cleanly without writing.
> 
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

Thanks,
Qu

> ---
>  mkfs/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mkfs/main.c b/mkfs/main.c
> index 971cb395..b752da13 100644
> --- a/mkfs/main.c
> +++ b/mkfs/main.c
> @@ -1268,7 +1268,7 @@ int BOX_MAIN(mkfs)(int argc, char **argv)
>  					sectorsize, sectorsize, sectorsize);
>  		if (ret) {
>  			error("unable to add %s to filesystem: %d", file, ret);
> -			goto out;
> +			goto error;
>  		}
>  		if (verbose >= 2) {
>  			struct btrfs_device *device;
>
David Sterba Aug. 27, 2019, 3:27 p.m. UTC | #2
On Tue, Aug 13, 2019 at 09:03:58PM -0400, Jeff Mahoney wrote:
> When btrfs_add_to_fsid fails in mkfs we try to close the ctree.  That
> complains that we already have a transaction open.  We should be taking
> the error path and exit cleanly without writing.
> 
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>

I've merged 1-3, splitting some of the patches. Patch 4 is broken for
some of the resize format and can't be trivially fixed. I'll add a test
so we have better coverage for further development.
David Sterba Aug. 27, 2019, 3:30 p.m. UTC | #3
On Tue, Aug 27, 2019 at 05:27:36PM +0200, David Sterba wrote:
> On Tue, Aug 13, 2019 at 09:03:58PM -0400, Jeff Mahoney wrote:
> > When btrfs_add_to_fsid fails in mkfs we try to close the ctree.  That
> > complains that we already have a transaction open.  We should be taking
> > the error path and exit cleanly without writing.
> > 
> > Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> 
> I've merged 1-3, splitting some of the patches. Patch 4 is broken for
> some of the resize format and can't be trivially fixed. I'll add a test
> so we have better coverage for further development.

Actually we do have a test for the formats, it's cli/003-fi-resize-args
(though lacks 'max', that I'll add).

Patch
diff mbox series

diff --git a/mkfs/main.c b/mkfs/main.c
index 971cb395..b752da13 100644
--- a/mkfs/main.c
+++ b/mkfs/main.c
@@ -1268,7 +1268,7 @@  int BOX_MAIN(mkfs)(int argc, char **argv)
 					sectorsize, sectorsize, sectorsize);
 		if (ret) {
 			error("unable to add %s to filesystem: %d", file, ret);
-			goto out;
+			goto error;
 		}
 		if (verbose >= 2) {
 			struct btrfs_device *device;