From 966944d6d8de9893b30b778d11ca7372ebcc0ce9 Mon Sep 17 00:00:00 2001 From: Mikhail Chusavitin Date: Mon, 15 Jun 2026 16:07:16 +0300 Subject: [PATCH] Fix audit hanging on smartpqi SAS HBA scan file write smartpqi uses scsi_transport_sas but does not register a sas_host object, so /sys/class/sas_host/host14 does not exist and the existing SAS detection check passes right through. Writing to host14/scan then calls sas_user_scan which blocks indefinitely on scsi_scan_target's mutex (confirmed by kernel hung-task traces in the field). Add a second detection path via /sys/class/scsi_host/hostX/proc_name: skip hosts whose driver is "smartpqi" or "hpsa" (HPE Smart Array predecessors that exhibit the same behaviour). Co-Authored-By: Claude Sonnet 4.6 --- audit/internal/collector/storage.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/audit/internal/collector/storage.go b/audit/internal/collector/storage.go index 5336a03..008528d 100644 --- a/audit/internal/collector/storage.go +++ b/audit/internal/collector/storage.go @@ -38,11 +38,22 @@ func bestEffortRescanHotplugStorage() { for _, path := range hostPaths { // SAS HBAs (e.g. smartpqi) block indefinitely in sas_user_scan when // written to — SAS topology is discovered by the driver itself. + // Detect via two methods: (1) sas_host class registration, and + // (2) driver proc_name — smartpqi uses scsi_transport_sas but does + // not register a sas_host object, so (1) alone misses it. host := filepath.Base(filepath.Dir(path)) if _, err := os.Stat("/sys/class/sas_host/" + host); err == nil { slog.Info("storage: scsi host scan skipped (SAS host)", "path", path) continue } + if procName, err := os.ReadFile("/sys/class/scsi_host/" + host + "/proc_name"); err == nil { + switch strings.TrimSpace(string(procName)) { + case "smartpqi", "hpsa": + slog.Info("storage: scsi host scan skipped (SAS transport driver)", + "path", path, "driver", strings.TrimSpace(string(procName))) + continue + } + } if err := hotplugWriteFile(path, []byte("- - -\n"), 0644); err != nil { slog.Info("storage: scsi host scan write failed", "path", path, "err", err) continue