diff --git a/kmod/src/counters.h b/kmod/src/counters.h index c6d38775..c2bfa89f 100644 --- a/kmod/src/counters.h +++ b/kmod/src/counters.h @@ -146,6 +146,7 @@ EXPAND_COUNTER(lock_shrink_work) \ EXPAND_COUNTER(lock_unlock) \ EXPAND_COUNTER(lock_wait) \ + EXPAND_COUNTER(log_merge_no_finalized) \ EXPAND_COUNTER(log_merge_wait_timeout) \ EXPAND_COUNTER(net_dropped_response) \ EXPAND_COUNTER(net_send_bytes) \ @@ -182,6 +183,7 @@ EXPAND_COUNTER(quorum_send_vote) \ EXPAND_COUNTER(quorum_server_shutdown) \ EXPAND_COUNTER(quorum_term_follower) \ + EXPAND_COUNTER(reclaimed_open_logs) \ EXPAND_COUNTER(server_commit_hold) \ EXPAND_COUNTER(server_commit_queue) \ EXPAND_COUNTER(server_commit_worker) \ diff --git a/kmod/src/server.c b/kmod/src/server.c index cd978d27..4c9de90f 100644 --- a/kmod/src/server.c +++ b/kmod/src/server.c @@ -1256,6 +1256,7 @@ static int finalize_and_start_log_merge(struct super_block *sb, struct scoutfs_l /* done if we're not finalizing and there's no finalized */ if (!finalize_ours && !saw_finalized) { ret = 0; + scoutfs_inc_counter(sb, log_merge_no_finalized); break; } @@ -1889,6 +1890,9 @@ static int reclaim_open_log_tree(struct super_block *sb, u64 rid) out: mutex_unlock(&server->logs_mutex); + if (ret == 0) + scoutfs_inc_counter(sb, reclaimed_open_logs); + if (ret < 0 && ret != -EINPROGRESS) scoutfs_err(sb, "server error %d reclaiming log trees for rid %016llx: %s", ret, rid, err_str); diff --git a/tests/tests/orphan-inodes.sh b/tests/tests/orphan-inodes.sh index fd0d1d75..2bfddacc 100644 --- a/tests/tests/orphan-inodes.sh +++ b/tests/tests/orphan-inodes.sh @@ -67,6 +67,21 @@ t_mount_all while test -d $(echo /sys/fs/scoutfs/*/fence/* | cut -d " " -f 1); do sleep .5 done + + +sv=$(t_server_nr) + +# wait for reclaim_open_log_tree() to complete for each mount +while [ $(t_counter reclaimed_open_logs $sv) -lt $T_NR_MOUNTS ]; do + sleep 1 +done + +# wait for finalize_and_start_log_merge() to find no active merges in flight +# and not find any finalized trees +while [ $(t_counter log_merge_no_finalized $sv) -lt 1 ]; do + sleep 1 +done + # wait for orphan scans to run t_set_all_sysfs_mount_options orphan_scan_delay_ms 1000 # wait until we see two consecutive orphan scan attempts without