NFS diagnostics enhancements - #315
bharathsm-ms wants to merge 1 commit into
Conversation
bharathsm-ms
commented
Sep 7, 2026
- aznfs log + config collection (collect_aznfs_logs: stunnel share dir, aznfs data dir, azurefile-proxy journalctl/systemctl status)
- aznfs stunnel port range capture in tcpdump (TCPDUMP_EXTRA_PORTRANGE, validate_tcpdump_portrange, -i any)
- Configurable trace events via TraceEvents= (default nfs,nfs4)
- Kernel logs captured at start (dmesg into nfs_dmesg during init) and appended at stop
- Richer process state snapshot (ps stat/etime/wchan) replacing plain ps -ef
Applies 5 features from the nfsdiagupdates branch that were not in master: - aznfs log + config collection (collect_aznfs_logs: stunnel share dir, aznfs data dir, azurefile-proxy journalctl/systemctl status) - aznfs stunnel port range capture in tcpdump (TCPDUMP_EXTRA_PORTRANGE, validate_tcpdump_portrange, -i any) - Configurable trace events via TraceEvents=<csv> (default nfs,nfs4) - Kernel logs captured at start (dmesg into nfs_dmesg during init) and appended at stop - Richer process state snapshot (ps stat/etime/wchan) replacing plain ps -ef
|
bharathsm-ms please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
🟡 Changes recommended
The updated diagnostics collection introduces security/operational risks (copying potentially sensitive stunnel data, clearing dmesg) and has a few correctness/performance gaps that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR enhances the NFS diagnostics collection script to capture richer tracing and system state, with additional support for aznfs/stunnel-based deployments and improved kernel/process visibility during the capture window.
Changes:
- Added configurable trace-cmd events via
TraceEvents=<csv>(defaulting tonfs,nfs4). - Expanded network capture for aznfs scenarios (optional extra stunnel port range,
-i anycapture) and improved process-state snapshots. - Added kernel log capture at start (and append at stop), plus collection of aznfs-related directories and service logs.
File summaries
| File | Description |
|---|---|
NfsDiagnostics/nfsclientlogs.sh |
Adds trace event configurability, aznfs/stunnel-aware network capture, kernel/process snapshots, and aznfs log/config collection. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 6
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| if [ -d "${AZNFS_STUNNEL_SHARE_DIR}" ]; then | ||
| mkdir -p "${dest_dir}" | ||
| cp -a "${AZNFS_STUNNEL_SHARE_DIR}" "${dest_dir}/" 2>/dev/null || true | ||
| fi |
| # Capture existing kernel logs before starting the capture window | ||
| echo "======= dmesg at start =======" > "${DIRNAME}/nfs_dmesg" | ||
| dmesg -T >> "${DIRNAME}/nfs_dmesg" 2>&1 || true | ||
| dmesg -Tc > /dev/null |
| if [ "${start_port}" -gt "${end_port}" ]; then | ||
| return 1 | ||
| fi |
| for arg in "$@"; do | ||
| case "$arg" in | ||
| TraceEvents=*) trace_events_csv="${arg#TraceEvents=}" ;; | ||
| esac | ||
| done |
| else | ||
| echo "Falling back to single-file tcpdump capture in ${DIRNAME} (no rotation)." >&2 | ||
| nohup tcpdump -p -Z root -s "${TCPDUMP_SNAPLEN}" port ${NFS_PORT} -w "${DIRNAME}/nfs_traffic.pcap" & | ||
| nohup tcpdump "${tcpdump_iface[@]}" -p -Z root -s "${TCPDUMP_SNAPLEN}" "${tcpdump_filter[@]}" -w "${DIRNAME}/nfs_traffic.pcap" & |
| if [ -d "${AZNFS_DATA_DIR}" ]; then | ||
| mkdir -p "${dest_dir}" | ||
| cp -a "${AZNFS_DATA_DIR}" "${dest_dir}/" 2>/dev/null || true | ||
| fi |
sprasad-microsoft
left a comment
There was a problem hiding this comment.
Looks good to me. Please review the copilot review comments, test it and merge.