Print this page
Hyperaggressive asserts pt 2/N
Be far more judicious in the use of curzone-using macros.
@@ -951,11 +951,11 @@
static nfsstat4
do_rfs4_op_secinfo(struct compound_state *cs, char *nm, SECINFO4res *resp)
{
int error, different_export = 0;
vnode_t *dvp, *vp;
- struct exportinfo *exi = NULL;
+ struct exportinfo *exi;
fid_t fid;
uint_t count, i;
secinfo4 *resok_val;
struct secinfo *secp;
seconfig_t *si;
@@ -962,24 +962,26 @@
bool_t did_traverse = FALSE;
int dotdot, walk;
nfs_export_t *ne = nfs_get_export();
dvp = cs->vp;
+ exi = cs->exi;
+ ASSERT(exi != NULL);
dotdot = (nm[0] == '.' && nm[1] == '.' && nm[2] == '\0');
/*
* If dotdotting, then need to check whether it's above the
* root of a filesystem, or above an export point.
*/
if (dotdot) {
-
+ ASSERT3U(exi->exi_zoneid, ==, curzone->zone_id);
/*
* If dotdotting at the root of a filesystem, then
* need to traverse back to the mounted-on filesystem
* and do the dotdot lookup there.
*/
- if ((cs->vp->v_flag & VROOT) || VN_IS_CURZONEROOT(cs->vp)) {
+ if ((dvp->v_flag & VROOT) || VN_IS_CURZONEROOT(dvp)) {
/*
* If at the system root, then can
* go up no further.
*/
@@ -987,11 +989,11 @@
return (puterrno4(ENOENT));
/*
* Traverse back to the mounted-on filesystem
*/
- dvp = untraverse(cs->vp);
+ dvp = untraverse(dvp);
/*
* Set the different_export flag so we remember
* to pick up a new exportinfo entry for
* this new filesystem.
@@ -1001,11 +1003,11 @@
/*
* If dotdotting above an export point then set
* the different_export to get new export info.
*/
- different_export = nfs_exported(cs->exi, cs->vp);
+ different_export = nfs_exported(exi, dvp);
}
}
/*
* Get the vnode for the component "nm".
@@ -1020,13 +1022,13 @@
* used in the request is valid but not an explicitly shared flavor,
* or the access bit indicates that this is a limited access,
* check whether this vnode is visible.
*/
if (!different_export &&
- (PSEUDO(cs->exi) || ! is_exported_sec(cs->nfsflavor, cs->exi) ||
+ (PSEUDO(exi) || !is_exported_sec(cs->nfsflavor, exi) ||
cs->access & CS_ACCESS_LIMITED)) {
- if (! nfs_visible(cs->exi, vp, &different_export)) {
+ if (! nfs_visible(exi, vp, &different_export)) {
VN_RELE(vp);
return (puterrno4(ENOENT));
}
}
@@ -1064,10 +1066,11 @@
if (error) {
VN_RELE(vp);
return (puterrno4(error));
}
+ /* We'll need to reassign "exi". */
if (dotdot)
exi = nfs_vptoexi(NULL, vp, cs->cr, &walk, NULL, TRUE);
else
exi = checkexport4(&vp->v_vfsp->vfs_fsid, &fid, vp);
@@ -1084,12 +1087,10 @@
} else {
VN_RELE(vp);
return (puterrno4(EACCES));
}
}
- } else {
- exi = cs->exi;
}
ASSERT(exi != NULL);
/*
@@ -2716,11 +2717,12 @@
* If dotdotting, then need to check whether it's
* above the root of a filesystem, or above an
* export point.
*/
if (dotdot) {
-
+ ASSERT(cs->exi != NULL);
+ ASSERT3U(cs->exi->exi_zoneid, ==, curzone->zone_id);
/*
* If dotdotting at the root of a filesystem, then
* need to traverse back to the mounted-on filesystem
* and do the dotdot lookup there.
*/