OpenZFS 6093 - zfsctl_shares_lookup

6093 zfsctl_shares_lookup should only VN_RELE() on zfs_zget() success

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>

OpenZFS-issue: https://www.illumos.org/issues/6093
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/0f92170
Closes #4630

This function was always implemented slightly differently under Linux
and therefore never suffered from this issue.  The patch has been
updated and applied as cleanup in order to minimize differences with
the upstream OpenZFS code.
This commit is contained in:
Dan McDonald 2016-05-11 12:03:51 -07:00 committed by Brian Behlendorf
parent c15706490e
commit 8adb798aa5
1 changed files with 4 additions and 8 deletions

View File

@ -28,6 +28,7 @@
* Rohan Puri <rohan.puri15@gmail.com>
* Brian Behlendorf <behlendorf1@llnl.gov>
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
*/
/*
@ -1245,21 +1246,16 @@ zfsctl_shares_lookup(struct inode *dip, char *name, struct inode **ipp,
return (SET_ERROR(ENOTSUP));
}
error = zfs_zget(zsb, zsb->z_shares_dir, &dzp);
if (error) {
ZFS_EXIT(zsb);
return (error);
if ((error = zfs_zget(zsb, zsb->z_shares_dir, &dzp)) == 0) {
error = zfs_lookup(ZTOI(dzp), name, &ip, 0, cr, NULL, NULL);
iput(ZTOI(dzp));
}
error = zfs_lookup(ZTOI(dzp), name, &ip, 0, cr, NULL, NULL);
iput(ZTOI(dzp));
ZFS_EXIT(zsb);
return (error);
}
/*
* Initialize the various pieces we'll need to create and manipulate .zfs
* directories. Currently this is unused but available.