← Back to Pull requests

fix(drivers/smb): close smb sessions during transfers #2579

Open
unknown opened this pull request with 283 lines diff across 3 files
View on GitHub
unknown unknown commented on Jun 04, 2026 07:02 UTC
Author

Summary / 摘要

Fix SMB session lifecycle handling during long transfers.

  • Store the *smb2.Session in the SMB driver so cleanup can call Session.Logoff(), not only Share.Umount().

  • Add connection leases around SMB operations so idle refresh does not replace a session while a file stream, upload, or same-storage copy is still active.

  • Keep the SMB download lease alive until the returned Link stream is closed.

  • Log off partially initialized sessions if Mount fails after Dial succeeds.
  • This PR has breaking changes.

  • This PR changes public API, config, storage format, or migration behavior.

  • This PR requires corresponding changes in related repositories.
  • Related repository PRs:

  • OpenList-Frontend:

  • OpenList-Docs:
  • Related Issues / 关联 Issue

    Fixes #2578
    Related to #2228

    Testing / 测试

  • gofmt drivers/smb/driver.go drivers/smb/util.go

  • GOCACHE=/private/tmp/openlist-go-build-cache GOMODCACHE=/private/tmp/openlist-go-mod-cache GOPROXY=https://goproxy.cn,direct go test ./drivers/smb

  • go test ./...

  • Manual test / 手动测试:
  • go test ./... was attempted, but unrelated existing packages fail:

  • multiple drivers/offline packages fail on Go vet non-constant format string diagnostics;

  • pkg/aria2/rpc expects a local aria2 RPC server at localhost:6800.
  • The SMB package itself compiles successfully.

    Checklist / 检查清单

  • I have read CONTRIBUTING.

  • I confirm this contribution follows the repository license, contribution policy, and code of conduct.

  • I have formatted the changed code with gofmt.

  • I have requested review from relevant maintainers or code owners where applicable.
  • AI Disclosure / AI 使用声明

  • This PR includes AI-assisted content.
  • Tools used / 使用工具:

  • ChatGPT

  • Codex

  • GitHub Copilot

  • Claude

  • Gemini

  • Other:
  • Usage scope / 使用范围:

  • Code generation / 代码生成

  • Refactoring / 重构

  • Documentation / 文档

  • Tests / 测试

  • Review assistance / 审查辅助
  • I have reviewed and validated all AI-assisted content included in this PR.

  • I have ensured that all AI-assisted commits include Co-Authored-By attribution.

  • I can reproduce all AI-assisted content included in this PR without any AI tools.
  • Diff: 283 lines (+212 / -71) across 3 files Reviewer: elysia-best Review duration: 258531m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.47) × (1 − Review Confidence (0.45)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.47 · 283 lines diff across 3 files
    0.47
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    44%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.338
    Real PR Conversation Timeline
    1 comments
    "Review active on #2579"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 44.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 46.7% (MEDIUM) · Higher = larger blast radius
    46.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 44.7% · Lower = rushed or shallow review
    44.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.8% · Safe to merge
    25.8%