Print this page
NEX-18748 (Hyper-V 2016) VM goes to poweroff state when smbd is restarted
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Joyce McIntosh <joyce.mcintosh@nexenta.com>
NEX-1643 dtrace provider for smbsrv
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
SMB-122 smbd core dumps in smbd_dc_update / smb_log
SMB-117 Win7 fails to open security properties
SMB-11 SMB2 message parse & dispatch
SMB-12 SMB2 Negotiate Protocol
SMB-13 SMB2 Session Setup
SMB-14 SMB2 Logoff
SMB-15 SMB2 Tree Connect
SMB-16 SMB2 Tree Disconnect
SMB-17 SMB2 Create
SMB-18 SMB2 Close
SMB-19 SMB2 Flush
SMB-20 SMB2 Read
SMB-21 SMB2 Write
SMB-22 SMB2 Lock/Unlock
SMB-23 SMB2 Ioctl
SMB-24 SMB2 Cancel
SMB-25 SMB2 Echo
SMB-26 SMB2 Query Dir
SMB-27 SMB2 Change Notify
SMB-28 SMB2 Query Info
SMB-29 SMB2 Set Info
SMB-30 SMB2 Oplocks
SMB-53 SMB2 Create Context options
(SMB2 code review cleanup 1, 2, 3)
| Split |
Close |
| Expand all |
| Collapse all |
--- old/usr/src/uts/common/fs/smbsrv/smb2_close.c
+++ new/usr/src/uts/common/fs/smbsrv/smb2_close.c
1 1 /*
2 2 * This file and its contents are supplied under the terms of the
|
↓ open down ↓ |
2 lines elided |
↑ open up ↑ |
3 3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 4 * You may only use this file in accordance with the terms of version
5 5 * 1.0 of the CDDL.
6 6 *
7 7 * A full copy of the text of the CDDL should have accompanied this
8 8 * source. A copy of the CDDL is also available via the Internet at
9 9 * http://www.illumos.org/license/CDDL.
10 10 */
11 11
12 12 /*
13 - * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
13 + * Copyright 2018 Nexenta Systems, Inc. All rights reserved.
14 14 */
15 15
16 16 /*
17 17 * Dispatch function for SMB2_CLOSE
18 18 */
19 19
20 20 #include <smbsrv/smb2_kproto.h>
21 21
22 22 smb_sdrc_t
23 23 smb2_close(smb_request_t *sr)
24 24 {
25 25 smb_attr_t attr;
26 26 smb_ofile_t *of;
27 27 uint16_t StructSize;
28 28 uint16_t Flags;
29 29 uint32_t reserved;
30 30 smb2fid_t smb2fid;
31 31 uint32_t status;
32 32 int rc = 0;
33 33
34 34 /*
35 35 * SMB2 Close request
36 36 */
37 37 rc = smb_mbc_decodef(
38 38 &sr->smb_data, "wwlqq",
|
↓ open down ↓ |
15 lines elided |
↑ open up ↑ |
39 39 &StructSize, /* w */
40 40 &Flags, /* w */
41 41 &reserved, /* l */
42 42 &smb2fid.persistent, /* q */
43 43 &smb2fid.temporal); /* q */
44 44 if (rc)
45 45 return (SDRC_ERROR);
46 46 if (StructSize != 24)
47 47 return (SDRC_ERROR);
48 48
49 + /*
50 + * Want FID lookup before the start probe.
51 + */
49 52 status = smb2sr_lookup_fid(sr, &smb2fid);
50 - if (status) {
51 - smb2sr_put_error(sr, status);
52 - return (SDRC_SUCCESS);
53 - }
54 53 of = sr->fid_ofile;
55 54
55 + DTRACE_SMB2_START(op__Close, smb_request_t *, sr);
56 +
57 + if (status)
58 + goto errout; /* Bad FID */
59 +
56 60 bzero(&attr, sizeof (attr));
57 61 if (Flags & SMB2_CLOSE_FLAG_POSTQUERY_ATTRIB) {
58 62 attr.sa_mask = SMB_AT_ALL;
59 63 status = smb2_ofile_getattr(sr, of, &attr);
60 64 if (status) {
61 65 /*
62 66 * We could not stat the open file.
63 67 * Let's not fail the close call,
64 68 * but just turn off the flag.
65 69 */
66 70 Flags = 0;
67 71 }
68 72 }
69 73
74 + if (of->dh_persist)
75 + smb2_dh_setdoc_persistent(of);
70 76 smb_ofile_close(of, 0);
71 77
78 +errout:
79 + sr->smb2_status = status;
80 + DTRACE_SMB2_DONE(op__Close, smb_request_t *, sr);
81 +
82 + if (status) {
83 + smb2sr_put_error(sr, status);
84 + return (SDRC_SUCCESS);
85 + }
86 +
72 87 /*
73 88 * SMB2 Close reply
74 89 */
75 90 (void) smb_mbc_encodef(
76 91 &sr->reply,
77 92 "wwlTTTTqql",
78 93 60, /* StructSize */ /* w */
79 94 Flags, /* w */
80 95 0, /* reserved */ /* l */
81 96 &attr.sa_crtime, /* T */
82 97 &attr.sa_vattr.va_atime, /* T */
83 98 &attr.sa_vattr.va_mtime, /* T */
84 99 &attr.sa_vattr.va_ctime, /* T */
85 100 attr.sa_allocsz, /* q */
86 101 attr.sa_vattr.va_size, /* q */
87 102 attr.sa_dosattr); /* l */
88 103
89 104 return (SDRC_SUCCESS);
90 105 }
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX