]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
metadump: Postpone invocation of init_metadump()
authorChandan Babu R <chandan.babu@oracle.com>
Mon, 6 Nov 2023 13:10:39 +0000 (18:40 +0530)
committerCarlos Maiolino <cem@kernel.org>
Tue, 21 Nov 2023 13:09:36 +0000 (14:09 +0100)
The metadump v2 initialization function (introduced in a later commit) writes
the header structure into the metadump file. This will require the program to
open the metadump file before the initialization function has been invoked.

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
db/metadump.c

index 8d921500d88418b6b550e3aa23d6ff0be440075f..24f0b41fda5ea97ad01589ce72ebcbbf2bbfabb4 100644 (file)
@@ -2805,10 +2805,6 @@ metadump_f(
                pop_cur();
        }
 
-       ret = init_metadump();
-       if (ret)
-               return 0;
-
        start_iocur_sp = iocur_sp;
 
        if (strcmp(argv[optind], "-") == 0) {
@@ -2853,6 +2849,10 @@ metadump_f(
                }
        }
 
+       ret = init_metadump();
+       if (ret)
+               goto out;
+
        exitcode = 0;
 
        for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) {
@@ -2890,8 +2890,9 @@ metadump_f(
        /* cleanup iocur stack */
        while (iocur_sp > start_iocur_sp)
                pop_cur();
-out:
+
        release_metadump();
 
+out:
        return 0;
 }