smb: fix bytes written value in /proc/fs/cifs/Stats
authorBharath SM <bharathsm.hsk@gmail.com>
Thu, 19 Dec 2024 17:58:50 +0000 (23:28 +0530)
committerSteve French <stfrench@microsoft.com>
Thu, 19 Dec 2024 18:14:11 +0000 (12:14 -0600)
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")
Signed-off-by: Bharath SM <bharathsm@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2pdu.c

index c945b94318f844c236483316b20a24a3a1a412ca..9593593012508027f987acbfb1ab872685cff36d 100644 (file)
@@ -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 @@ replay_again:
                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,