Commit 33c9de29 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag '6.11-rc-part1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:
 "Six smb3 client fixes, most for stable including important netfs fixes:

   - various netfs related fixes for cifs addressing some regressions in
     6.10 (e.g. generic/708 and some multichannel crediting related
     issues)

   - fix for a noisy log message on copy_file_range

   - add trace point for read/write credits"

* tag '6.11-rc-part1-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
  cifs: Fix missing fscache invalidation
  cifs: Add a tracepoint to track credits involved in R/W requests
  cifs: Fix setting of zero_point after DIO write
  cifs: Fix missing error code set
  cifs: Fix server re-repick on subrequest retry
  cifs: fix noisy message on copy_file_range
parents 8e313211 a07d38af
...@@ -1359,7 +1359,7 @@ ssize_t cifs_file_copychunk_range(unsigned int xid, ...@@ -1359,7 +1359,7 @@ ssize_t cifs_file_copychunk_range(unsigned int xid,
target_tcon = tlink_tcon(smb_file_target->tlink); target_tcon = tlink_tcon(smb_file_target->tlink);
if (src_tcon->ses != target_tcon->ses) { if (src_tcon->ses != target_tcon->ses) {
cifs_dbg(VFS, "source and target of copy not on same server\n"); cifs_dbg(FYI, "source and target of copy not on same server\n");
goto out; goto out;
} }
......
...@@ -290,7 +290,7 @@ struct smb_version_operations { ...@@ -290,7 +290,7 @@ struct smb_version_operations {
int (*check_receive)(struct mid_q_entry *, struct TCP_Server_Info *, int (*check_receive)(struct mid_q_entry *, struct TCP_Server_Info *,
bool); bool);
void (*add_credits)(struct TCP_Server_Info *server, void (*add_credits)(struct TCP_Server_Info *server,
const struct cifs_credits *credits, struct cifs_credits *credits,
const int optype); const int optype);
void (*set_credits)(struct TCP_Server_Info *, const int); void (*set_credits)(struct TCP_Server_Info *, const int);
int * (*get_credits_field)(struct TCP_Server_Info *, const int); int * (*get_credits_field)(struct TCP_Server_Info *, const int);
...@@ -550,8 +550,8 @@ struct smb_version_operations { ...@@ -550,8 +550,8 @@ struct smb_version_operations {
size_t *, struct cifs_credits *); size_t *, struct cifs_credits *);
/* adjust previously taken mtu credits to request size */ /* adjust previously taken mtu credits to request size */
int (*adjust_credits)(struct TCP_Server_Info *server, int (*adjust_credits)(struct TCP_Server_Info *server,
struct cifs_credits *credits, struct cifs_io_subrequest *subreq,
const unsigned int payload_size); unsigned int /*enum smb3_rw_credits_trace*/ trace);
/* check if we need to issue closedir */ /* check if we need to issue closedir */
bool (*dir_needs_close)(struct cifsFileInfo *); bool (*dir_needs_close)(struct cifsFileInfo *);
long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t, long (*fallocate)(struct file *, struct cifs_tcon *, int, loff_t,
...@@ -848,6 +848,9 @@ static inline void cifs_server_unlock(struct TCP_Server_Info *server) ...@@ -848,6 +848,9 @@ static inline void cifs_server_unlock(struct TCP_Server_Info *server)
struct cifs_credits { struct cifs_credits {
unsigned int value; unsigned int value;
unsigned int instance; unsigned int instance;
unsigned int in_flight_check;
unsigned int rreq_debug_id;
unsigned int rreq_debug_index;
}; };
static inline unsigned int static inline unsigned int
...@@ -873,7 +876,7 @@ has_credits(struct TCP_Server_Info *server, int *credits, int num_credits) ...@@ -873,7 +876,7 @@ has_credits(struct TCP_Server_Info *server, int *credits, int num_credits)
} }
static inline void static inline void
add_credits(struct TCP_Server_Info *server, const struct cifs_credits *credits, add_credits(struct TCP_Server_Info *server, struct cifs_credits *credits,
const int optype) const int optype)
{ {
server->ops->add_credits(server, credits, optype); server->ops->add_credits(server, credits, optype);
...@@ -897,11 +900,11 @@ set_credits(struct TCP_Server_Info *server, const int val) ...@@ -897,11 +900,11 @@ set_credits(struct TCP_Server_Info *server, const int val)
} }
static inline int static inline int
adjust_credits(struct TCP_Server_Info *server, struct cifs_credits *credits, adjust_credits(struct TCP_Server_Info *server, struct cifs_io_subrequest *subreq,
const unsigned int payload_size) unsigned int /* enum smb3_rw_credits_trace */ trace)
{ {
return server->ops->adjust_credits ? return server->ops->adjust_credits ?
server->ops->adjust_credits(server, credits, payload_size) : 0; server->ops->adjust_credits(server, subreq, trace) : 0;
} }
static inline __le64 static inline __le64
......
...@@ -80,6 +80,16 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq) ...@@ -80,6 +80,16 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
return netfs_prepare_write_failed(subreq); return netfs_prepare_write_failed(subreq);
} }
wdata->credits.rreq_debug_id = subreq->rreq->debug_id;
wdata->credits.rreq_debug_index = subreq->debug_index;
wdata->credits.in_flight_check = 1;
trace_smb3_rw_credits(wdata->rreq->debug_id,
wdata->subreq.debug_index,
wdata->credits.value,
server->credits, server->in_flight,
wdata->credits.value,
cifs_trace_rw_credits_write_prepare);
#ifdef CONFIG_CIFS_SMB_DIRECT #ifdef CONFIG_CIFS_SMB_DIRECT
if (server->smbd_conn) if (server->smbd_conn)
subreq->max_nr_segs = server->smbd_conn->max_frmr_depth; subreq->max_nr_segs = server->smbd_conn->max_frmr_depth;
...@@ -101,7 +111,7 @@ static void cifs_issue_write(struct netfs_io_subrequest *subreq) ...@@ -101,7 +111,7 @@ static void cifs_issue_write(struct netfs_io_subrequest *subreq)
goto fail; goto fail;
} }
rc = adjust_credits(wdata->server, &wdata->credits, wdata->subreq.len); rc = adjust_credits(wdata->server, wdata, cifs_trace_rw_credits_issue_write_adjust);
if (rc) if (rc)
goto fail; goto fail;
...@@ -123,6 +133,11 @@ static void cifs_issue_write(struct netfs_io_subrequest *subreq) ...@@ -123,6 +133,11 @@ static void cifs_issue_write(struct netfs_io_subrequest *subreq)
goto out; goto out;
} }
static void cifs_netfs_invalidate_cache(struct netfs_io_request *wreq)
{
cifs_invalidate_cache(wreq->inode, 0);
}
/* /*
* Split the read up according to how many credits we can get for each piece. * Split the read up according to how many credits we can get for each piece.
* It's okay to sleep here if we need to wait for more credit to become * It's okay to sleep here if we need to wait for more credit to become
...@@ -158,7 +173,18 @@ static bool cifs_clamp_length(struct netfs_io_subrequest *subreq) ...@@ -158,7 +173,18 @@ static bool cifs_clamp_length(struct netfs_io_subrequest *subreq)
return false; return false;
} }
rdata->credits.in_flight_check = 1;
rdata->credits.rreq_debug_id = rreq->debug_id;
rdata->credits.rreq_debug_index = subreq->debug_index;
trace_smb3_rw_credits(rdata->rreq->debug_id,
rdata->subreq.debug_index,
rdata->credits.value,
server->credits, server->in_flight, 0,
cifs_trace_rw_credits_read_submit);
subreq->len = min_t(size_t, subreq->len, rsize); subreq->len = min_t(size_t, subreq->len, rsize);
#ifdef CONFIG_CIFS_SMB_DIRECT #ifdef CONFIG_CIFS_SMB_DIRECT
if (server->smbd_conn) if (server->smbd_conn)
subreq->max_nr_segs = server->smbd_conn->max_frmr_depth; subreq->max_nr_segs = server->smbd_conn->max_frmr_depth;
...@@ -289,6 +315,15 @@ static void cifs_free_subrequest(struct netfs_io_subrequest *subreq) ...@@ -289,6 +315,15 @@ static void cifs_free_subrequest(struct netfs_io_subrequest *subreq)
#endif #endif
} }
if (rdata->credits.value != 0)
trace_smb3_rw_credits(rdata->rreq->debug_id,
rdata->subreq.debug_index,
rdata->credits.value,
rdata->server ? rdata->server->credits : 0,
rdata->server ? rdata->server->in_flight : 0,
-rdata->credits.value,
cifs_trace_rw_credits_free_subreq);
add_credits_and_wake_if(rdata->server, &rdata->credits, 0); add_credits_and_wake_if(rdata->server, &rdata->credits, 0);
if (rdata->have_xid) if (rdata->have_xid)
free_xid(rdata->xid); free_xid(rdata->xid);
...@@ -307,6 +342,7 @@ const struct netfs_request_ops cifs_req_ops = { ...@@ -307,6 +342,7 @@ const struct netfs_request_ops cifs_req_ops = {
.begin_writeback = cifs_begin_writeback, .begin_writeback = cifs_begin_writeback,
.prepare_write = cifs_prepare_write, .prepare_write = cifs_prepare_write,
.issue_write = cifs_issue_write, .issue_write = cifs_issue_write,
.invalidate_cache = cifs_netfs_invalidate_cache,
}; };
/* /*
...@@ -2358,13 +2394,18 @@ void cifs_write_subrequest_terminated(struct cifs_io_subrequest *wdata, ssize_t ...@@ -2358,13 +2394,18 @@ void cifs_write_subrequest_terminated(struct cifs_io_subrequest *wdata, ssize_t
bool was_async) bool was_async)
{ {
struct netfs_io_request *wreq = wdata->rreq; struct netfs_io_request *wreq = wdata->rreq;
loff_t new_server_eof; struct netfs_inode *ictx = netfs_inode(wreq->inode);
loff_t wrend;
if (result > 0) { if (result > 0) {
new_server_eof = wdata->subreq.start + wdata->subreq.transferred + result; wrend = wdata->subreq.start + wdata->subreq.transferred + result;
if (new_server_eof > netfs_inode(wreq->inode)->remote_i_size) if (wrend > ictx->zero_point &&
netfs_resize_file(netfs_inode(wreq->inode), new_server_eof, true); (wdata->rreq->origin == NETFS_UNBUFFERED_WRITE ||
wdata->rreq->origin == NETFS_DIO_WRITE))
ictx->zero_point = wrend;
if (wrend > ictx->remote_i_size)
netfs_resize_file(ictx, wrend, true);
} }
netfs_write_subrequest_terminated(&wdata->subreq, result, was_async); netfs_write_subrequest_terminated(&wdata->subreq, result, was_async);
...@@ -2877,6 +2918,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to) ...@@ -2877,6 +2918,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
rc = netfs_start_io_direct(inode); rc = netfs_start_io_direct(inode);
if (rc < 0) if (rc < 0)
goto out; goto out;
rc = -EACCES;
down_read(&cinode->lock_sem); down_read(&cinode->lock_sem);
if (!cifs_find_lock_conflict( if (!cifs_find_lock_conflict(
cfile, iocb->ki_pos, iov_iter_count(to), cfile, iocb->ki_pos, iov_iter_count(to),
...@@ -2889,6 +2931,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to) ...@@ -2889,6 +2931,7 @@ cifs_strict_readv(struct kiocb *iocb, struct iov_iter *to)
rc = netfs_start_io_read(inode); rc = netfs_start_io_read(inode);
if (rc < 0) if (rc < 0)
goto out; goto out;
rc = -EACCES;
down_read(&cinode->lock_sem); down_read(&cinode->lock_sem);
if (!cifs_find_lock_conflict( if (!cifs_find_lock_conflict(
cfile, iocb->ki_pos, iov_iter_count(to), cfile, iocb->ki_pos, iov_iter_count(to),
......
...@@ -108,7 +108,7 @@ cifs_find_mid(struct TCP_Server_Info *server, char *buffer) ...@@ -108,7 +108,7 @@ cifs_find_mid(struct TCP_Server_Info *server, char *buffer)
static void static void
cifs_add_credits(struct TCP_Server_Info *server, cifs_add_credits(struct TCP_Server_Info *server,
const struct cifs_credits *credits, const int optype) struct cifs_credits *credits, const int optype)
{ {
spin_lock(&server->req_lock); spin_lock(&server->req_lock);
server->credits += credits->value; server->credits += credits->value;
......
...@@ -66,7 +66,7 @@ change_conf(struct TCP_Server_Info *server) ...@@ -66,7 +66,7 @@ change_conf(struct TCP_Server_Info *server)
static void static void
smb2_add_credits(struct TCP_Server_Info *server, smb2_add_credits(struct TCP_Server_Info *server,
const struct cifs_credits *credits, const int optype) struct cifs_credits *credits, const int optype)
{ {
int *val, rc = -1; int *val, rc = -1;
int scredits, in_flight; int scredits, in_flight;
...@@ -94,7 +94,21 @@ smb2_add_credits(struct TCP_Server_Info *server, ...@@ -94,7 +94,21 @@ smb2_add_credits(struct TCP_Server_Info *server,
server->conn_id, server->hostname, *val, server->conn_id, server->hostname, *val,
add, server->in_flight); add, server->in_flight);
} }
WARN_ON_ONCE(server->in_flight == 0); if (credits->in_flight_check > 1) {
pr_warn_once("rreq R=%08x[%x] Credits not in flight\n",
credits->rreq_debug_id, credits->rreq_debug_index);
} else {
credits->in_flight_check = 2;
}
if (WARN_ON_ONCE(server->in_flight == 0)) {
pr_warn_once("rreq R=%08x[%x] Zero in_flight\n",
credits->rreq_debug_id, credits->rreq_debug_index);
trace_smb3_rw_credits(credits->rreq_debug_id,
credits->rreq_debug_index,
credits->value,
server->credits, server->in_flight, 0,
cifs_trace_rw_credits_zero_in_flight);
}
server->in_flight--; server->in_flight--;
if (server->in_flight == 0 && if (server->in_flight == 0 &&
((optype & CIFS_OP_MASK) != CIFS_NEG_OP) && ((optype & CIFS_OP_MASK) != CIFS_NEG_OP) &&
...@@ -283,16 +297,23 @@ smb2_wait_mtu_credits(struct TCP_Server_Info *server, size_t size, ...@@ -283,16 +297,23 @@ smb2_wait_mtu_credits(struct TCP_Server_Info *server, size_t size,
static int static int
smb2_adjust_credits(struct TCP_Server_Info *server, smb2_adjust_credits(struct TCP_Server_Info *server,
struct cifs_credits *credits, struct cifs_io_subrequest *subreq,
const unsigned int payload_size) unsigned int /*enum smb3_rw_credits_trace*/ trace)
{ {
int new_val = DIV_ROUND_UP(payload_size, SMB2_MAX_BUFFER_SIZE); struct cifs_credits *credits = &subreq->credits;
int new_val = DIV_ROUND_UP(subreq->subreq.len, SMB2_MAX_BUFFER_SIZE);
int scredits, in_flight; int scredits, in_flight;
if (!credits->value || credits->value == new_val) if (!credits->value || credits->value == new_val)
return 0; return 0;
if (credits->value < new_val) { if (credits->value < new_val) {
trace_smb3_rw_credits(subreq->rreq->debug_id,
subreq->subreq.debug_index,
credits->value,
server->credits, server->in_flight,
new_val - credits->value,
cifs_trace_rw_credits_no_adjust_up);
trace_smb3_too_many_credits(server->CurrentMid, trace_smb3_too_many_credits(server->CurrentMid,
server->conn_id, server->hostname, 0, credits->value - new_val, 0); server->conn_id, server->hostname, 0, credits->value - new_val, 0);
cifs_server_dbg(VFS, "request has less credits (%d) than required (%d)", cifs_server_dbg(VFS, "request has less credits (%d) than required (%d)",
...@@ -308,6 +329,12 @@ smb2_adjust_credits(struct TCP_Server_Info *server, ...@@ -308,6 +329,12 @@ smb2_adjust_credits(struct TCP_Server_Info *server,
in_flight = server->in_flight; in_flight = server->in_flight;
spin_unlock(&server->req_lock); spin_unlock(&server->req_lock);
trace_smb3_rw_credits(subreq->rreq->debug_id,
subreq->subreq.debug_index,
credits->value,
server->credits, server->in_flight,
new_val - credits->value,
cifs_trace_rw_credits_old_session);
trace_smb3_reconnect_detected(server->CurrentMid, trace_smb3_reconnect_detected(server->CurrentMid,
server->conn_id, server->hostname, scredits, server->conn_id, server->hostname, scredits,
credits->value - new_val, in_flight); credits->value - new_val, in_flight);
...@@ -316,6 +343,11 @@ smb2_adjust_credits(struct TCP_Server_Info *server, ...@@ -316,6 +343,11 @@ smb2_adjust_credits(struct TCP_Server_Info *server,
return -EAGAIN; return -EAGAIN;
} }
trace_smb3_rw_credits(subreq->rreq->debug_id,
subreq->subreq.debug_index,
credits->value,
server->credits, server->in_flight,
new_val - credits->value, trace);
server->credits += credits->value - new_val; server->credits += credits->value - new_val;
scredits = server->credits; scredits = server->credits;
in_flight = server->in_flight; in_flight = server->in_flight;
......
...@@ -4502,8 +4502,15 @@ smb2_readv_callback(struct mid_q_entry *mid) ...@@ -4502,8 +4502,15 @@ smb2_readv_callback(struct mid_q_entry *mid)
struct TCP_Server_Info *server = rdata->server; struct TCP_Server_Info *server = rdata->server;
struct smb2_hdr *shdr = struct smb2_hdr *shdr =
(struct smb2_hdr *)rdata->iov[0].iov_base; (struct smb2_hdr *)rdata->iov[0].iov_base;
struct cifs_credits credits = { .value = 0, .instance = 0 }; struct cifs_credits credits = {
.value = 0,
.instance = 0,
.rreq_debug_id = rdata->rreq->debug_id,
.rreq_debug_index = rdata->subreq.debug_index,
};
struct smb_rqst rqst = { .rq_iov = &rdata->iov[1], .rq_nvec = 1 }; struct smb_rqst rqst = { .rq_iov = &rdata->iov[1], .rq_nvec = 1 };
unsigned int rreq_debug_id = rdata->rreq->debug_id;
unsigned int subreq_debug_index = rdata->subreq.debug_index;
if (rdata->got_bytes) { if (rdata->got_bytes) {
rqst.rq_iter = rdata->subreq.io_iter; rqst.rq_iter = rdata->subreq.io_iter;
...@@ -4587,10 +4594,16 @@ smb2_readv_callback(struct mid_q_entry *mid) ...@@ -4587,10 +4594,16 @@ smb2_readv_callback(struct mid_q_entry *mid)
if (rdata->subreq.start < rdata->subreq.rreq->i_size) if (rdata->subreq.start < rdata->subreq.rreq->i_size)
rdata->result = 0; rdata->result = 0;
} }
trace_smb3_rw_credits(rreq_debug_id, subreq_debug_index, rdata->credits.value,
server->credits, server->in_flight,
0, cifs_trace_rw_credits_read_response_clear);
rdata->credits.value = 0; rdata->credits.value = 0;
INIT_WORK(&rdata->subreq.work, smb2_readv_worker); INIT_WORK(&rdata->subreq.work, smb2_readv_worker);
queue_work(cifsiod_wq, &rdata->subreq.work); queue_work(cifsiod_wq, &rdata->subreq.work);
release_mid(mid); release_mid(mid);
trace_smb3_rw_credits(rreq_debug_id, subreq_debug_index, 0,
server->credits, server->in_flight,
credits.value, cifs_trace_rw_credits_read_response_add);
add_credits(server, &credits, 0); add_credits(server, &credits, 0);
} }
...@@ -4647,7 +4660,7 @@ smb2_async_readv(struct cifs_io_subrequest *rdata) ...@@ -4647,7 +4660,7 @@ smb2_async_readv(struct cifs_io_subrequest *rdata)
min_t(int, server->max_credits - min_t(int, server->max_credits -
server->credits, credit_request)); server->credits, credit_request));
rc = adjust_credits(server, &rdata->credits, rdata->subreq.len); rc = adjust_credits(server, rdata, cifs_trace_rw_credits_call_readv_adjust);
if (rc) if (rc)
goto async_readv_out; goto async_readv_out;
...@@ -4766,7 +4779,14 @@ smb2_writev_callback(struct mid_q_entry *mid) ...@@ -4766,7 +4779,14 @@ smb2_writev_callback(struct mid_q_entry *mid)
struct cifs_tcon *tcon = tlink_tcon(wdata->req->cfile->tlink); struct cifs_tcon *tcon = tlink_tcon(wdata->req->cfile->tlink);
struct TCP_Server_Info *server = wdata->server; struct TCP_Server_Info *server = wdata->server;
struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf; struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf;
struct cifs_credits credits = { .value = 0, .instance = 0 }; struct cifs_credits credits = {
.value = 0,
.instance = 0,
.rreq_debug_id = wdata->rreq->debug_id,
.rreq_debug_index = wdata->subreq.debug_index,
};
unsigned int rreq_debug_id = wdata->rreq->debug_id;
unsigned int subreq_debug_index = wdata->subreq.debug_index;
ssize_t result = 0; ssize_t result = 0;
size_t written; size_t written;
...@@ -4837,9 +4857,15 @@ smb2_writev_callback(struct mid_q_entry *mid) ...@@ -4837,9 +4857,15 @@ smb2_writev_callback(struct mid_q_entry *mid)
tcon->tid, tcon->ses->Suid, tcon->tid, tcon->ses->Suid,
wdata->subreq.start, wdata->subreq.len); wdata->subreq.start, wdata->subreq.len);
trace_smb3_rw_credits(rreq_debug_id, subreq_debug_index, wdata->credits.value,
server->credits, server->in_flight,
0, cifs_trace_rw_credits_write_response_clear);
wdata->credits.value = 0; wdata->credits.value = 0;
cifs_write_subrequest_terminated(wdata, result ?: written, true); cifs_write_subrequest_terminated(wdata, result ?: written, true);
release_mid(mid); release_mid(mid);
trace_smb3_rw_credits(rreq_debug_id, subreq_debug_index, 0,
server->credits, server->in_flight,
credits.value, cifs_trace_rw_credits_write_response_add);
add_credits(server, &credits, 0); add_credits(server, &credits, 0);
} }
...@@ -4859,9 +4885,6 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) ...@@ -4859,9 +4885,6 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
struct cifs_io_parms *io_parms = NULL; struct cifs_io_parms *io_parms = NULL;
int credit_request; int credit_request;
if (!wdata->server || test_bit(NETFS_SREQ_RETRYING, &wdata->subreq.flags))
server = wdata->server = cifs_pick_channel(tcon->ses);
/* /*
* in future we may get cifs_io_parms passed in from the caller, * in future we may get cifs_io_parms passed in from the caller,
* but for now we construct it here... * but for now we construct it here...
...@@ -4972,7 +4995,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) ...@@ -4972,7 +4995,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
min_t(int, server->max_credits - min_t(int, server->max_credits -
server->credits, credit_request)); server->credits, credit_request));
rc = adjust_credits(server, &wdata->credits, io_parms->length); rc = adjust_credits(server, wdata, cifs_trace_rw_credits_call_writev_adjust);
if (rc) if (rc)
goto async_writev_out; goto async_writev_out;
...@@ -4997,6 +5020,12 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) ...@@ -4997,6 +5020,12 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
cifs_small_buf_release(req); cifs_small_buf_release(req);
out: out:
if (rc) { if (rc) {
trace_smb3_rw_credits(wdata->rreq->debug_id,
wdata->subreq.debug_index,
wdata->credits.value,
server->credits, server->in_flight,
-(int)wdata->credits.value,
cifs_trace_rw_credits_write_response_clear);
add_credits_and_wake_if(wdata->server, &wdata->credits, 0); add_credits_and_wake_if(wdata->server, &wdata->credits, 0);
cifs_write_subrequest_terminated(wdata, rc, true); cifs_write_subrequest_terminated(wdata, rc, true);
} }
......
...@@ -20,6 +20,22 @@ ...@@ -20,6 +20,22 @@
/* /*
* Specify enums for tracing information. * Specify enums for tracing information.
*/ */
#define smb3_rw_credits_traces \
EM(cifs_trace_rw_credits_call_readv_adjust, "rd-call-adj") \
EM(cifs_trace_rw_credits_call_writev_adjust, "wr-call-adj") \
EM(cifs_trace_rw_credits_free_subreq, "free-subreq") \
EM(cifs_trace_rw_credits_issue_read_adjust, "rd-issu-adj") \
EM(cifs_trace_rw_credits_issue_write_adjust, "wr-issu-adj") \
EM(cifs_trace_rw_credits_no_adjust_up, "no-adj-up ") \
EM(cifs_trace_rw_credits_old_session, "old-session") \
EM(cifs_trace_rw_credits_read_response_add, "rd-resp-add") \
EM(cifs_trace_rw_credits_read_response_clear, "rd-resp-clr") \
EM(cifs_trace_rw_credits_read_submit, "rd-submit ") \
EM(cifs_trace_rw_credits_write_prepare, "wr-prepare ") \
EM(cifs_trace_rw_credits_write_response_add, "wr-resp-add") \
EM(cifs_trace_rw_credits_write_response_clear, "wr-resp-clr") \
E_(cifs_trace_rw_credits_zero_in_flight, "ZERO-IN-FLT")
#define smb3_tcon_ref_traces \ #define smb3_tcon_ref_traces \
EM(netfs_trace_tcon_ref_dec_dfs_refer, "DEC DfsRef") \ EM(netfs_trace_tcon_ref_dec_dfs_refer, "DEC DfsRef") \
EM(netfs_trace_tcon_ref_free, "FRE ") \ EM(netfs_trace_tcon_ref_free, "FRE ") \
...@@ -59,7 +75,8 @@ ...@@ -59,7 +75,8 @@
#define EM(a, b) a, #define EM(a, b) a,
#define E_(a, b) a #define E_(a, b) a
enum smb3_tcon_ref_trace { smb3_tcon_ref_traces } __mode(byte); enum smb3_rw_credits_trace { smb3_rw_credits_traces } __mode(byte);
enum smb3_tcon_ref_trace { smb3_tcon_ref_traces } __mode(byte);
#undef EM #undef EM
#undef E_ #undef E_
...@@ -71,6 +88,7 @@ enum smb3_tcon_ref_trace { smb3_tcon_ref_traces } __mode(byte); ...@@ -71,6 +88,7 @@ enum smb3_tcon_ref_trace { smb3_tcon_ref_traces } __mode(byte);
#define EM(a, b) TRACE_DEFINE_ENUM(a); #define EM(a, b) TRACE_DEFINE_ENUM(a);
#define E_(a, b) TRACE_DEFINE_ENUM(a); #define E_(a, b) TRACE_DEFINE_ENUM(a);
smb3_rw_credits_traces;
smb3_tcon_ref_traces; smb3_tcon_ref_traces;
#undef EM #undef EM
...@@ -1316,6 +1334,41 @@ TRACE_EVENT(smb3_tcon_ref, ...@@ -1316,6 +1334,41 @@ TRACE_EVENT(smb3_tcon_ref,
__entry->ref) __entry->ref)
); );
TRACE_EVENT(smb3_rw_credits,
TP_PROTO(unsigned int rreq_debug_id,
unsigned int subreq_debug_index,
unsigned int subreq_credits,
unsigned int server_credits,
int server_in_flight,
int credit_change,
enum smb3_rw_credits_trace trace),
TP_ARGS(rreq_debug_id, subreq_debug_index, subreq_credits,
server_credits, server_in_flight, credit_change, trace),
TP_STRUCT__entry(
__field(unsigned int, rreq_debug_id)
__field(unsigned int, subreq_debug_index)
__field(unsigned int, subreq_credits)
__field(unsigned int, server_credits)
__field(int, in_flight)
__field(int, credit_change)
__field(enum smb3_rw_credits_trace, trace)
),
TP_fast_assign(
__entry->rreq_debug_id = rreq_debug_id;
__entry->subreq_debug_index = subreq_debug_index;
__entry->subreq_credits = subreq_credits;
__entry->server_credits = server_credits;
__entry->in_flight = server_in_flight;
__entry->credit_change = credit_change;
__entry->trace = trace;
),
TP_printk("R=%08x[%x] %s cred=%u chg=%d pool=%u ifl=%d",
__entry->rreq_debug_id, __entry->subreq_debug_index,
__print_symbolic(__entry->trace, smb3_rw_credits_traces),
__entry->subreq_credits, __entry->credit_change,
__entry->server_credits, __entry->in_flight)
);
#undef EM #undef EM
#undef E_ #undef E_
......
...@@ -988,10 +988,10 @@ static void ...@@ -988,10 +988,10 @@ static void
cifs_compound_callback(struct mid_q_entry *mid) cifs_compound_callback(struct mid_q_entry *mid)
{ {
struct TCP_Server_Info *server = mid->server; struct TCP_Server_Info *server = mid->server;
struct cifs_credits credits; struct cifs_credits credits = {
.value = server->ops->get_credits(mid),
credits.value = server->ops->get_credits(mid); .instance = server->reconnect_instance,
credits.instance = server->reconnect_instance; };
add_credits(server, &credits, mid->optype); add_credits(server, &credits, mid->optype);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment