CIFS: Fix trace command logging for SMB2 reads and writes
Currently we log success once we send an async IO request to the server. Instead we need to analyse a response and then log success or failure for a particular command. Also fix argument list for read logging. Cc: <stable@vger.kernel.org> # 4.18 Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
9bda8723da
commit
7d42e72fe8
|
@ -3241,8 +3241,17 @@ smb2_readv_callback(struct mid_q_entry *mid)
|
||||||
rdata->mr = NULL;
|
rdata->mr = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (rdata->result)
|
if (rdata->result) {
|
||||||
cifs_stats_fail_inc(tcon, SMB2_READ_HE);
|
cifs_stats_fail_inc(tcon, SMB2_READ_HE);
|
||||||
|
trace_smb3_read_err(0 /* xid */,
|
||||||
|
rdata->cfile->fid.persistent_fid,
|
||||||
|
tcon->tid, tcon->ses->Suid, rdata->offset,
|
||||||
|
rdata->bytes, rdata->result);
|
||||||
|
} else
|
||||||
|
trace_smb3_read_done(0 /* xid */,
|
||||||
|
rdata->cfile->fid.persistent_fid,
|
||||||
|
tcon->tid, tcon->ses->Suid,
|
||||||
|
rdata->offset, rdata->got_bytes);
|
||||||
|
|
||||||
queue_work(cifsiod_wq, &rdata->work);
|
queue_work(cifsiod_wq, &rdata->work);
|
||||||
DeleteMidQEntry(mid);
|
DeleteMidQEntry(mid);
|
||||||
|
@ -3317,13 +3326,11 @@ smb2_async_readv(struct cifs_readdata *rdata)
|
||||||
if (rc) {
|
if (rc) {
|
||||||
kref_put(&rdata->refcount, cifs_readdata_release);
|
kref_put(&rdata->refcount, cifs_readdata_release);
|
||||||
cifs_stats_fail_inc(io_parms.tcon, SMB2_READ_HE);
|
cifs_stats_fail_inc(io_parms.tcon, SMB2_READ_HE);
|
||||||
trace_smb3_read_err(rc, 0 /* xid */, io_parms.persistent_fid,
|
trace_smb3_read_err(0 /* xid */, io_parms.persistent_fid,
|
||||||
io_parms.tcon->tid, io_parms.tcon->ses->Suid,
|
io_parms.tcon->tid,
|
||||||
io_parms.offset, io_parms.length);
|
io_parms.tcon->ses->Suid,
|
||||||
} else
|
io_parms.offset, io_parms.length, rc);
|
||||||
trace_smb3_read_done(0 /* xid */, io_parms.persistent_fid,
|
}
|
||||||
io_parms.tcon->tid, io_parms.tcon->ses->Suid,
|
|
||||||
io_parms.offset, io_parms.length);
|
|
||||||
|
|
||||||
cifs_small_buf_release(buf);
|
cifs_small_buf_release(buf);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -3367,10 +3374,11 @@ SMB2_read(const unsigned int xid, struct cifs_io_parms *io_parms,
|
||||||
if (rc != -ENODATA) {
|
if (rc != -ENODATA) {
|
||||||
cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);
|
cifs_stats_fail_inc(io_parms->tcon, SMB2_READ_HE);
|
||||||
cifs_dbg(VFS, "Send error in read = %d\n", rc);
|
cifs_dbg(VFS, "Send error in read = %d\n", rc);
|
||||||
|
trace_smb3_read_err(xid, req->PersistentFileId,
|
||||||
|
io_parms->tcon->tid, ses->Suid,
|
||||||
|
io_parms->offset, io_parms->length,
|
||||||
|
rc);
|
||||||
}
|
}
|
||||||
trace_smb3_read_err(rc, xid, req->PersistentFileId,
|
|
||||||
io_parms->tcon->tid, ses->Suid,
|
|
||||||
io_parms->offset, io_parms->length);
|
|
||||||
free_rsp_buf(resp_buftype, rsp_iov.iov_base);
|
free_rsp_buf(resp_buftype, rsp_iov.iov_base);
|
||||||
return rc == -ENODATA ? 0 : rc;
|
return rc == -ENODATA ? 0 : rc;
|
||||||
} else
|
} else
|
||||||
|
@ -3459,8 +3467,17 @@ smb2_writev_callback(struct mid_q_entry *mid)
|
||||||
wdata->mr = NULL;
|
wdata->mr = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (wdata->result)
|
if (wdata->result) {
|
||||||
cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
|
cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
|
||||||
|
trace_smb3_write_err(0 /* no xid */,
|
||||||
|
wdata->cfile->fid.persistent_fid,
|
||||||
|
tcon->tid, tcon->ses->Suid, wdata->offset,
|
||||||
|
wdata->bytes, wdata->result);
|
||||||
|
} else
|
||||||
|
trace_smb3_write_done(0 /* no xid */,
|
||||||
|
wdata->cfile->fid.persistent_fid,
|
||||||
|
tcon->tid, tcon->ses->Suid,
|
||||||
|
wdata->offset, wdata->bytes);
|
||||||
|
|
||||||
queue_work(cifsiod_wq, &wdata->work);
|
queue_work(cifsiod_wq, &wdata->work);
|
||||||
DeleteMidQEntry(mid);
|
DeleteMidQEntry(mid);
|
||||||
|
@ -3602,10 +3619,7 @@ smb2_async_writev(struct cifs_writedata *wdata,
|
||||||
wdata->bytes, rc);
|
wdata->bytes, rc);
|
||||||
kref_put(&wdata->refcount, release);
|
kref_put(&wdata->refcount, release);
|
||||||
cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
|
cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
|
||||||
} else
|
}
|
||||||
trace_smb3_write_done(0 /* no xid */, req->PersistentFileId,
|
|
||||||
tcon->tid, tcon->ses->Suid, wdata->offset,
|
|
||||||
wdata->bytes);
|
|
||||||
|
|
||||||
async_writev_out:
|
async_writev_out:
|
||||||
cifs_small_buf_release(req);
|
cifs_small_buf_release(req);
|
||||||
|
|
Loading…
Reference in New Issue