]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libfrog: fix workqueue error communication problems
authorDarrick J. Wong <darrick.wong@oracle.com>
Tue, 15 Oct 2019 16:54:20 +0000 (12:54 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Tue, 15 Oct 2019 16:54:20 +0000 (12:54 -0400)
Convert workqueue functions to return errno errors from the C library,
then convert the callers to use str_liberror to report the runtime
error.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
[sandeen: udpate commit log]
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libfrog/workqueue.c
scrub/fscounters.c
scrub/inodes.c
scrub/phase2.c
scrub/phase4.c
scrub/read_verify.c
scrub/spacemap.c
scrub/vfs.c

index 7311477374b4fdb564a63827158e2885ca2c1ff4..a806da3e63fa8a9f83651519e4ee67e60e01c519 100644 (file)
@@ -106,8 +106,8 @@ workqueue_add(
        }
 
        wi = malloc(sizeof(struct workqueue_item));
-       if (wi == NULL)
-               return ENOMEM;
+       if (!wi)
+               return errno;
 
        wi->function = func;
        wi->index = index;
index ad467e0c5c412ac0841639625214e1456cb688ce..669c5ab0cf09f70e8e459371b1ffe6ebabeed6b2 100644 (file)
@@ -115,15 +115,14 @@ xfs_count_all_inodes(
                        scrub_nproc_workqueue(ctx));
        if (ret) {
                moveon = false;
-               str_info(ctx, ctx->mntpoint, _("Could not create workqueue."));
+               str_liberror(ctx, ret, _("creating icount workqueue"));
                goto out_free;
        }
        for (agno = 0; agno < ctx->mnt.fsgeom.agcount; agno++) {
                ret = workqueue_add(&wq, xfs_count_ag_inodes, agno, ci);
                if (ret) {
                        moveon = false;
-                       str_info(ctx, ctx->mntpoint,
-_("Could not queue AG %u icount work."), agno);
+                       str_liberror(ctx, ret, _("queueing icount work"));
                        break;
                }
        }
index dd2aa173b59bbec65b382e388d8fce81c1eaf34a..74280ad6946add837a6429fc564aa05be4e7263e 100644 (file)
@@ -243,7 +243,7 @@ xfs_scan_all_inodes(
        ret = workqueue_create(&wq, (struct xfs_mount *)ctx,
                        scrub_nproc_workqueue(ctx));
        if (ret) {
-               str_info(ctx, ctx->mntpoint, _("Could not create workqueue."));
+               str_liberror(ctx, ret, _("creating bulkstat workqueue"));
                return false;
        }
 
@@ -251,8 +251,7 @@ xfs_scan_all_inodes(
                ret = workqueue_add(&wq, xfs_scan_ag_inodes, agno, &si);
                if (ret) {
                        si.moveon = false;
-                       str_info(ctx, ctx->mntpoint,
-_("Could not queue AG %u bulkstat work."), agno);
+                       str_liberror(ctx, ret, _("queueing bulkstat work"));
                        break;
                }
        }
index f064c83d870c2ae9d0a972f28ed768f25c913e46..1d2244a4c68ce698ad1d173084f861ae415d813c 100644 (file)
@@ -124,7 +124,7 @@ xfs_scan_metadata(
        ret = workqueue_create(&wq, (struct xfs_mount *)ctx,
                        scrub_nproc_workqueue(ctx));
        if (ret) {
-               str_info(ctx, ctx->mntpoint, _("Could not create workqueue."));
+               str_liberror(ctx, ret, _("creating scrub workqueue"));
                return false;
        }
 
@@ -145,8 +145,7 @@ xfs_scan_metadata(
                ret = workqueue_add(&wq, xfs_scan_ag_metadata, agno, &moveon);
                if (ret) {
                        moveon = false;
-                       str_info(ctx, ctx->mntpoint,
-_("Could not queue AG %u scrub work."), agno);
+                       str_liberror(ctx, ret, _("queueing per-AG scrub work"));
                        goto out;
                }
        }
@@ -157,8 +156,7 @@ _("Could not queue AG %u scrub work."), agno);
        ret = workqueue_add(&wq, xfs_scan_fs_metadata, 0, &moveon);
        if (ret) {
                moveon = false;
-               str_info(ctx, ctx->mntpoint,
-_("Could not queue filesystem scrub work."));
+               str_liberror(ctx, ret, _("queueing per-FS scrub work"));
                goto out;
        }
 
index 25fedc8391552a26ca2872a6edd306fa9b60f7e0..903da6d2f6619f703780b222bc104306169d22d0 100644 (file)
@@ -74,7 +74,7 @@ xfs_process_action_items(
        ret = workqueue_create(&wq, (struct xfs_mount *)ctx,
                        scrub_nproc_workqueue(ctx));
        if (ret) {
-               str_error(ctx, ctx->mntpoint, _("Could not create workqueue."));
+               str_liberror(ctx, ret, _("creating repair workqueue"));
                return false;
        }
        for (agno = 0; agno < ctx->mnt.fsgeom.agcount; agno++) {
@@ -82,8 +82,8 @@ xfs_process_action_items(
                        ret = workqueue_add(&wq, xfs_repair_ag, agno, &moveon);
                        if (ret) {
                                moveon = false;
-                               str_error(ctx, ctx->mntpoint,
-_("Could not queue repair work."));
+                               str_liberror(ctx, ret,
+                                               _("queueing repair work"));
                                break;
                        }
                }
index 2152d167992020ae915cd044c19d6ab346741173..ff4d3572f223d78b196e9172afced9e931064b02 100644 (file)
@@ -197,8 +197,7 @@ read_verify_queue(
 
        ret = workqueue_add(&rvp->wq, read_verify, 0, tmp);
        if (ret) {
-               str_info(rvp->ctx, rvp->ctx->mntpoint,
-_("Could not queue read-verify work."));
+               str_liberror(rvp->ctx, ret, _("queueing read-verify work"));
                free(tmp);
                return false;
        }
index a787647887c7d45457c803c9f5919f36a8444640..4258e318cf73579c4d702c28b4525c63e3684993 100644 (file)
@@ -200,7 +200,7 @@ xfs_scan_all_spacemaps(
        ret = workqueue_create(&wq, (struct xfs_mount *)ctx,
                        scrub_nproc_workqueue(ctx));
        if (ret) {
-               str_info(ctx, ctx->mntpoint, _("Could not create workqueue."));
+               str_liberror(ctx, ret, _("creating fsmap workqueue"));
                return false;
        }
        if (ctx->fsinfo.fs_rt) {
@@ -208,8 +208,7 @@ xfs_scan_all_spacemaps(
                                ctx->mnt.fsgeom.agcount + 1, &sbx);
                if (ret) {
                        sbx.moveon = false;
-                       str_info(ctx, ctx->mntpoint,
-_("Could not queue rtdev fsmap work."));
+                       str_liberror(ctx, ret, _("queueing rtdev fsmap work"));
                        goto out;
                }
        }
@@ -218,8 +217,7 @@ _("Could not queue rtdev fsmap work."));
                                ctx->mnt.fsgeom.agcount + 2, &sbx);
                if (ret) {
                        sbx.moveon = false;
-                       str_info(ctx, ctx->mntpoint,
-_("Could not queue logdev fsmap work."));
+                       str_liberror(ctx, ret, _("queueing logdev fsmap work"));
                        goto out;
                }
        }
@@ -227,8 +225,7 @@ _("Could not queue logdev fsmap work."));
                ret = workqueue_add(&wq, xfs_scan_ag_blocks, agno, &sbx);
                if (ret) {
                        sbx.moveon = false;
-                       str_info(ctx, ctx->mntpoint,
-_("Could not queue AG %u fsmap work."), agno);
+                       str_liberror(ctx, ret, _("queueing per-AG fsmap work"));
                        break;
                }
        }
index 1a1482ddad50c78b6e77c1360f4649fd28f180f3..0cff2e3f0801ed8d5ce429b91b4d2fbe83477e4d 100644 (file)
@@ -102,8 +102,7 @@ queue_subdir(
        error = workqueue_add(wq, scan_fs_dir, 0, new_sftd);
        if (error) {
                dec_nr_dirs(sft);
-               str_info(ctx, ctx->mntpoint,
-_("Could not queue subdirectory scan work."));
+               str_liberror(ctx, error, _("queueing directory scan work"));
                goto out_path;
        }