Skip to content

Commit 9945639

Browse files
jamiepineclaude
andcommitted
retroactively hide stale tracked system/app volumes on Linux
Two follow-ups to the Linux volume filter: - Expand is_nested_app_mount to match the root paths (/mnt/.ix-apps, /mnt/pool/ix-applications), not just their children. - In volumes.list, when a tracked DB entry has no matching live volume (because the new filters skip it entirely — virtual fs, /sys/firmware, etc.), re-evaluate visibility by mount path and override the stale is_user_visible value that was persisted by earlier builds. This avoids needing a data migration. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fb5d4d7 commit 9945639

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

core/src/ops/volumes/list/query.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,16 @@ impl LibraryQuery for VolumeListQuery {
221221
if tracked_vol.device_id == current_device_id && !tracked_vol.is_online {
222222
continue;
223223
}
224-
volumes.push(tracked_vol.to_tracked_volume().to_offline_volume());
224+
let mut offline_vol =
225+
tracked_vol.to_tracked_volume().to_offline_volume();
226+
// Re-apply current platform visibility rules so stale DB
227+
// entries from earlier versions (which tracked everything)
228+
// inherit newly-added filters without a data migration.
229+
if should_hide_by_mount_path(&offline_vol.mount_point) {
230+
offline_vol.is_user_visible = false;
231+
offline_vol.auto_track_eligible = false;
232+
}
233+
volumes.push(offline_vol);
225234
}
226235
}
227236

@@ -255,4 +264,18 @@ impl LibraryQuery for VolumeListQuery {
255264
}
256265
}
257266

267+
/// Re-evaluate whether a mount path should be hidden from the user based on
268+
/// current platform visibility rules. Used to retroactively hide tracked
269+
/// volumes whose DB entries were created before the filter rules existed.
270+
#[cfg(target_os = "linux")]
271+
fn should_hide_by_mount_path(mount_point: &std::path::Path) -> bool {
272+
crate::volume::utils::is_system_mount_point(mount_point)
273+
|| crate::volume::utils::is_nested_app_mount(mount_point)
274+
}
275+
276+
#[cfg(not(target_os = "linux"))]
277+
fn should_hide_by_mount_path(_mount_point: &std::path::Path) -> bool {
278+
false
279+
}
280+
258281
crate::register_library_query!(VolumeListQuery, "volumes.list");

core/src/volume/utils.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,19 @@ pub fn is_system_mount_point(mount_point: &Path) -> bool {
145145
///
146146
/// Catches Docker/Kubernetes layer mounts, snap packages, ZFS snapshot
147147
/// directories, and TrueNAS Scale's iX Apps (each app creates many
148-
/// nested ZFS datasets under `ix-applications/`).
148+
/// nested ZFS datasets under `ix-applications/` — and the root of that
149+
/// hierarchy itself should also be hidden).
149150
#[cfg(target_os = "linux")]
150151
pub fn is_nested_app_mount(mount_point: &Path) -> bool {
151152
let path_str = mount_point.to_string_lossy();
152-
path_str.contains("/.ix-apps/")
153-
|| path_str.contains("/ix-applications/")
153+
154+
// Match root directories as well as anything under them
155+
let is_under = |needle: &str| -> bool {
156+
path_str.contains(&format!("/{needle}/")) || path_str.ends_with(&format!("/{needle}"))
157+
};
158+
159+
is_under(".ix-apps")
160+
|| is_under("ix-applications")
154161
|| path_str.contains("/docker/overlay2/")
155162
|| path_str.contains("/containerd/")
156163
|| path_str.contains("/kubelet/")

0 commit comments

Comments
 (0)