Skip to content

Commit

Permalink
NEX-3095 Issues related to NFS nohide
Browse files Browse the repository at this point in the history
Reviewed by: Dan Fields <dan.fields@nexenta.com>
  • Loading branch information
mtelka committed Feb 2, 2015
1 parent 9fee6c7 commit 41bdbba
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 34 deletions.
27 changes: 7 additions & 20 deletions usr/src/uts/common/fs/nfs/nfs3_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
*
* CDDL HEADER END
*/

/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/

/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
Expand Down Expand Up @@ -379,10 +380,6 @@ rfs3_lookup(LOOKUP3args *args, LOOKUP3res *resp, struct exportinfo *exi,

dvap = NULL;

/*
* The passed argument exportinfo is released by the
* caller, common_dispatch
*/
if (exi != NULL)
exi_hold(exi);

Expand Down Expand Up @@ -454,10 +451,12 @@ rfs3_lookup(LOOKUP3args *args, LOOKUP3res *resp, struct exportinfo *exi,
*/
if (PUBLIC_FH3(&args->what.dir)) {
publicfh_flag = TRUE;

exi_rele(exi);

error = rfs_publicfh_mclookup(name, dvp, cr, &vp,
&exi, &sec);
if (error && exi != NULL)
exi_rele(exi); /* See comment below Re: publicfh_flag */

/*
* Since WebNFS may bypass MOUNT, we need to ensure this
* request didn't come from an unlabeled admin_low client.
Expand All @@ -479,8 +478,6 @@ rfs3_lookup(LOOKUP3args *args, LOOKUP3res *resp, struct exportinfo *exi,
if (tp == NULL || tp->tpc_tp.tp_doi !=
l_admin_low->tsl_doi || tp->tpc_tp.host_type !=
SUN_CIPSO) {
if (exi != NULL)
exi_rele(exi);
VN_RELE(vp);
resp->status = NFS3ERR_ACCES;
error = 1;
Expand Down Expand Up @@ -512,8 +509,6 @@ rfs3_lookup(LOOKUP3args *args, LOOKUP3res *resp, struct exportinfo *exi,
if (!blequal(&l_admin_low->tsl_label, clabel)) {
if (!do_rfs_label_check(clabel, dvp,
DOMINANCE_CHECK, exi)) {
if (publicfh_flag && exi != NULL)
exi_rele(exi);
VN_RELE(vp);
resp->status = NFS3ERR_ACCES;
error = 1;
Expand All @@ -535,15 +530,6 @@ rfs3_lookup(LOOKUP3args *args, LOOKUP3res *resp, struct exportinfo *exi,
auth_weak = TRUE;
}

/*
* If publicfh_flag is true then we have called rfs_publicfh_mclookup
* and have obtained a new exportinfo in exi which needs to be
* released. Note that the original exportinfo pointed to by exi
* will be released by the caller, common_dispatch.
*/
if (publicfh_flag)
exi_rele(exi);

if (error) {
VN_RELE(vp);
goto out;
Expand All @@ -552,6 +538,7 @@ rfs3_lookup(LOOKUP3args *args, LOOKUP3res *resp, struct exportinfo *exi,
va.va_mask = AT_ALL;
vap = rfs4_delegated_getattr(vp, &va, 0, cr) ? NULL : &va;

exi_rele(exi);
VN_RELE(vp);

resp->status = NFS3_OK;
Expand Down
26 changes: 12 additions & 14 deletions usr/src/uts/common/fs/nfs/nfs_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
*
* CDDL HEADER END
*/

/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/

/*
Expand Down Expand Up @@ -333,17 +334,14 @@ int
rfs_cross_mnt(vnode_t **vpp, struct exportinfo **exip)
{
struct exportinfo *exi;
vnode_t *vp;
vnode_t *vp = *vpp;
fid_t fid;
int error;

vp = *vpp;

/* traverse() releases argument in success */
VN_HOLD(*vpp);
VN_HOLD(vp);

if ((error = traverse(&vp)) != 0) {
VN_RELE(*vpp);
VN_RELE(vp);
return (error);
}

Expand All @@ -362,6 +360,8 @@ rfs_cross_mnt(vnode_t **vpp, struct exportinfo **exip)
* It is not error, just subdir is not exported
* or "nohide" is not set
*/
if (exi != NULL)
exi_rele(exi);
VN_RELE(vp);
} else {
/* go to submount */
Expand All @@ -371,6 +371,7 @@ rfs_cross_mnt(vnode_t **vpp, struct exportinfo **exip)
VN_RELE(*vpp);
*vpp = vp;
}

return (0);
}

Expand Down Expand Up @@ -498,6 +499,9 @@ rfs_lookup(struct nfsdiropargs *da, struct nfsdiropres *dr,
*/
if (PUBLIC_FH2(fhp)) {
publicfh_flag = TRUE;

exi_rele(exi);

error = rfs_publicfh_mclookup(name, dvp, cr, &vp, &exi,
&sec);
} else {
Expand Down Expand Up @@ -545,13 +549,7 @@ rfs_lookup(struct nfsdiropargs *da, struct nfsdiropres *dr,
out:
VN_RELE(dvp);

/*
* If publicfh_flag is true then we have called rfs_publicfh_mclookup
* and have obtained a new exportinfo in exi which needs to be
* released. Note the the original exportinfo pointed to by exi
* will be released by the caller, comon_dispatch.
*/
if (publicfh_flag && exi != NULL)
if (exi != NULL)
exi_rele(exi);

/*
Expand Down

0 comments on commit 41bdbba

Please sign in to comment.