1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
27 */
28
29 #include <sys/systm.h>
30 #include <sys/cmn_err.h>
31 #include <nfs/nfs.h>
32 #include <nfs/export.h>
33 #include <nfs/nfs4.h>
34 #include <sys/ddi.h>
35 #include <sys/door.h>
36 #include <sys/sdt.h>
37 #include <nfs/nfssys.h>
38
39 void rfs4_init_compound_state(struct compound_state *);
40
41 bitmap4 rfs4_supported_attrs;
42 int MSG_PRT_DEBUG = FALSE;
43
44 /* If building with DEBUG enabled, enable mandattr tunable by default */
45 #ifdef DEBUG
46 #ifndef RFS4_SUPPORT_MANDATTR_ONLY
116 static int rfs4_fattr4_time_access_set();
117 static int rfs4_fattr4_time_backup();
118 static int rfs4_fattr4_time_create();
119 static int rfs4_fattr4_time_delta();
120 static int rfs4_fattr4_time_metadata();
121 static int rfs4_fattr4_time_modify();
122 static int rfs4_fattr4_time_modify_set();
123
124 /*
125 * Initialize the supported attributes
126 */
127 void
128 rfs4_attr_init()
129 {
130 int i;
131 struct nfs4_svgetit_arg sarg;
132 struct compound_state cs;
133 struct statvfs64 sb;
134
135 rfs4_init_compound_state(&cs);
136 cs.vp = rootvp;
137 cs.fh.nfs_fh4_val = NULL;
138 cs.cr = kcred;
139
140 /*
141 * Get all the supported attributes
142 */
143 sarg.op = NFS4ATTR_SUPPORTED;
144 sarg.cs = &cs;
145 sarg.vap->va_mask = AT_ALL;
146 sarg.sbp = &sb;
147 sarg.flag = 0;
148 sarg.rdattr_error = NFS4_OK;
149 sarg.rdattr_error_req = FALSE;
150 sarg.is_referral = B_FALSE;
151
152 rfs4_ntov_init();
153
154 rfs4_supported_attrs = 0;
155 for (i = 0; i < NFS4_MAXNUM_ATTRS; i++) {
156 #ifdef RFS4_SUPPORT_MANDATTR_ONLY
1299 vnode_t *stubvp = NULL, *vp;
1300
1301 vp = sarg->cs->vp;
1302 sarg->mntdfid_set = FALSE;
1303
1304 /* VROOT object, must untraverse */
1305 if (vp->v_flag & VROOT) {
1306
1307 /* extra hold for vp since untraverse might rele */
1308 VN_HOLD(vp);
1309 stubvp = untraverse(vp);
1310
1311 /*
1312 * If vp/stubvp are same, we must be at system
1313 * root because untraverse returned same vp
1314 * for a VROOT object. sarg->vap was setup
1315 * before we got here, so there's no need to do
1316 * another getattr -- just use the one in sarg.
1317 */
1318 if (VN_CMP(vp, stubvp)) {
1319 ASSERT(VN_CMP(vp, rootdir));
1320 vap = sarg->vap;
1321 } else {
1322 va.va_mask = AT_NODEID;
1323 vap = &va;
1324 error = rfs4_vop_getattr(stubvp, vap, 0, sarg->cs->cr);
1325 }
1326
1327 /*
1328 * Done with stub, time to rele. If vp and stubvp
1329 * were the same, then we need to rele either vp or
1330 * stubvp. If they weren't the same, then untraverse()
1331 * already took case of the extra hold on vp, and only
1332 * the stub needs to be rele'd. Both cases are handled
1333 * by unconditionally rele'ing the stub.
1334 */
1335 VN_RELE(stubvp);
1336 } else
1337 vap = sarg->vap;
1338
1339 /*
|
1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 /*
28 * Copyright 2018 Nexenta Systems, Inc.
29 */
30
31 #include <sys/systm.h>
32 #include <sys/cmn_err.h>
33 #include <nfs/nfs.h>
34 #include <nfs/export.h>
35 #include <nfs/nfs4.h>
36 #include <sys/ddi.h>
37 #include <sys/door.h>
38 #include <sys/sdt.h>
39 #include <nfs/nfssys.h>
40
41 void rfs4_init_compound_state(struct compound_state *);
42
43 bitmap4 rfs4_supported_attrs;
44 int MSG_PRT_DEBUG = FALSE;
45
46 /* If building with DEBUG enabled, enable mandattr tunable by default */
47 #ifdef DEBUG
48 #ifndef RFS4_SUPPORT_MANDATTR_ONLY
118 static int rfs4_fattr4_time_access_set();
119 static int rfs4_fattr4_time_backup();
120 static int rfs4_fattr4_time_create();
121 static int rfs4_fattr4_time_delta();
122 static int rfs4_fattr4_time_metadata();
123 static int rfs4_fattr4_time_modify();
124 static int rfs4_fattr4_time_modify_set();
125
126 /*
127 * Initialize the supported attributes
128 */
129 void
130 rfs4_attr_init()
131 {
132 int i;
133 struct nfs4_svgetit_arg sarg;
134 struct compound_state cs;
135 struct statvfs64 sb;
136
137 rfs4_init_compound_state(&cs);
138 cs.vp = ZONE_ROOTVP();
139 cs.fh.nfs_fh4_val = NULL;
140 cs.cr = kcred;
141
142 /*
143 * Get all the supported attributes
144 */
145 sarg.op = NFS4ATTR_SUPPORTED;
146 sarg.cs = &cs;
147 sarg.vap->va_mask = AT_ALL;
148 sarg.sbp = &sb;
149 sarg.flag = 0;
150 sarg.rdattr_error = NFS4_OK;
151 sarg.rdattr_error_req = FALSE;
152 sarg.is_referral = B_FALSE;
153
154 rfs4_ntov_init();
155
156 rfs4_supported_attrs = 0;
157 for (i = 0; i < NFS4_MAXNUM_ATTRS; i++) {
158 #ifdef RFS4_SUPPORT_MANDATTR_ONLY
1301 vnode_t *stubvp = NULL, *vp;
1302
1303 vp = sarg->cs->vp;
1304 sarg->mntdfid_set = FALSE;
1305
1306 /* VROOT object, must untraverse */
1307 if (vp->v_flag & VROOT) {
1308
1309 /* extra hold for vp since untraverse might rele */
1310 VN_HOLD(vp);
1311 stubvp = untraverse(vp);
1312
1313 /*
1314 * If vp/stubvp are same, we must be at system
1315 * root because untraverse returned same vp
1316 * for a VROOT object. sarg->vap was setup
1317 * before we got here, so there's no need to do
1318 * another getattr -- just use the one in sarg.
1319 */
1320 if (VN_CMP(vp, stubvp)) {
1321 ASSERT(VN_CMP(vp, ZONE_ROOTVP()));
1322 vap = sarg->vap;
1323 } else {
1324 va.va_mask = AT_NODEID;
1325 vap = &va;
1326 error = rfs4_vop_getattr(stubvp, vap, 0, sarg->cs->cr);
1327 }
1328
1329 /*
1330 * Done with stub, time to rele. If vp and stubvp
1331 * were the same, then we need to rele either vp or
1332 * stubvp. If they weren't the same, then untraverse()
1333 * already took case of the extra hold on vp, and only
1334 * the stub needs to be rele'd. Both cases are handled
1335 * by unconditionally rele'ing the stub.
1336 */
1337 VN_RELE(stubvp);
1338 } else
1339 vap = sarg->vap;
1340
1341 /*
|