From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Stefan Metzmacher <metze@samba.org>,
Steve French <smfrench@gmail.com>, Tom Talpey <tom@talpey.com>,
Long Li <longli@microsoft.com>,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
Namjae Jeon <linkinjeon@kernel.org>,
Steve French <stfrench@microsoft.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH AUTOSEL 6.17] smb: client: make use of ib_wc_status_msg() and skip IB_WC_WR_FLUSH_ERR logging
Date: Thu, 2 Oct 2025 11:29:54 -0400 [thread overview]
Message-ID: <20251002153025.2209281-7-sashal@kernel.org> (raw)
In-Reply-To: <20251002153025.2209281-1-sashal@kernel.org>
From: Stefan Metzmacher <metze@samba.org>
[ Upstream commit a8e970358b31a5abba8b5737a67ba7b8d26f4258 ]
There's no need to get log message for every IB_WC_WR_FLUSH_ERR
completion, but any other error should be logged at level ERR.
Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
LLM Generated explanations, may be completely bogus:
Based on my exhaustive analysis, here is my recommendation:
## **Backport Status: YES**
### Extensive Analysis:
#### **What This Commit Does:**
This commit makes two logging improvements to the SMB Direct (RDMA)
code:
1. **Human-readable error messages**: Changes from numeric status codes
(`wc->status=%d`) to descriptive strings using
`ib_wc_status_msg(wc->status)` (e.g., "WR flushed" instead of "6")
2. **Reduces log spam**: Adds conditional checks (`if (wc->status !=
IB_WC_WR_FLUSH_ERR)`) to skip logging for `IB_WC_WR_FLUSH_ERR`
errors, which are benign and occur frequently during normal RDMA
operations
3. **Better error visibility**: In `recv_done()` (line 607-608), changes
the log level from INFO to ERR for real errors
#### **Deep Technical Context:**
**`IB_WC_WR_FLUSH_ERR` Background:**
- This is a standard InfiniBand/RDMA work completion status indicating
that work requests were flushed from the queue
- Occurs during normal operations: QP (Queue Pair) error state
transitions, connection teardown, and error recovery
- **NOT an actionable error** - it's expected behavior that doesn't
require logging
- Other kernel RDMA drivers follow this pattern:
`drivers/infiniband/core/mad.c:2366` has `if (wc->status ==
IB_WC_WR_FLUSH_ERR)` with special handling and no error logging
**SMB Client Logging History:**
- Multiple commits address log spam in SMB client: d7cb986425ce2 "stop
flooding dmesg in smb2_calc_signature()", 6bbed0b3ad8b2 "fix noisy
when tree connecting"
- This commit follows the same pattern - reducing noise while preserving
important error information
#### **Backport Suitability Analysis:**
**✅ STRONG POSITIVE FACTORS:**
1. **Very small and safe**: Only 20 lines changed (12 insertions, 8
deletions) in a single file
2. **Logging-only changes**: No functional code paths altered - only
what gets logged and how
3. **Zero dependencies**: Both `ib_wc_status_msg()` (introduced v4.2,
2015) and `IB_WC_WR_FLUSH_ERR` exist in v6.17
4. **Code compatibility**: The v6.17 send_done():275 and recv_done():450
functions match the pre-patch state exactly
5. **Trusted author**: Stefan Metzmacher is a Samba core developer with
extensive SMB/CIFS expertise
6. **Maintainer approval**: Acked-by Namjae Jeon, Signed-off-by Steve
French (CIFS maintainer)
7. **Real user benefit**: Reduces log spam that obscures real errors,
improves observability for system administrators
8. **Industry best practice**: Aligns with how other RDMA drivers in the
kernel handle IB_WC_WR_FLUSH_ERR
9. **Minimal testing burden**: Can be verified simply by observing logs
during RDMA operations
**⚠️ CONSIDERATIONS:**
1. No explicit `Cc: stable@` tag (though this is common for QOL
improvements)
2. Not a critical bugfix - it's a usability/observability enhancement
3. Doesn't fix crashes, data corruption, or security issues
#### **Regression Risk Assessment:**
**Risk Level: VERY LOW**
- Changes only affect logging statements
- No changes to control flow, data structures, or RDMA operations
- If something did go wrong (highly unlikely), worst case is missing log
messages
- The logic is straightforward: `if (status != FLUSH_ERR) log_error()`
#### **Specific Code Changes Analyzed:**
**send_done() fs/smb/client/smbdirect.c:415-429:**
```c
- log_rdma_send(INFO, "...wc->status=%d", wc->status);
+ log_rdma_send(INFO, "...wc->status=%s", ib_wc_status_msg(wc->status));
- log_rdma_send(ERR, "wc->status=%d wc->opcode=%d\n", wc->status,
wc->opcode);
+ if (wc->status != IB_WC_WR_FLUSH_ERR)
+ log_rdma_send(ERR, "wc->status=%s wc->opcode=%d\n",
+ ib_wc_status_msg(wc->status), wc->opcode);
```
**recv_done() fs/smb/client/smbdirect.c:597-608:**
```c
- log_rdma_recv(INFO, "...wc status=%d...", wc->status, ...);
+ log_rdma_recv(INFO, "...wc status=%s...",
ib_wc_status_msg(wc->status), ...);
- log_rdma_recv(INFO, "wc->status=%d opcode=%d\n", wc->status,
wc->opcode);
+ if (wc->status != IB_WC_WR_FLUSH_ERR)
+ log_rdma_recv(ERR, "wc->status=%s opcode=%d\n",
+ ib_wc_status_msg(wc->status), wc->opcode);
```
Note the important change: ERROR level logging for recv_done (was INFO,
now ERR) - this ensures real errors are more visible.
#### **Why This Should Be Backported:**
1. **Improves user experience**: System administrators using SMB Direct
over RDMA will see cleaner logs with readable error messages
2. **Reduces support burden**: Less noise in logs means real errors are
easier to identify
3. **Safe change**: Extremely low risk of introducing regressions
4. **Already backported elsewhere**: Evidence shows this commit
(624cc9eac4e69) was already backported to another stable tree
5. **Aligns with stable tree philosophy**: Small, safe improvements that
benefit users without risk
#### **Conclusion:**
While not a critical fix, this commit provides tangible benefits
(reduced log spam, better error messages) with virtually zero risk. It
improves the operational experience for anyone using SMB Direct with
RDMA, which is important for high-performance SMB deployments. The
change is small, safe, and comes from trusted maintainers.
**Recommendation: YES - suitable for backporting to stable trees, though
not urgent priority.**
fs/smb/client/smbdirect.c | 20 ++++++++++++--------
1 file changed, 12 insertions(+), 8 deletions(-)
diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c
index 3fc5d2cebea5d..723f79f38364d 100644
--- a/fs/smb/client/smbdirect.c
+++ b/fs/smb/client/smbdirect.c
@@ -281,8 +281,8 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
struct smbd_connection *info =
container_of(sc, struct smbd_connection, socket);
- log_rdma_send(INFO, "smbdirect_send_io 0x%p completed wc->status=%d\n",
- request, wc->status);
+ log_rdma_send(INFO, "smbdirect_send_io 0x%p completed wc->status=%s\n",
+ request, ib_wc_status_msg(wc->status));
for (i = 0; i < request->num_sge; i++)
ib_dma_unmap_single(sc->ib.dev,
@@ -291,8 +291,9 @@ static void send_done(struct ib_cq *cq, struct ib_wc *wc)
DMA_TO_DEVICE);
if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_SEND) {
- log_rdma_send(ERR, "wc->status=%d wc->opcode=%d\n",
- wc->status, wc->opcode);
+ if (wc->status != IB_WC_WR_FLUSH_ERR)
+ log_rdma_send(ERR, "wc->status=%s wc->opcode=%d\n",
+ ib_wc_status_msg(wc->status), wc->opcode);
mempool_free(request, sc->send_io.mem.pool);
smbd_disconnect_rdma_connection(info);
return;
@@ -462,13 +463,16 @@ static void recv_done(struct ib_cq *cq, struct ib_wc *wc)
u32 data_length = 0;
u32 remaining_data_length = 0;
- log_rdma_recv(INFO, "response=0x%p type=%d wc status=%d wc opcode %d byte_len=%d pkey_index=%u\n",
- response, sc->recv_io.expected, wc->status, wc->opcode,
+ log_rdma_recv(INFO,
+ "response=0x%p type=%d wc status=%s wc opcode %d byte_len=%d pkey_index=%u\n",
+ response, sc->recv_io.expected,
+ ib_wc_status_msg(wc->status), wc->opcode,
wc->byte_len, wc->pkey_index);
if (wc->status != IB_WC_SUCCESS || wc->opcode != IB_WC_RECV) {
- log_rdma_recv(INFO, "wc->status=%d opcode=%d\n",
- wc->status, wc->opcode);
+ if (wc->status != IB_WC_WR_FLUSH_ERR)
+ log_rdma_recv(ERR, "wc->status=%s opcode=%d\n",
+ ib_wc_status_msg(wc->status), wc->opcode);
goto error;
}
--
2.51.0
next prev parent reply other threads:[~2025-10-02 15:30 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-02 15:29 [PATCH AUTOSEL 6.17-5.4] hfs: fix KMSAN uninit-value issue in hfs_find_set_zero_bits() Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-6.12] arm64: sysreg: Correct sign definitions for EIESB and DoubleLock Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-5.4] hfs: clear offset and space out of valid records in b-tree node Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-5.4] hfsplus: return EIO when type of hidden directory mismatch in hfsplus_fill_super() Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-6.1] powerpc/32: Remove PAGE_KERNEL_TEXT to fix startup failure Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-5.4] m68k: bitops: Fix find_*_bit() signatures Sasha Levin
2025-10-02 15:29 ` Sasha Levin [this message]
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-6.16] arm64: realm: ioremap: Allow mapping memory as encrypted Sasha Levin
2025-10-02 16:43 ` Suzuki K Poulose
2025-10-21 15:38 ` Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-6.12] gfs2: Fix unlikely race in gdlm_put_lock Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-6.1] smb: server: let smb_direct_flush_send_list() invalidate a remote key first Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-5.15] nios2: ensure that memblock.current_limit is set when setting pfn limits Sasha Levin
2025-10-02 15:29 ` [PATCH AUTOSEL 6.17-6.12] s390/mm: Use __GFP_ACCOUNT for user page table allocations Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.16] riscv: mm: Return intended SATP mode for noXlvl options Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.16] gfs2: Fix LM_FLAG_TRY* logic in add_to_queue Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.16] dlm: move to rinfo for all middle conversion cases Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-5.4] hfsplus: fix KMSAN uninit-value issue in hfsplus_delete_cat() Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-5.4] exec: Fix incorrect type for ret Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-5.4] hfsplus: fix KMSAN uninit-value issue in __hfsplus_ext_cache_extent() Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.1] lkdtm: fortify: Fix potential NULL dereference on kmalloc failure Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.16] riscv: mm: Use mmu-type from FDT to limit SATP mode Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.6] Unbreak 'make tools/*' for user-space targets Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-5.4] hfs: make proper initalization of struct hfs_find_data Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-5.4] hfsplus: fix slab-out-of-bounds read in hfsplus_strcasecmp() Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.16] riscv: cpufeature: add validation for zfa, zfh and zfhmin Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.12] PCI: Test for bit underflow in pcie_set_readrq() Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.16] s390/pkey: Forward keygenflags to ep11_unwrapkey Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.6] drivers/perf: hisi: Relax the event ID check in the framework Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-5.4] hfs: validate record offset in hfsplus_bmap_alloc Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17] smb: client: limit the range of info->receive_credit_target Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-5.4] dlm: check for defined force value in dlm_lockspace_release Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.12] binfmt_elf: preserve original ELF e_flags for core dumps Sasha Levin
2025-10-02 15:58 ` Kees Cook
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.16] arm64: errata: Apply workarounds for Neoverse-V3AE Sasha Levin
2025-10-02 15:30 ` [PATCH AUTOSEL 6.17-6.16] smb: client: queue post_recv_credits_work also if the peer raises the credit target Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251002153025.2209281-7-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=metze@samba.org \
--cc=patches@lists.linux.dev \
--cc=samba-technical@lists.samba.org \
--cc=smfrench@gmail.com \
--cc=stable@vger.kernel.org \
--cc=stfrench@microsoft.com \
--cc=tom@talpey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).