Skip to contentSkip to conversation

smb: fix bytes written value in /proc/fs/cifs/Stats

PATCH New Bharath SM 1 participant 1 message Dec 19, 2024

Subsystems (2)
lore
Share & tools
lore

Bharath SM

author
#0 lore raw

PATCH 1/1 smb: fix bytes written value in /proc/fs/cifs/Stats

With recent netfs apis changes, the bytes written value was not getting updated in /proc/fs/cifs/Stats. Fix this by updating tcon->bytes in write operations.

Fixes 3ee1a1fc3981 ("cifs: Cut over to using netfslib")
---
 fs/smb/client/smb2pdu.c | 3 +++
 1 file changed, 3 insertions(+)
fs/smb/client/smb2pdu.c +3 -0
index c945b94318f8..959359301250 100644
@@ -4840,6 +4840,8 @@ smb2_writev_callback(struct mid_q_entry *mid)
 		if (written > wdata->subreq.len)
 			written &= 0xFFFF;
 
+		cifs_stats_bytes_written(tcon, written);
+
 		if (written < wdata->subreq.len)
 			wdata->result = -ENOSPC;
 		else
@@ -5156,6 +5158,7 @@ SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms,
 		cifs_dbg(VFS, "Send error in write = %d\n", rc);
 	} else {
 		*nbytes = le32_to_cpu(rsp->DataLength);
+		cifs_stats_bytes_written(io_parms->tcon, *nbytes);
 		trace_smb3_write_done(0, 0, xid,
 				      req->PersistentFileId,
 				      io_parms->tcon->tid,
Signature · 1 line
2.43.0