Print this page
NEX-1643 dtrace provider for smbsrv
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-6041 Should pass the smbtorture lock tests
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
re #7815 SMB server delivers old modification time...

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/smbsrv/smb_close.c
          +++ new/usr/src/uts/common/fs/smbsrv/smb_close.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   *
  25      - * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
       25 + * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  26   26   */
  27   27  
  28   28  #include <smbsrv/smb_kproto.h>
  29   29  
  30   30  /*
  31   31   * Close a file by fid.  All locks or other resources held by the
  32   32   * requesting process on the file should be released by the server.
  33   33   * The requesting process can no longer use the fid for further
  34   34   * file access requests.
  35   35   *
↓ open down ↓ 2 lines elided ↑ open up ↑
  38   38   * Failure to set the timestamp, even if requested by the client,
  39   39   * should not result in an error response from the server.
  40   40   */
  41   41  smb_sdrc_t
  42   42  smb_pre_close(smb_request_t *sr)
  43   43  {
  44   44          int rc;
  45   45  
  46   46          rc = smbsr_decode_vwv(sr, "wl", &sr->smb_fid, &sr->arg.timestamp);
  47   47  
  48      -        DTRACE_SMB_1(op__Close__start, smb_request_t *, sr);
       48 +        DTRACE_SMB_START(op__Close, smb_request_t *, sr);
  49   49          return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
  50   50  }
  51   51  
  52   52  void
  53   53  smb_post_close(smb_request_t *sr)
  54   54  {
  55      -        DTRACE_SMB_1(op__Close__done, smb_request_t *, sr);
       55 +        DTRACE_SMB_DONE(op__Close, smb_request_t *, sr);
  56   56  }
  57   57  
  58   58  smb_sdrc_t
  59   59  smb_com_close(smb_request_t *sr)
  60   60  {
  61   61          int32_t mtime;
  62   62  
  63   63          smbsr_lookup_file(sr);
  64   64          if (sr->fid_ofile == NULL) {
  65   65                  smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid);
↓ open down ↓ 13 lines elided ↑ open up ↑
  79   79   * Close the file represented by fid and then disconnect the
  80   80   * associated tree.
  81   81   */
  82   82  smb_sdrc_t
  83   83  smb_pre_close_and_tree_disconnect(smb_request_t *sr)
  84   84  {
  85   85          int rc;
  86   86  
  87   87          rc = smbsr_decode_vwv(sr, "wl", &sr->smb_fid, &sr->arg.timestamp);
  88   88  
  89      -        DTRACE_SMB_1(op__CloseAndTreeDisconnect__start, smb_request_t *, sr);
       89 +        DTRACE_SMB_START(op__CloseAndTreeDisconnect, smb_request_t *, sr);
  90   90          return ((rc == 0) ? SDRC_SUCCESS : SDRC_ERROR);
  91   91  }
  92   92  
  93   93  void
  94   94  smb_post_close_and_tree_disconnect(smb_request_t *sr)
  95   95  {
  96      -        DTRACE_SMB_1(op__CloseAndTreeDisconnect__done, smb_request_t *, sr);
       96 +        DTRACE_SMB_DONE(op__CloseAndTreeDisconnect, smb_request_t *, sr);
  97   97  }
  98   98  
  99   99  smb_sdrc_t
 100  100  smb_com_close_and_tree_disconnect(smb_request_t *sr)
 101  101  {
 102  102          int32_t mtime;
 103  103  
 104  104          smbsr_lookup_file(sr);
 105  105          if (sr->fid_ofile == NULL) {
 106  106                  smbsr_error(sr, NT_STATUS_INVALID_HANDLE, ERRDOS, ERRbadfid);
 107  107                  return (SDRC_ERROR);
 108  108          }
 109  109  
 110  110          mtime = smb_time_local_to_gmt(sr, sr->arg.timestamp);
 111  111          smb_ofile_close(sr->fid_ofile, mtime);
 112      -        smb_session_cancel_requests(sr->session, sr->tid_tree, sr);
      112 +
 113  113          smb_tree_disconnect(sr->tid_tree, B_TRUE);
      114 +        smb_session_cancel_requests(sr->session, sr->tid_tree, sr);
 114  115  
 115  116          if (smbsr_encode_empty_result(sr) != 0)
 116  117                  return (SDRC_ERROR);
 117  118  
 118  119          return (SDRC_SUCCESS);
 119  120  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX