Deleted Added
full compact
zfs_ctldir.c (197515) zfs_ctldir.c (209962)
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

--- 5 unchanged lines hidden (view full) ---

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/*
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

--- 5 unchanged lines hidden (view full) ---

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 2008 Sun Microsystems, Inc. All rights reserved.
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
23 * Use is subject to license terms.
24 */
25
26#pragma ident "%Z%%M% %I% %E% SMI"
27
28/*
29 * ZFS control directory (a.k.a. ".zfs")
30 *
31 * This directory provides a common location for all ZFS meta-objects.
32 * Currently, this is only the 'snapshot' directory, but this may expand in the
33 * future. The elements are built using the GFS primitives, as the hierarchy
34 * does not actually exist on disk.
35 *

--- 75 unchanged lines hidden (view full) ---

111 return (1);
112 else
113 return (0);
114}
115
116static struct vop_vector zfsctl_ops_root;
117static struct vop_vector zfsctl_ops_snapdir;
118static struct vop_vector zfsctl_ops_snapshot;
26/*
27 * ZFS control directory (a.k.a. ".zfs")
28 *
29 * This directory provides a common location for all ZFS meta-objects.
30 * Currently, this is only the 'snapshot' directory, but this may expand in the
31 * future. The elements are built using the GFS primitives, as the hierarchy
32 * does not actually exist on disk.
33 *

--- 75 unchanged lines hidden (view full) ---

109 return (1);
110 else
111 return (0);
112}
113
114static struct vop_vector zfsctl_ops_root;
115static struct vop_vector zfsctl_ops_snapdir;
116static struct vop_vector zfsctl_ops_snapshot;
117static struct vop_vector zfsctl_ops_shares;
118static struct vop_vector zfsctl_ops_shares_dir;
119
120static vnode_t *zfsctl_mknode_snapdir(vnode_t *);
119
120static vnode_t *zfsctl_mknode_snapdir(vnode_t *);
121static vnode_t *zfsctl_mknode_shares(vnode_t *);
121static vnode_t *zfsctl_snapshot_mknode(vnode_t *, uint64_t objset);
122static int zfsctl_unmount_snap(zfs_snapentry_t *, int, cred_t *);
123
124/*
122static vnode_t *zfsctl_snapshot_mknode(vnode_t *, uint64_t objset);
123static int zfsctl_unmount_snap(zfs_snapentry_t *, int, cred_t *);
124
125/*
125 * Root directory elements. We have only a single static entry, 'snapshot'.
126 * Root directory elements. We only have two entries
127 * snapshot and shares.
126 */
127static gfs_dirent_t zfsctl_root_entries[] = {
128 { "snapshot", zfsctl_mknode_snapdir, GFS_CACHE_VNODE },
128 */
129static gfs_dirent_t zfsctl_root_entries[] = {
130 { "snapshot", zfsctl_mknode_snapdir, GFS_CACHE_VNODE },
131 { "shares", zfsctl_mknode_shares, GFS_CACHE_VNODE },
129 { NULL }
130};
131
132/* include . and .. in the calculation */
133#define NROOT_ENTRIES ((sizeof (zfsctl_root_entries) / \
134 sizeof (gfs_dirent_t)) + 1)
135
136

--- 8 unchanged lines hidden (view full) ---

145}
146
147void
148zfsctl_fini(void)
149{
150}
151
152/*
132 { NULL }
133};
134
135/* include . and .. in the calculation */
136#define NROOT_ENTRIES ((sizeof (zfsctl_root_entries) / \
137 sizeof (gfs_dirent_t)) + 1)
138
139

--- 8 unchanged lines hidden (view full) ---

148}
149
150void
151zfsctl_fini(void)
152{
153}
154
155/*
153 * Return the inode number associated with the 'snapshot' directory.
156 * Return the inode number associated with the 'snapshot' or
157 * 'shares' directory.
154 */
155/* ARGSUSED */
156static ino64_t
157zfsctl_root_inode_cb(vnode_t *vp, int index)
158{
158 */
159/* ARGSUSED */
160static ino64_t
161zfsctl_root_inode_cb(vnode_t *vp, int index)
162{
159 ASSERT(index == 0);
160 return (ZFSCTL_INO_SNAPDIR);
163 zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
164
165 ASSERT(index <= 2);
166
167 if (index == 0)
168 return (ZFSCTL_INO_SNAPDIR);
169
170 return (zfsvfs->z_shares_dir);
161}
162
163/*
164 * Create the '.zfs' directory. This directory is cached as part of the VFS
165 * structure. This results in a hold on the vfs_t. The code in zfs_umount()
166 * therefore checks against a vfs_count of 2 instead of 1. This reference
167 * is removed when the ctldir is destroyed in the unmount.
168 */

--- 86 unchanged lines hidden (view full) ---

255 struct vnode *a_vp;
256 int a_accmode;
257 struct ucred *a_cred;
258 struct thread *a_td;
259 } */ *ap;
260{
261 int mode = ap->a_accmode;
262
171}
172
173/*
174 * Create the '.zfs' directory. This directory is cached as part of the VFS
175 * structure. This results in a hold on the vfs_t. The code in zfs_umount()
176 * therefore checks against a vfs_count of 2 instead of 1. This reference
177 * is removed when the ctldir is destroyed in the unmount.
178 */

--- 86 unchanged lines hidden (view full) ---

265 struct vnode *a_vp;
266 int a_accmode;
267 struct ucred *a_cred;
268 struct thread *a_td;
269 } */ *ap;
270{
271 int mode = ap->a_accmode;
272
273#ifdef TODO
274 if (flags & V_ACE_MASK) {
275 if (accmode & ACE_ALL_WRITE_PERMS)
276 return (EACCES);
277 } else {
278#endif
263 if (mode & VWRITE)
264 return (EACCES);
279 if (mode & VWRITE)
280 return (EACCES);
281#ifdef TODO
282 }
283#endif
265
266 return (0);
267}
268
269/*
270 * Common getattr function. Fill in basic information.
271 */
272static void

--- 56 unchanged lines hidden (view full) ---

329 /* .zfs znodes always have a generation number of 0 */
330 for (i = 0; i < sizeof (zfid->zf_gen); i++)
331 zfid->zf_gen[i] = 0;
332
333 ZFS_EXIT(zfsvfs);
334 return (0);
335}
336
284
285 return (0);
286}
287
288/*
289 * Common getattr function. Fill in basic information.
290 */
291static void

--- 56 unchanged lines hidden (view full) ---

348 /* .zfs znodes always have a generation number of 0 */
349 for (i = 0; i < sizeof (zfid->zf_gen); i++)
350 zfid->zf_gen[i] = 0;
351
352 ZFS_EXIT(zfsvfs);
353 return (0);
354}
355
356/*ARGSUSED*/
337static int
357static int
358zfsctl_shares_fid(ap)
359 struct vop_fid_args /* {
360 struct vnode *a_vp;
361 struct fid *a_fid;
362 } */ *ap;
363{
364 vnode_t *vp = ap->a_vp;
365 fid_t *fidp = (void *)ap->a_fid;
366 zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
367 znode_t *dzp;
368 int error;
369
370 ZFS_ENTER(zfsvfs);
371
372 if (zfsvfs->z_shares_dir == 0) {
373 ZFS_EXIT(zfsvfs);
374 return (ENOTSUP);
375 }
376
377 if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
378 error = VOP_FID(ZTOV(dzp), fidp);
379 VN_RELE(ZTOV(dzp));
380 }
381
382 ZFS_EXIT(zfsvfs);
383 return (error);
384}
385
386static int
338zfsctl_common_reclaim(ap)
339 struct vop_reclaim_args /* {
340 struct vnode *a_vp;
341 struct thread *a_td;
342 } */ *ap;
343{
344 vnode_t *vp = ap->a_vp;
345

--- 43 unchanged lines hidden (view full) ---

389 vap->va_nlink = vap->va_size = NROOT_ENTRIES;
390
391 zfsctl_common_getattr(vp, vap);
392 ZFS_EXIT(zfsvfs);
393
394 return (0);
395}
396
387zfsctl_common_reclaim(ap)
388 struct vop_reclaim_args /* {
389 struct vnode *a_vp;
390 struct thread *a_td;
391 } */ *ap;
392{
393 vnode_t *vp = ap->a_vp;
394

--- 43 unchanged lines hidden (view full) ---

438 vap->va_nlink = vap->va_size = NROOT_ENTRIES;
439
440 zfsctl_common_getattr(vp, vap);
441 ZFS_EXIT(zfsvfs);
442
443 return (0);
444}
445
446#ifdef sun
447static int
448zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
449 caller_context_t *ct)
450{
451 /*
452 * We only care about ACL_ENABLED so that libsec can
453 * display ACL correctly and not default to POSIX draft.
454 */
455 if (cmd == _PC_ACL_ENABLED) {
456 *valp = _ACL_ACE_ENABLED;
457 return (0);
458 }
459
460 return (fs_pathconf(vp, cmd, valp, cr, ct));
461}
462#endif /* sun */
463
464#ifdef sun
465static const fs_operation_def_t zfsctl_tops_root[] = {
466 { VOPNAME_OPEN, { .vop_open = zfsctl_common_open } },
467 { VOPNAME_CLOSE, { .vop_close = zfsctl_common_close } },
468 { VOPNAME_IOCTL, { .error = fs_inval } },
469 { VOPNAME_GETATTR, { .vop_getattr = zfsctl_root_getattr } },
470 { VOPNAME_ACCESS, { .vop_access = zfsctl_common_access } },
471 { VOPNAME_READDIR, { .vop_readdir = gfs_vop_readdir } },
472 { VOPNAME_LOOKUP, { .vop_lookup = zfsctl_root_lookup } },
473 { VOPNAME_SEEK, { .vop_seek = fs_seek } },
474 { VOPNAME_INACTIVE, { .vop_inactive = gfs_vop_inactive } },
475 { VOPNAME_PATHCONF, { .vop_pathconf = zfsctl_pathconf } },
476 { VOPNAME_FID, { .vop_fid = zfsctl_common_fid } },
477 { NULL }
478};
479#endif /* sun */
480
397/*
398 * Special case the handling of "..".
399 */
400/* ARGSUSED */
401int
402zfsctl_root_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,
403 int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct,
404 int *direntflags, pathname_t *realpnp)

--- 302 unchanged lines hidden (view full) ---

707
708 *vpp = NULL;
709
710 err = zfs_secpolicy_snapshot_perms(name, cr);
711 if (err)
712 return (err);
713
714 if (err == 0) {
481/*
482 * Special case the handling of "..".
483 */
484/* ARGSUSED */
485int
486zfsctl_root_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp,
487 int flags, vnode_t *rdir, cred_t *cr, caller_context_t *ct,
488 int *direntflags, pathname_t *realpnp)

--- 302 unchanged lines hidden (view full) ---

791
792 *vpp = NULL;
793
794 err = zfs_secpolicy_snapshot_perms(name, cr);
795 if (err)
796 return (err);
797
798 if (err == 0) {
715 err = dmu_objset_snapshot(name, dirname, B_FALSE);
799 err = dmu_objset_snapshot(name, dirname, NULL, B_FALSE);
716 if (err)
717 return (err);
718 err = lookupnameat(dirname, seg, follow, NULL, vpp, dvp);
719 }
720
721 return (err);
722}
723

--- 48 unchanged lines hidden (view full) ---

772 */
773 if (flags & LOOKUP_XATTR)
774 return (EINVAL);
775 ASSERT(ap->a_cnp->cn_namelen < sizeof(nm));
776 strlcpy(nm, ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen + 1);
777
778 ASSERT(dvp->v_type == VDIR);
779
800 if (err)
801 return (err);
802 err = lookupnameat(dirname, seg, follow, NULL, vpp, dvp);
803 }
804
805 return (err);
806}
807

--- 48 unchanged lines hidden (view full) ---

856 */
857 if (flags & LOOKUP_XATTR)
858 return (EINVAL);
859 ASSERT(ap->a_cnp->cn_namelen < sizeof(nm));
860 strlcpy(nm, ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen + 1);
861
862 ASSERT(dvp->v_type == VDIR);
863
780 if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0)
781 return (0);
782
783 *vpp = NULL;
784
785 /*
786 * If we get a recursive call, that means we got called
787 * from the domount() code while it was trying to look up the
788 * spec (which looks like a local path for zfs). We need to
789 * add some flag to domount() to tell it not to do this lookup.
790 */
791 if (MUTEX_HELD(&sdp->sd_lock))
792 return (ENOENT);
793
794 ZFS_ENTER(zfsvfs);
795
864 *vpp = NULL;
865
866 /*
867 * If we get a recursive call, that means we got called
868 * from the domount() code while it was trying to look up the
869 * spec (which looks like a local path for zfs). We need to
870 * add some flag to domount() to tell it not to do this lookup.
871 */
872 if (MUTEX_HELD(&sdp->sd_lock))
873 return (ENOENT);
874
875 ZFS_ENTER(zfsvfs);
876
877 if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) {
878 ZFS_EXIT(zfsvfs);
879 return (0);
880 }
881
796 if (flags & FIGNORECASE) {
797 boolean_t conflict = B_FALSE;
798
799 err = dmu_snapshot_realname(zfsvfs->z_os, nm, real,
800 MAXNAMELEN, &conflict);
801 if (err == 0) {
802 strlcpy(nm, real, sizeof(nm));
803 } else if (err != ENOTSUP) {

--- 95 unchanged lines hidden (view full) ---

899 mutex_exit(&sdp->sd_lock);
900 ZFS_EXIT(zfsvfs);
901 if (err != 0)
902 *vpp = NULL;
903 return (err);
904}
905
906/* ARGSUSED */
882 if (flags & FIGNORECASE) {
883 boolean_t conflict = B_FALSE;
884
885 err = dmu_snapshot_realname(zfsvfs->z_os, nm, real,
886 MAXNAMELEN, &conflict);
887 if (err == 0) {
888 strlcpy(nm, real, sizeof(nm));
889 } else if (err != ENOTSUP) {

--- 95 unchanged lines hidden (view full) ---

985 mutex_exit(&sdp->sd_lock);
986 ZFS_EXIT(zfsvfs);
987 if (err != 0)
988 *vpp = NULL;
989 return (err);
990}
991
992/* ARGSUSED */
993int
994zfsctl_shares_lookup(ap)
995 struct vop_lookup_args /* {
996 struct vnode *a_dvp;
997 struct vnode **a_vpp;
998 struct componentname *a_cnp;
999 } */ *ap;
1000{
1001 vnode_t *dvp = ap->a_dvp;
1002 vnode_t **vpp = ap->a_vpp;
1003 struct componentname *cnp = ap->a_cnp;
1004 zfsvfs_t *zfsvfs = dvp->v_vfsp->vfs_data;
1005 char nm[NAME_MAX + 1];
1006 znode_t *dzp;
1007 int error;
1008
1009 ZFS_ENTER(zfsvfs);
1010
1011 ASSERT(cnp->cn_namelen < sizeof(nm));
1012 strlcpy(nm, cnp->cn_nameptr, cnp->cn_namelen + 1);
1013
1014 if (gfs_lookup_dot(vpp, dvp, zfsvfs->z_ctldir, nm) == 0) {
1015 ZFS_EXIT(zfsvfs);
1016 return (0);
1017 }
1018
1019 if (zfsvfs->z_shares_dir == 0) {
1020 ZFS_EXIT(zfsvfs);
1021 return (ENOTSUP);
1022 }
1023 if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0)
1024 error = VOP_LOOKUP(ZTOV(dzp), vpp, cnp);
1025
1026 VN_RELE(ZTOV(dzp));
1027 ZFS_EXIT(zfsvfs);
1028
1029 return (error);
1030}
1031
1032/* ARGSUSED */
907static int
908zfsctl_snapdir_readdir_cb(vnode_t *vp, void *dp, int *eofp,
909 offset_t *offp, offset_t *nextp, void *data, int flags)
910{
911 zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
912 char snapname[MAXNAMELEN];
913 uint64_t id, cookie;
914 boolean_t case_conflict;

--- 27 unchanged lines hidden (view full) ---

942 }
943 *nextp = cookie;
944
945 ZFS_EXIT(zfsvfs);
946
947 return (0);
948}
949
1033static int
1034zfsctl_snapdir_readdir_cb(vnode_t *vp, void *dp, int *eofp,
1035 offset_t *offp, offset_t *nextp, void *data, int flags)
1036{
1037 zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
1038 char snapname[MAXNAMELEN];
1039 uint64_t id, cookie;
1040 boolean_t case_conflict;

--- 27 unchanged lines hidden (view full) ---

1068 }
1069 *nextp = cookie;
1070
1071 ZFS_EXIT(zfsvfs);
1072
1073 return (0);
1074}
1075
1076/* ARGSUSED */
1077static int
1078zfsctl_shares_readdir(ap)
1079 struct vop_readdir_args /* {
1080 struct vnode *a_vp;
1081 struct uio *a_uio;
1082 struct ucred *a_cred;
1083 int *a_eofflag;
1084 int *a_ncookies;
1085 u_long **a_cookies;
1086 } */ *ap;
1087{
1088 vnode_t *vp = ap->a_vp;
1089 uio_t *uiop = ap->a_uio;
1090 cred_t *cr = ap->a_cred;
1091 int *eofp = ap->a_eofflag;
1092 zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
1093 znode_t *dzp;
1094 int error;
1095
1096 ZFS_ENTER(zfsvfs);
1097
1098 if (zfsvfs->z_shares_dir == 0) {
1099 ZFS_EXIT(zfsvfs);
1100 return (ENOTSUP);
1101 }
1102 if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
1103 error = VOP_READDIR(ZTOV(dzp), uiop, cr, eofp, ap->a_ncookies, ap->a_cookies);
1104 VN_RELE(ZTOV(dzp));
1105 } else {
1106 *eofp = 1;
1107 error = ENOENT;
1108 }
1109
1110 ZFS_EXIT(zfsvfs);
1111 return (error);
1112}
1113
950/*
951 * pvp is the '.zfs' directory (zfsctl_node_t).
952 * Creates vp, which is '.zfs/snapshot' (zfsctl_snapdir_t).
953 *
954 * This function is the callback to create a GFS vnode for '.zfs/snapshot'
955 * when a lookup is performed on .zfs for "snapshot".
956 */
957vnode_t *

--- 10 unchanged lines hidden (view full) ---

968 sdp->sd_node.zc_cmtime = ((zfsctl_node_t *)pvp->v_data)->zc_cmtime;
969 mutex_init(&sdp->sd_lock, NULL, MUTEX_DEFAULT, NULL);
970 avl_create(&sdp->sd_snaps, snapentry_compare,
971 sizeof (zfs_snapentry_t), offsetof(zfs_snapentry_t, se_node));
972 VOP_UNLOCK(vp, 0);
973 return (vp);
974}
975
1114/*
1115 * pvp is the '.zfs' directory (zfsctl_node_t).
1116 * Creates vp, which is '.zfs/snapshot' (zfsctl_snapdir_t).
1117 *
1118 * This function is the callback to create a GFS vnode for '.zfs/snapshot'
1119 * when a lookup is performed on .zfs for "snapshot".
1120 */
1121vnode_t *

--- 10 unchanged lines hidden (view full) ---

1132 sdp->sd_node.zc_cmtime = ((zfsctl_node_t *)pvp->v_data)->zc_cmtime;
1133 mutex_init(&sdp->sd_lock, NULL, MUTEX_DEFAULT, NULL);
1134 avl_create(&sdp->sd_snaps, snapentry_compare,
1135 sizeof (zfs_snapentry_t), offsetof(zfs_snapentry_t, se_node));
1136 VOP_UNLOCK(vp, 0);
1137 return (vp);
1138}
1139
1140vnode_t *
1141zfsctl_mknode_shares(vnode_t *pvp)
1142{
1143 vnode_t *vp;
1144 zfsctl_node_t *sdp;
1145
1146 vp = gfs_dir_create(sizeof (zfsctl_node_t), pvp, pvp->v_vfsp,
1147 &zfsctl_ops_shares, NULL, NULL, MAXNAMELEN,
1148 NULL, NULL);
1149 sdp = vp->v_data;
1150 sdp->zc_cmtime = ((zfsctl_node_t *)pvp->v_data)->zc_cmtime;
1151 return (vp);
1152
1153}
1154
976/* ARGSUSED */
977static int
1155/* ARGSUSED */
1156static int
1157zfsctl_shares_getattr(ap)
1158 struct vop_getattr_args /* {
1159 struct vnode *a_vp;
1160 struct vattr *a_vap;
1161 struct ucred *a_cred;
1162 struct thread *a_td;
1163 } */ *ap;
1164{
1165 vnode_t *vp = ap->a_vp;
1166 vattr_t *vap = ap->a_vap;
1167 cred_t *cr = ap->a_cred;
1168 zfsvfs_t *zfsvfs = vp->v_vfsp->vfs_data;
1169 znode_t *dzp;
1170 int error;
1171
1172 ZFS_ENTER(zfsvfs);
1173 if (zfsvfs->z_shares_dir == 0) {
1174 ZFS_EXIT(zfsvfs);
1175 return (ENOTSUP);
1176 }
1177 if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) {
1178 error = VOP_GETATTR(ZTOV(dzp), vap, cr);
1179 VN_RELE(ZTOV(dzp));
1180 }
1181 ZFS_EXIT(zfsvfs);
1182 return (error);
1183}
1184
1185/* ARGSUSED */
1186static int
978zfsctl_snapdir_getattr(ap)
979 struct vop_getattr_args /* {
980 struct vnode *a_vp;
981 struct vattr *a_vap;
982 struct ucred *a_cred;
983 struct thread *a_td;
984 } */ *ap;
985{

--- 70 unchanged lines hidden (view full) ---

1056 vnode_t *vp;
1057 zfsctl_node_t *zcp;
1058
1059 vp = gfs_dir_create(sizeof (zfsctl_node_t), pvp, pvp->v_vfsp,
1060 &zfsctl_ops_snapshot, NULL, NULL, MAXNAMELEN, NULL, NULL);
1061 VN_HOLD(vp);
1062 zcp = vp->v_data;
1063 zcp->zc_id = objset;
1187zfsctl_snapdir_getattr(ap)
1188 struct vop_getattr_args /* {
1189 struct vnode *a_vp;
1190 struct vattr *a_vap;
1191 struct ucred *a_cred;
1192 struct thread *a_td;
1193 } */ *ap;
1194{

--- 70 unchanged lines hidden (view full) ---

1265 vnode_t *vp;
1266 zfsctl_node_t *zcp;
1267
1268 vp = gfs_dir_create(sizeof (zfsctl_node_t), pvp, pvp->v_vfsp,
1269 &zfsctl_ops_snapshot, NULL, NULL, MAXNAMELEN, NULL, NULL);
1270 VN_HOLD(vp);
1271 zcp = vp->v_data;
1272 zcp->zc_id = objset;
1064 VFS_HOLD(vp->v_vfsp);
1065 VOP_UNLOCK(vp, 0);
1066
1067 return (vp);
1068}
1069
1070static int
1071zfsctl_snapshot_inactive(ap)
1072 struct vop_inactive_args /* {

--- 34 unchanged lines hidden (view full) ---

1107 sep = next;
1108 }
1109 ASSERT(sep != NULL);
1110
1111 if (!locked)
1112 mutex_exit(&sdp->sd_lock);
1113 VN_RELE(dvp);
1114end:
1273 VOP_UNLOCK(vp, 0);
1274
1275 return (vp);
1276}
1277
1278static int
1279zfsctl_snapshot_inactive(ap)
1280 struct vop_inactive_args /* {

--- 34 unchanged lines hidden (view full) ---

1315 sep = next;
1316 }
1317 ASSERT(sep != NULL);
1318
1319 if (!locked)
1320 mutex_exit(&sdp->sd_lock);
1321 VN_RELE(dvp);
1322end:
1115 VFS_RELE(vp->v_vfsp);
1116
1117 /*
1118 * Dispose of the vnode for the snapshot mount point.
1119 * This is safe to do because once this entry has been removed
1120 * from the AVL tree, it can't be found again, so cannot become
1121 * "active". If we lookup the same name again we will end up
1122 * creating a new vnode.
1123 */

--- 261 unchanged lines hidden ---
1323
1324 /*
1325 * Dispose of the vnode for the snapshot mount point.
1326 * This is safe to do because once this entry has been removed
1327 * from the AVL tree, it can't be found again, so cannot become
1328 * "active". If we lookup the same name again we will end up
1329 * creating a new vnode.
1330 */

--- 261 unchanged lines hidden ---