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 '5.1-rc1-cifs-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6

Pull smb3 fixes from Steve French:

- two fixes for stable for guest mount problems with smb3.1.1

- two fixes for crediting (SMB3 flow control) on resent requests

- a byte range lock leak fix

- two fixes for incorrect rc mappings

* tag '5.1-rc1-cifs-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
cifs: update internal module version number
SMB3: Fix SMB3.1.1 guest mounts to Samba
cifs: Fix slab-out-of-bounds when tracing SMB tcon
cifs: allow guest mounts to work for smb3.11
fix incorrect error code mapping for OBJECTID_NOT_FOUND
cifs: fix that return -EINVAL when do dedupe operation
CIFS: Fix an issue with re-sending rdata when transport returning -EAGAIN
CIFS: Fix an issue with re-sending wdata when transport returning -EAGAIN

+104 -72
+1 -1
fs/cifs/cifsfs.c
··· 1008 1008 unsigned int xid; 1009 1009 int rc; 1010 1010 1011 - if (remap_flags & ~REMAP_FILE_ADVISORY) 1011 + if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY)) 1012 1012 return -EINVAL; 1013 1013 1014 1014 cifs_dbg(FYI, "clone range\n");
+1 -1
fs/cifs/cifsfs.h
··· 150 150 extern const struct export_operations cifs_export_ops; 151 151 #endif /* CONFIG_CIFS_NFSD_EXPORT */ 152 152 153 - #define CIFS_VERSION "2.18" 153 + #define CIFS_VERSION "2.19" 154 154 #endif /* _CIFSFS_H */
+88 -64
fs/cifs/file.c
··· 2632 2632 struct TCP_Server_Info *server = 2633 2633 tlink_tcon(wdata->cfile->tlink)->ses->server; 2634 2634 2635 - /* 2636 - * Wait for credits to resend this wdata. 2637 - * Note: we are attempting to resend the whole wdata not in segments 2638 - */ 2639 2635 do { 2640 - rc = server->ops->wait_mtu_credits(server, wdata->bytes, &wsize, 2641 - &credits); 2642 - 2643 - if (rc) 2644 - goto out; 2645 - 2646 - if (wsize < wdata->bytes) { 2647 - add_credits_and_wake_if(server, &credits, 0); 2648 - msleep(1000); 2649 - } 2650 - } while (wsize < wdata->bytes); 2651 - 2652 - wdata->credits = credits; 2653 - rc = -EAGAIN; 2654 - while (rc == -EAGAIN) { 2655 - rc = 0; 2656 - if (wdata->cfile->invalidHandle) 2636 + if (wdata->cfile->invalidHandle) { 2657 2637 rc = cifs_reopen_file(wdata->cfile, false); 2658 - if (!rc) 2659 - rc = server->ops->async_writev(wdata, 2638 + if (rc == -EAGAIN) 2639 + continue; 2640 + else if (rc) 2641 + break; 2642 + } 2643 + 2644 + 2645 + /* 2646 + * Wait for credits to resend this wdata. 2647 + * Note: we are attempting to resend the whole wdata not in 2648 + * segments 2649 + */ 2650 + do { 2651 + rc = server->ops->wait_mtu_credits(server, wdata->bytes, 2652 + &wsize, &credits); 2653 + if (rc) 2654 + goto fail; 2655 + 2656 + if (wsize < wdata->bytes) { 2657 + add_credits_and_wake_if(server, &credits, 0); 2658 + msleep(1000); 2659 + } 2660 + } while (wsize < wdata->bytes); 2661 + wdata->credits = credits; 2662 + 2663 + rc = adjust_credits(server, &wdata->credits, wdata->bytes); 2664 + 2665 + if (!rc) { 2666 + if (wdata->cfile->invalidHandle) 2667 + rc = -EAGAIN; 2668 + else 2669 + rc = server->ops->async_writev(wdata, 2660 2670 cifs_uncached_writedata_release); 2661 - } 2671 + } 2662 2672 2663 - if (!rc) { 2664 - list_add_tail(&wdata->list, wdata_list); 2665 - return 0; 2666 - } 2673 + /* If the write was successfully sent, we are done */ 2674 + if (!rc) { 2675 + list_add_tail(&wdata->list, wdata_list); 2676 + return 0; 2677 + } 2667 2678 2668 - add_credits_and_wake_if(server, &wdata->credits, 0); 2669 - out: 2679 + /* Roll back credits and retry if needed */ 2680 + add_credits_and_wake_if(server, &wdata->credits, 0); 2681 + } while (rc == -EAGAIN); 2682 + 2683 + fail: 2670 2684 kref_put(&wdata->refcount, cifs_uncached_writedata_release); 2671 - 2672 2685 return rc; 2673 2686 } 2674 2687 ··· 2909 2896 wdata->bytes, &tmp_from, 2910 2897 ctx->cfile, cifs_sb, &tmp_list, 2911 2898 ctx); 2899 + 2900 + kref_put(&wdata->refcount, 2901 + cifs_uncached_writedata_release); 2912 2902 } 2913 2903 2914 2904 list_splice(&tmp_list, &ctx->list); 2915 - 2916 - kref_put(&wdata->refcount, 2917 - cifs_uncached_writedata_release); 2918 2905 goto restart_loop; 2919 2906 } 2920 2907 } ··· 3361 3348 struct TCP_Server_Info *server = 3362 3349 tlink_tcon(rdata->cfile->tlink)->ses->server; 3363 3350 3364 - /* 3365 - * Wait for credits to resend this rdata. 3366 - * Note: we are attempting to resend the whole rdata not in segments 3367 - */ 3368 3351 do { 3369 - rc = server->ops->wait_mtu_credits(server, rdata->bytes, 3352 + if (rdata->cfile->invalidHandle) { 3353 + rc = cifs_reopen_file(rdata->cfile, true); 3354 + if (rc == -EAGAIN) 3355 + continue; 3356 + else if (rc) 3357 + break; 3358 + } 3359 + 3360 + /* 3361 + * Wait for credits to resend this rdata. 3362 + * Note: we are attempting to resend the whole rdata not in 3363 + * segments 3364 + */ 3365 + do { 3366 + rc = server->ops->wait_mtu_credits(server, rdata->bytes, 3370 3367 &rsize, &credits); 3371 3368 3372 - if (rc) 3373 - goto out; 3369 + if (rc) 3370 + goto fail; 3374 3371 3375 - if (rsize < rdata->bytes) { 3376 - add_credits_and_wake_if(server, &credits, 0); 3377 - msleep(1000); 3372 + if (rsize < rdata->bytes) { 3373 + add_credits_and_wake_if(server, &credits, 0); 3374 + msleep(1000); 3375 + } 3376 + } while (rsize < rdata->bytes); 3377 + rdata->credits = credits; 3378 + 3379 + rc = adjust_credits(server, &rdata->credits, rdata->bytes); 3380 + if (!rc) { 3381 + if (rdata->cfile->invalidHandle) 3382 + rc = -EAGAIN; 3383 + else 3384 + rc = server->ops->async_readv(rdata); 3378 3385 } 3379 - } while (rsize < rdata->bytes); 3380 3386 3381 - rdata->credits = credits; 3382 - rc = -EAGAIN; 3383 - while (rc == -EAGAIN) { 3384 - rc = 0; 3385 - if (rdata->cfile->invalidHandle) 3386 - rc = cifs_reopen_file(rdata->cfile, true); 3387 - if (!rc) 3388 - rc = server->ops->async_readv(rdata); 3389 - } 3387 + /* If the read was successfully sent, we are done */ 3388 + if (!rc) { 3389 + /* Add to aio pending list */ 3390 + list_add_tail(&rdata->list, rdata_list); 3391 + return 0; 3392 + } 3390 3393 3391 - if (!rc) { 3392 - /* Add to aio pending list */ 3393 - list_add_tail(&rdata->list, rdata_list); 3394 - return 0; 3395 - } 3394 + /* Roll back credits and retry if needed */ 3395 + add_credits_and_wake_if(server, &rdata->credits, 0); 3396 + } while (rc == -EAGAIN); 3396 3397 3397 - add_credits_and_wake_if(server, &rdata->credits, 0); 3398 - out: 3399 - kref_put(&rdata->refcount, 3400 - cifs_uncached_readdata_release); 3401 - 3398 + fail: 3399 + kref_put(&rdata->refcount, cifs_uncached_readdata_release); 3402 3400 return rc; 3403 3401 } 3404 3402
+2 -1
fs/cifs/smb2maperror.c
··· 1036 1036 {STATUS_UNFINISHED_CONTEXT_DELETED, -EIO, 1037 1037 "STATUS_UNFINISHED_CONTEXT_DELETED"}, 1038 1038 {STATUS_NO_TGT_REPLY, -EIO, "STATUS_NO_TGT_REPLY"}, 1039 - {STATUS_OBJECTID_NOT_FOUND, -EIO, "STATUS_OBJECTID_NOT_FOUND"}, 1039 + /* Note that ENOATTTR and ENODATA are the same errno */ 1040 + {STATUS_OBJECTID_NOT_FOUND, -ENODATA, "STATUS_OBJECTID_NOT_FOUND"}, 1040 1041 {STATUS_NO_IP_ADDRESSES, -EIO, "STATUS_NO_IP_ADDRESSES"}, 1041 1042 {STATUS_WRONG_CREDENTIAL_HANDLE, -EIO, 1042 1043 "STATUS_WRONG_CREDENTIAL_HANDLE"},
+9 -2
fs/cifs/smb2pdu.c
··· 1628 1628 iov[1].iov_base = unc_path; 1629 1629 iov[1].iov_len = unc_path_len; 1630 1630 1631 - /* 3.11 tcon req must be signed if not encrypted. See MS-SMB2 3.2.4.1.1 */ 1631 + /* 1632 + * 3.11 tcon req must be signed if not encrypted. See MS-SMB2 3.2.4.1.1 1633 + * unless it is guest or anonymous user. See MS-SMB2 3.2.5.3.1 1634 + * (Samba servers don't always set the flag so also check if null user) 1635 + */ 1632 1636 if ((ses->server->dialect == SMB311_PROT_ID) && 1633 - !smb3_encryption_required(tcon)) 1637 + !smb3_encryption_required(tcon) && 1638 + !(ses->session_flags & 1639 + (SMB2_SESSION_FLAG_IS_GUEST|SMB2_SESSION_FLAG_IS_NULL)) && 1640 + ((ses->user_name != NULL) || (ses->sectype == Kerberos))) 1634 1641 req->sync_hdr.Flags |= SMB2_FLAGS_SIGNED; 1635 1642 1636 1643 memset(&rqst, 0, sizeof(struct smb_rqst));
+3 -3
fs/cifs/trace.h
··· 549 549 __field(unsigned int, xid) 550 550 __field(__u32, tid) 551 551 __field(__u64, sesid) 552 - __field(const char *, unc_name) 552 + __string(name, unc_name) 553 553 __field(int, rc) 554 554 ), 555 555 TP_fast_assign( 556 556 __entry->xid = xid; 557 557 __entry->tid = tid; 558 558 __entry->sesid = sesid; 559 - __entry->unc_name = unc_name; 559 + __assign_str(name, unc_name); 560 560 __entry->rc = rc; 561 561 ), 562 562 TP_printk("xid=%u sid=0x%llx tid=0x%x unc_name=%s rc=%d", 563 563 __entry->xid, __entry->sesid, __entry->tid, 564 - __entry->unc_name, __entry->rc) 564 + __get_str(name), __entry->rc) 565 565 ) 566 566 567 567 #define DEFINE_SMB3_TCON_EVENT(name) \