Print this page
NEX-1643 dtrace provider for smbsrv
Also illumos 1841:
 DTrace smb provider was mis-implemented, doesn't exist.
Add back handlers for read/write raw, so that
 legacy dtrace consumers can find the probes.
Kill extra arg in smb_negotiate
Fix missing "done" probe with smb_notify
Add example consumer: smb-trace.d
fix soi_pid


 178         { "SmbCreateTemporary", SMB_SDT_OPS(create_temporary),  /* 0x0E 014 */
 179             0x0E, PC_NETWORK_PROGRAM_1_0 },
 180         { "SmbCreateNew", SMB_SDT_OPS(create_new),              /* 0x0F 015 */
 181             0x0F, PC_NETWORK_PROGRAM_1_0 },
 182         { "SmbCheckDirectory", SMB_SDT_OPS(check_directory),    /* 0x10 016 */
 183             0x10, PC_NETWORK_PROGRAM_1_0 },
 184         { "SmbProcessExit", SMB_SDT_OPS(process_exit),          /* 0x11 017 */
 185             0x11, PC_NETWORK_PROGRAM_1_0,
 186             SDDF_SUPPRESS_TID | SDDF_SUPPRESS_UID },
 187         { "SmbSeek", SMB_SDT_OPS(seek),                         /* 0x12 018 */
 188             0x12, PC_NETWORK_PROGRAM_1_0 },
 189         { "SmbLockAndRead", SMB_SDT_OPS(lock_and_read),         /* 0x13 019 */
 190             0x13, LANMAN1_0, SDDF_READOP},
 191         { "SmbWriteAndUnlock", SMB_SDT_OPS(write_and_unlock),   /* 0x14 020 */
 192             0x14, LANMAN1_0, SDDF_WRITEOP },
 193         { "Invalid", SMB_SDT_OPS(invalid), 0x15, 0 },           /* 0x15 021 */
 194         { "Invalid", SMB_SDT_OPS(invalid), 0x16, 0 },           /* 0x16 022 */
 195         { "Invalid", SMB_SDT_OPS(invalid), 0x17, 0 },           /* 0x17 023 */
 196         { "Invalid", SMB_SDT_OPS(invalid), 0x18, 0 },           /* 0x18 024 */
 197         { "Invalid", SMB_SDT_OPS(invalid), 0x19, 0 },           /* 0x19 025 */
 198         { "SmbReadRaw", SMB_SDT_OPS(invalid), 0x1A, 0 },        /* 0x1A 026 */

 199         { "Invalid", SMB_SDT_OPS(invalid), 0x1B, 0 },           /* 0x1B 027 */
 200         { "Invalid", SMB_SDT_OPS(invalid), 0x1C, 0 },           /* 0x1C 028 */
 201         { "SmbWriteRaw", SMB_SDT_OPS(invalid), 0x1D, 0 },       /* 0x1D 029 */

 202         { "Invalid", SMB_SDT_OPS(invalid), 0x1E, 0 },           /* 0x1E 030 */
 203         { "Invalid", SMB_SDT_OPS(invalid), 0x1F, 0 },           /* 0x1F 031 */
 204         { "Invalid", SMB_SDT_OPS(invalid), 0x20, 0 },           /* 0x20 032 */
 205         { "Invalid", SMB_SDT_OPS(invalid), 0x21, 0 },           /* 0x21 033 */
 206         { "SmbSetInformation2", SMB_SDT_OPS(set_information2),  /* 0x22 034 */
 207             0x22, LANMAN1_0 },
 208         { "SmbQueryInformation2",
 209             SMB_SDT_OPS(query_information2),                    /* 0x23 035 */
 210             0x23, LANMAN1_0 },
 211         { "SmbLockingX", SMB_SDT_OPS(locking_andx),             /* 0x24 036 */
 212             0x24, LANMAN1_0 },
 213         { "SmbTransaction", SMB_SDT_OPS(transaction),           /* 0x25 037 */
 214             0x25, LANMAN1_0 },
 215         { "SmbTransactionSecondary",
 216             SMB_SDT_OPS(transaction_secondary),                 /* 0x26 038 */
 217             0x26, LANMAN1_0 },
 218         { "SmbIoctl", SMB_SDT_OPS(ioctl),                       /* 0x27 039 */
 219             0x27, LANMAN1_0 },
 220         { "Invalid", SMB_SDT_OPS(invalid), 0x28, 0 },   /* 0x28 040 */
 221         { "Invalid", SMB_SDT_OPS(invalid), 0x29, 0 },   /* 0x29 041 */


 816                 if (sr->uid_user == NULL) {
 817                         smbsr_error(sr, 0, ERRSRV, ERRbaduid);
 818                         smbsr_cleanup(sr);
 819                         goto report_error;
 820                 }
 821 
 822                 sr->user_cr = smb_user_getcred(sr->uid_user);
 823         }
 824         if (!(sdd->sdt_flags & SDDF_SUPPRESS_TID) && (sr->tid_tree == NULL)) {
 825                 sr->tid_tree = smb_session_lookup_tree(session, sr->smb_tid);
 826                 if (sr->tid_tree == NULL) {
 827                         smbsr_error(sr, 0, ERRSRV, ERRinvnid);
 828                         smbsr_cleanup(sr);
 829                         goto report_error;
 830                 }
 831         }
 832 
 833         sr->sr_time_start = gethrtime();
 834         if ((sdrc = (*sdd->sdt_pre_op)(sr)) == SDRC_SUCCESS)
 835                 sdrc = (*sdd->sdt_function)(sr);
 836 
 837         if (sdrc != SDRC_SR_KEPT) {
 838                 (*sdd->sdt_post_op)(sr);

 839                 smbsr_cleanup(sr);
 840         }
 841 
 842         /* Record latency and rx/tx bytes per:  server, session, share. */
 843         {
 844                 hrtime_t        dt;
 845                 int64_t         rxb, txb;
 846                 smb_disp_stats_t        *client_sds;    /* session */
 847                 smb_disp_stats_t        *share_sds;  /* kshare */
 848                 int     cmd_type;
 849 
 850                 if (sdd->sdt_flags & SDDF_READOP) {
 851                         cmd_type = SMBSRV_CLSH_READ;
 852                 } else if (sdd->sdt_flags & SDDF_WRITEOP) {
 853                         cmd_type = SMBSRV_CLSH_WRITE;
 854                 } else {
 855                         cmd_type = SMBSRV_CLSH_OTHER;
 856                 }
 857 
 858                 dt = gethrtime() - sr->sr_time_start;




 178         { "SmbCreateTemporary", SMB_SDT_OPS(create_temporary),  /* 0x0E 014 */
 179             0x0E, PC_NETWORK_PROGRAM_1_0 },
 180         { "SmbCreateNew", SMB_SDT_OPS(create_new),              /* 0x0F 015 */
 181             0x0F, PC_NETWORK_PROGRAM_1_0 },
 182         { "SmbCheckDirectory", SMB_SDT_OPS(check_directory),    /* 0x10 016 */
 183             0x10, PC_NETWORK_PROGRAM_1_0 },
 184         { "SmbProcessExit", SMB_SDT_OPS(process_exit),          /* 0x11 017 */
 185             0x11, PC_NETWORK_PROGRAM_1_0,
 186             SDDF_SUPPRESS_TID | SDDF_SUPPRESS_UID },
 187         { "SmbSeek", SMB_SDT_OPS(seek),                         /* 0x12 018 */
 188             0x12, PC_NETWORK_PROGRAM_1_0 },
 189         { "SmbLockAndRead", SMB_SDT_OPS(lock_and_read),         /* 0x13 019 */
 190             0x13, LANMAN1_0, SDDF_READOP},
 191         { "SmbWriteAndUnlock", SMB_SDT_OPS(write_and_unlock),   /* 0x14 020 */
 192             0x14, LANMAN1_0, SDDF_WRITEOP },
 193         { "Invalid", SMB_SDT_OPS(invalid), 0x15, 0 },           /* 0x15 021 */
 194         { "Invalid", SMB_SDT_OPS(invalid), 0x16, 0 },           /* 0x16 022 */
 195         { "Invalid", SMB_SDT_OPS(invalid), 0x17, 0 },           /* 0x17 023 */
 196         { "Invalid", SMB_SDT_OPS(invalid), 0x18, 0 },           /* 0x18 024 */
 197         { "Invalid", SMB_SDT_OPS(invalid), 0x19, 0 },           /* 0x19 025 */
 198         { "SmbReadRaw", SMB_SDT_OPS(read_raw),                  /* 0x1A 026 */
 199             0x1A, LANMAN1_0 },
 200         { "Invalid", SMB_SDT_OPS(invalid), 0x1B, 0 },           /* 0x1B 027 */
 201         { "Invalid", SMB_SDT_OPS(invalid), 0x1C, 0 },           /* 0x1C 028 */
 202         { "SmbWriteRaw", SMB_SDT_OPS(write_raw),                /* 0x1D 029 */
 203             0x1D, LANMAN1_0 },
 204         { "Invalid", SMB_SDT_OPS(invalid), 0x1E, 0 },           /* 0x1E 030 */
 205         { "Invalid", SMB_SDT_OPS(invalid), 0x1F, 0 },           /* 0x1F 031 */
 206         { "Invalid", SMB_SDT_OPS(invalid), 0x20, 0 },           /* 0x20 032 */
 207         { "Invalid", SMB_SDT_OPS(invalid), 0x21, 0 },           /* 0x21 033 */
 208         { "SmbSetInformation2", SMB_SDT_OPS(set_information2),  /* 0x22 034 */
 209             0x22, LANMAN1_0 },
 210         { "SmbQueryInformation2",
 211             SMB_SDT_OPS(query_information2),                    /* 0x23 035 */
 212             0x23, LANMAN1_0 },
 213         { "SmbLockingX", SMB_SDT_OPS(locking_andx),             /* 0x24 036 */
 214             0x24, LANMAN1_0 },
 215         { "SmbTransaction", SMB_SDT_OPS(transaction),           /* 0x25 037 */
 216             0x25, LANMAN1_0 },
 217         { "SmbTransactionSecondary",
 218             SMB_SDT_OPS(transaction_secondary),                 /* 0x26 038 */
 219             0x26, LANMAN1_0 },
 220         { "SmbIoctl", SMB_SDT_OPS(ioctl),                       /* 0x27 039 */
 221             0x27, LANMAN1_0 },
 222         { "Invalid", SMB_SDT_OPS(invalid), 0x28, 0 },   /* 0x28 040 */
 223         { "Invalid", SMB_SDT_OPS(invalid), 0x29, 0 },   /* 0x29 041 */


 818                 if (sr->uid_user == NULL) {
 819                         smbsr_error(sr, 0, ERRSRV, ERRbaduid);
 820                         smbsr_cleanup(sr);
 821                         goto report_error;
 822                 }
 823 
 824                 sr->user_cr = smb_user_getcred(sr->uid_user);
 825         }
 826         if (!(sdd->sdt_flags & SDDF_SUPPRESS_TID) && (sr->tid_tree == NULL)) {
 827                 sr->tid_tree = smb_session_lookup_tree(session, sr->smb_tid);
 828                 if (sr->tid_tree == NULL) {
 829                         smbsr_error(sr, 0, ERRSRV, ERRinvnid);
 830                         smbsr_cleanup(sr);
 831                         goto report_error;
 832                 }
 833         }
 834 
 835         sr->sr_time_start = gethrtime();
 836         if ((sdrc = (*sdd->sdt_pre_op)(sr)) == SDRC_SUCCESS)
 837                 sdrc = (*sdd->sdt_function)(sr);


 838         (*sdd->sdt_post_op)(sr);
 839         if (sdrc != SDRC_SR_KEPT) {
 840                 smbsr_cleanup(sr);
 841         }
 842 
 843         /* Record latency and rx/tx bytes per:  server, session, share. */
 844         {
 845                 hrtime_t        dt;
 846                 int64_t         rxb, txb;
 847                 smb_disp_stats_t        *client_sds;    /* session */
 848                 smb_disp_stats_t        *share_sds;  /* kshare */
 849                 int     cmd_type;
 850 
 851                 if (sdd->sdt_flags & SDDF_READOP) {
 852                         cmd_type = SMBSRV_CLSH_READ;
 853                 } else if (sdd->sdt_flags & SDDF_WRITEOP) {
 854                         cmd_type = SMBSRV_CLSH_WRITE;
 855                 } else {
 856                         cmd_type = SMBSRV_CLSH_OTHER;
 857                 }
 858 
 859                 dt = gethrtime() - sr->sr_time_start;