Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'v6.11-rc6-cifs-client-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb client fixes from Steve French:

- fix potential mount hang

- fix retry problem in two types of compound operations

- important netfs integration fix in SMB1 read paths

- fix potential uninitialized zero point of inode

- minor patch to improve debugging for potential crediting problems

* tag 'v6.11-rc6-cifs-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
netfs, cifs: Improve some debugging bits
cifs: Fix SMB1 readv/writev callback in the same way as SMB2/3
cifs: Fix zero_point init on inode initialisation
smb: client: fix double put of @cfile in smb2_set_path_size()
smb: client: fix double put of @cfile in smb2_rename_path()
smb: client: fix hang in wait_for_response() for negproto

+70 -13
+1 -1
fs/netfs/io.c
··· 270 270 if (count == remaining) 271 271 return; 272 272 273 - _debug("R=%08x[%u] ITER RESUB-MISMATCH %zx != %zx-%zx-%llx %x\n", 273 + _debug("R=%08x[%u] ITER RESUB-MISMATCH %zx != %zx-%zx-%llx %x", 274 274 rreq->debug_id, subreq->debug_index, 275 275 iov_iter_count(&subreq->io_iter), subreq->transferred, 276 276 subreq->len, rreq->i_size,
+46 -8
fs/smb/client/cifssmb.c
··· 1261 1261 return rc; 1262 1262 } 1263 1263 1264 + static void cifs_readv_worker(struct work_struct *work) 1265 + { 1266 + struct cifs_io_subrequest *rdata = 1267 + container_of(work, struct cifs_io_subrequest, subreq.work); 1268 + 1269 + netfs_subreq_terminated(&rdata->subreq, 1270 + (rdata->result == 0 || rdata->result == -EAGAIN) ? 1271 + rdata->got_bytes : rdata->result, true); 1272 + } 1273 + 1264 1274 static void 1265 1275 cifs_readv_callback(struct mid_q_entry *mid) 1266 1276 { 1267 1277 struct cifs_io_subrequest *rdata = mid->callback_data; 1278 + struct netfs_inode *ictx = netfs_inode(rdata->rreq->inode); 1268 1279 struct cifs_tcon *tcon = tlink_tcon(rdata->req->cfile->tlink); 1269 1280 struct TCP_Server_Info *server = tcon->ses->server; 1270 1281 struct smb_rqst rqst = { .rq_iov = rdata->iov, 1271 1282 .rq_nvec = 2, 1272 1283 .rq_iter = rdata->subreq.io_iter }; 1273 - struct cifs_credits credits = { .value = 1, .instance = 0 }; 1284 + struct cifs_credits credits = { 1285 + .value = 1, 1286 + .instance = 0, 1287 + .rreq_debug_id = rdata->rreq->debug_id, 1288 + .rreq_debug_index = rdata->subreq.debug_index, 1289 + }; 1274 1290 1275 1291 cifs_dbg(FYI, "%s: mid=%llu state=%d result=%d bytes=%zu\n", 1276 1292 __func__, mid->mid, mid->mid_state, rdata->result, ··· 1298 1282 if (server->sign) { 1299 1283 int rc = 0; 1300 1284 1285 + iov_iter_truncate(&rqst.rq_iter, rdata->got_bytes); 1301 1286 rc = cifs_verify_signature(&rqst, server, 1302 1287 mid->sequence_number); 1303 1288 if (rc) ··· 1323 1306 rdata->result = -EIO; 1324 1307 } 1325 1308 1326 - if (rdata->result == 0 || rdata->result == -EAGAIN) 1327 - iov_iter_advance(&rdata->subreq.io_iter, rdata->got_bytes); 1309 + if (rdata->result == -ENODATA) { 1310 + __set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags); 1311 + rdata->result = 0; 1312 + } else { 1313 + if (rdata->got_bytes < rdata->actual_len && 1314 + rdata->subreq.start + rdata->subreq.transferred + rdata->got_bytes == 1315 + ictx->remote_i_size) { 1316 + __set_bit(NETFS_SREQ_HIT_EOF, &rdata->subreq.flags); 1317 + rdata->result = 0; 1318 + } 1319 + } 1320 + 1328 1321 rdata->credits.value = 0; 1329 - netfs_subreq_terminated(&rdata->subreq, 1330 - (rdata->result == 0 || rdata->result == -EAGAIN) ? 1331 - rdata->got_bytes : rdata->result, 1332 - false); 1322 + INIT_WORK(&rdata->subreq.work, cifs_readv_worker); 1323 + queue_work(cifsiod_wq, &rdata->subreq.work); 1333 1324 release_mid(mid); 1334 1325 add_credits(server, &credits, 0); 1335 1326 } ··· 1644 1619 cifs_writev_callback(struct mid_q_entry *mid) 1645 1620 { 1646 1621 struct cifs_io_subrequest *wdata = mid->callback_data; 1622 + struct TCP_Server_Info *server = wdata->server; 1647 1623 struct cifs_tcon *tcon = tlink_tcon(wdata->req->cfile->tlink); 1648 1624 WRITE_RSP *smb = (WRITE_RSP *)mid->resp_buf; 1649 - struct cifs_credits credits = { .value = 1, .instance = 0 }; 1625 + struct cifs_credits credits = { 1626 + .value = 1, 1627 + .instance = 0, 1628 + .rreq_debug_id = wdata->rreq->debug_id, 1629 + .rreq_debug_index = wdata->subreq.debug_index, 1630 + }; 1650 1631 ssize_t result; 1651 1632 size_t written; 1652 1633 ··· 1688 1657 break; 1689 1658 } 1690 1659 1660 + trace_smb3_rw_credits(credits.rreq_debug_id, credits.rreq_debug_index, 1661 + wdata->credits.value, 1662 + server->credits, server->in_flight, 1663 + 0, cifs_trace_rw_credits_write_response_clear); 1691 1664 wdata->credits.value = 0; 1692 1665 cifs_write_subrequest_terminated(wdata, result, true); 1693 1666 release_mid(mid); 1667 + trace_smb3_rw_credits(credits.rreq_debug_id, credits.rreq_debug_index, 0, 1668 + server->credits, server->in_flight, 1669 + credits.value, cifs_trace_rw_credits_write_response_add); 1694 1670 add_credits(tcon->ses->server, &credits, 0); 1695 1671 } 1696 1672
+13 -1
fs/smb/client/connect.c
··· 657 657 server_unresponsive(struct TCP_Server_Info *server) 658 658 { 659 659 /* 660 + * If we're in the process of mounting a share or reconnecting a session 661 + * and the server abruptly shut down (e.g. socket wasn't closed, packet 662 + * had been ACK'ed but no SMB response), don't wait longer than 20s to 663 + * negotiate protocol. 664 + */ 665 + spin_lock(&server->srv_lock); 666 + if (server->tcpStatus == CifsInNegotiate && 667 + time_after(jiffies, server->lstrp + 20 * HZ)) { 668 + spin_unlock(&server->srv_lock); 669 + cifs_reconnect(server, false); 670 + return true; 671 + } 672 + /* 660 673 * We need to wait 3 echo intervals to make sure we handle such 661 674 * situations right: 662 675 * 1s client sends a normal SMB request ··· 680 667 * 65s kernel_recvmsg times out, and we see that we haven't gotten 681 668 * a response in >60s. 682 669 */ 683 - spin_lock(&server->srv_lock); 684 670 if ((server->tcpStatus == CifsGood || 685 671 server->tcpStatus == CifsNeedNegotiate) && 686 672 (!server->ops->can_echo || server->ops->can_echo(server)) &&
+2
fs/smb/client/inode.c
··· 172 172 CIFS_I(inode)->time = 0; /* force reval */ 173 173 return -ESTALE; 174 174 } 175 + if (inode->i_state & I_NEW) 176 + CIFS_I(inode)->netfs.zero_point = fattr->cf_eof; 175 177 176 178 cifs_revalidate_cache(inode, fattr); 177 179
+3
fs/smb/client/smb2inode.c
··· 1106 1106 co, DELETE, SMB2_OP_RENAME, cfile, source_dentry); 1107 1107 if (rc == -EINVAL) { 1108 1108 cifs_dbg(FYI, "invalid lease key, resending request without lease"); 1109 + cifs_get_writable_path(tcon, from_name, 1110 + FIND_WR_WITH_DELETE, &cfile); 1109 1111 rc = smb2_set_path_attr(xid, tcon, from_name, to_name, cifs_sb, 1110 1112 co, DELETE, SMB2_OP_RENAME, cfile, NULL); 1111 1113 } ··· 1151 1149 cfile, NULL, NULL, dentry); 1152 1150 if (rc == -EINVAL) { 1153 1151 cifs_dbg(FYI, "invalid lease key, resending request without lease"); 1152 + cifs_get_writable_path(tcon, full_path, FIND_WR_ANY, &cfile); 1154 1153 rc = smb2_compound_op(xid, tcon, cifs_sb, 1155 1154 full_path, &oparms, &in_iov, 1156 1155 &(int){SMB2_OP_SET_EOF}, 1,
+5 -3
fs/smb/client/smb2ops.c
··· 316 316 cifs_trace_rw_credits_no_adjust_up); 317 317 trace_smb3_too_many_credits(server->CurrentMid, 318 318 server->conn_id, server->hostname, 0, credits->value - new_val, 0); 319 - cifs_server_dbg(VFS, "request has less credits (%d) than required (%d)", 319 + cifs_server_dbg(VFS, "R=%x[%x] request has less credits (%d) than required (%d)", 320 + subreq->rreq->debug_id, subreq->subreq.debug_index, 320 321 credits->value, new_val); 321 322 322 323 return -EOPNOTSUPP; ··· 339 338 trace_smb3_reconnect_detected(server->CurrentMid, 340 339 server->conn_id, server->hostname, scredits, 341 340 credits->value - new_val, in_flight); 342 - cifs_server_dbg(VFS, "trying to return %d credits to old session\n", 343 - credits->value - new_val); 341 + cifs_server_dbg(VFS, "R=%x[%x] trying to return %d credits to old session\n", 342 + subreq->rreq->debug_id, subreq->subreq.debug_index, 343 + credits->value - new_val); 344 344 return -EAGAIN; 345 345 } 346 346