Whamcloud - gitweb
LU-18558 scrub: don't release os_ls_fids too early 34/57434/4
authorAlex Zhuravlev <bzzz@whamcloud.com>
Sun, 15 Dec 2024 05:28:12 +0000 (08:28 +0300)
committerOleg Drokin <green@whamcloud.com>
Tue, 11 Feb 2025 05:32:42 +0000 (05:32 +0000)
a running iterator can use os_ls_fids (in osd_iit_iget()) even with
the scrubber thread completed which should not release os_ls_fids
too early.

Test-Parameters: testlist=sanity-scrub,sanity-lfsck
Test-Parameters: testlist=sanity-scrub,sanity-lfsck
Test-Parameters: testlist=sanity-scrub,sanity-lfsck
Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: I3c5739f3b475f368235344716cd1b596e7f11bd8
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/57434
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/osd-ldiskfs/osd_scrub.c

index 0ff58e1..33ecf15 100644 (file)
@@ -1279,17 +1279,7 @@ post:
               osd_scrub2name(scrub), scrub->os_pos_current, rc,
               scrub->os_file.sf_param & SP_DRYRUN ? " dryrun mode" : "");
 
-
 out:
-       if (scrub->os_ls_fids) {
-               OBD_FREE(scrub->os_ls_fids,
-                        scrub->os_ls_size * sizeof(struct lu_fid));
-
-               scrub->os_ls_size = 0;
-               scrub->os_ls_count = 0;
-               scrub->os_ls_fids = NULL;
-       }
-
        osd_scrub_ois_fini(scrub, &scrub->os_inconsistent_items);
        lu_env_fini(&env);
 
@@ -1301,6 +1291,18 @@ noenv:
                /* scrub_stop() is waiting, we need to synchronize */
                wait_var_event(scrub, kthread_should_stop());
        wake_up_var(scrub);
+
+       /* a running iterator can be using os_ls_fids, so let's release
+        * only when we're asked to stop by that iterator */
+       if (scrub->os_ls_fids) {
+               OBD_FREE(scrub->os_ls_fids,
+                        scrub->os_ls_size * sizeof(struct lu_fid));
+
+               scrub->os_ls_size = 0;
+               scrub->os_ls_count = 0;
+               scrub->os_ls_fids = NULL;
+       }
+
        return rc;
 }