diff options
author | mm <mm@FreeBSD.org> | 2013-04-06 10:39:38 +0000 |
---|---|---|
committer | mm <mm@FreeBSD.org> | 2013-04-06 10:39:38 +0000 |
commit | 696d961cbd8bcba286545fef03c51a896b56d229 (patch) | |
tree | 557b6db8b3be2ff65382b43d2ae9edd99d502a44 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c | |
parent | f25063da0770fd0a9b4ed6ffdd6687e7de116255 (diff) | |
parent | 70e6431e93f13270d6907ce23de3c7da99803278 (diff) | |
download | FreeBSD-src-696d961cbd8bcba286545fef03c51a896b56d229.zip FreeBSD-src-696d961cbd8bcba286545fef03c51a896b56d229.tar.gz |
MFV r248217:
Merge change from vendor to reduce diff only.
ZFS dtrace probes are not supported on FreeBSD yet.
Illumos ZFS issues:
3598 want to dtrace when errors are generated in zfs
MFC after: 3 weeks
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c index 6601736..c155e47 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c @@ -20,7 +20,7 @@ */ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013 by Delphix. All rights reserved. */ /* @@ -303,7 +303,7 @@ zfsctl_common_open(struct vop_open_args *ap) int flags = ap->a_mode; if (flags & FWRITE) - return (EACCES); + return (SET_ERROR(EACCES)); return (0); } @@ -336,11 +336,11 @@ zfsctl_common_access(ap) #ifdef TODO if (flags & V_ACE_MASK) { if (accmode & ACE_ALL_WRITE_PERMS) - return (EACCES); + return (SET_ERROR(EACCES)); } else { #endif if (accmode & VWRITE) - return (EACCES); + return (SET_ERROR(EACCES)); #ifdef TODO } #endif @@ -397,7 +397,15 @@ zfsctl_common_fid(ap) ZFS_ENTER(zfsvfs); +#ifdef illumos + if (fidp->fid_len < SHORT_FID_LEN) { + fidp->fid_len = SHORT_FID_LEN; + ZFS_EXIT(zfsvfs); + return (SET_ERROR(ENOSPC)); + } +#else fidp->fid_len = SHORT_FID_LEN; +#endif zfid = (zfid_short_t *)fidp; @@ -433,7 +441,7 @@ zfsctl_shares_fid(ap) if (zfsvfs->z_shares_dir == 0) { ZFS_EXIT(zfsvfs); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) { @@ -523,7 +531,7 @@ zfsctl_root_lookup(vnode_t *dvp, char *nm, vnode_t **vpp, pathname_t *pnp, * No extended attributes allowed under .zfs */ if (flags & LOOKUP_XATTR) - return (EINVAL); + return (SET_ERROR(EINVAL)); ZFS_ENTER(zfsvfs); @@ -631,10 +639,10 @@ zfsctl_snapshot_zname(vnode_t *vp, const char *name, int len, char *zname) objset_t *os = ((zfsvfs_t *)((vp)->v_vfsp->vfs_data))->z_os; if (snapshot_namecheck(name, NULL, NULL) != 0) - return (EILSEQ); + return (SET_ERROR(EILSEQ)); dmu_objset_name(os, zname); if (strlen(zname) + 1 + strlen(name) >= len) - return (ENAMETOOLONG); + return (SET_ERROR(ENAMETOOLONG)); (void) strcat(zname, "@"); (void) strcat(zname, name); return (0); @@ -776,7 +784,7 @@ zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, * Cannot move snapshots out of the snapdir. */ if (sdvp != tdvp) - return (EINVAL); + return (SET_ERROR(EINVAL)); if (strcmp(snm, tnm) == 0) return (0); @@ -786,7 +794,7 @@ zfsctl_snapdir_rename(vnode_t *sdvp, char *snm, vnode_t *tdvp, char *tnm, search.se_name = (char *)snm; if ((sep = avl_find(&sdp->sd_snaps, &search, &where)) == NULL) { mutex_exit(&sdp->sd_lock); - return (ENOENT); + return (SET_ERROR(ENOENT)); } err = dsl_dataset_rename_snapshot(fsname, snm, tnm, 0); @@ -848,7 +856,7 @@ zfsctl_snapdir_remove(vnode_t *dvp, char *name, vnode_t *cwd, cred_t *cr, else err = dsl_destroy_snapshot(snapname, B_FALSE); } else { - err = ENOENT; + err = SET_ERROR(ENOENT); } mutex_exit(&sdp->sd_lock); @@ -872,7 +880,7 @@ zfsctl_snapdir_mkdir(vnode_t *dvp, char *dirname, vattr_t *vap, vnode_t **vpp, static enum uio_seg seg = UIO_SYSSPACE; if (snapshot_namecheck(dirname, NULL, NULL) != 0) - return (EILSEQ); + return (SET_ERROR(EILSEQ)); dmu_objset_name(zfsvfs->z_os, name); @@ -942,7 +950,7 @@ zfsctl_snapdir_lookup(ap) * No extended attributes allowed under .zfs */ if (flags & LOOKUP_XATTR) - return (EINVAL); + return (SET_ERROR(EINVAL)); ASSERT(ap->a_cnp->cn_namelen < sizeof(nm)); strlcpy(nm, ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen + 1); @@ -957,7 +965,7 @@ zfsctl_snapdir_lookup(ap) * add some flag to domount() to tell it not to do this lookup. */ if (MUTEX_HELD(&sdp->sd_lock)) - return (ENOENT); + return (SET_ERROR(ENOENT)); ZFS_ENTER(zfsvfs); @@ -1031,15 +1039,20 @@ zfsctl_snapdir_lookup(ap) } if (dmu_objset_hold(snapname, FTAG, &snap) != 0) { mutex_exit(&sdp->sd_lock); +#ifdef illumos + ZFS_EXIT(zfsvfs); + return (SET_ERROR(ENOENT)); +#else /* !illumos */ /* Translate errors and add SAVENAME when needed. */ if ((cnp->cn_flags & ISLASTCN) && cnp->cn_nameiop == CREATE) { err = EJUSTRETURN; cnp->cn_flags |= SAVENAME; } else { - err = ENOENT; + err = SET_ERROR(ENOENT); } ZFS_EXIT(zfsvfs); return (err); +#endif /* !illumos */ } sep = kmem_alloc(sizeof (zfs_snapentry_t), KM_SLEEP); @@ -1118,7 +1131,7 @@ zfsctl_shares_lookup(ap) if (zfsvfs->z_shares_dir == 0) { ZFS_EXIT(zfsvfs); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) error = VOP_LOOKUP(ZTOV(dzp), vpp, cnp); @@ -1199,7 +1212,7 @@ zfsctl_shares_readdir(ap) if (zfsvfs->z_shares_dir == 0) { ZFS_EXIT(zfsvfs); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) { vn_lock(ZTOV(dzp), LK_SHARED | LK_RETRY); @@ -1207,7 +1220,7 @@ zfsctl_shares_readdir(ap) VN_URELE(ZTOV(dzp)); } else { *eofp = 1; - error = ENOENT; + error = SET_ERROR(ENOENT); } ZFS_EXIT(zfsvfs); @@ -1276,7 +1289,7 @@ zfsctl_shares_getattr(ap) ZFS_ENTER(zfsvfs); if (zfsvfs->z_shares_dir == 0) { ZFS_EXIT(zfsvfs); - return (ENOTSUP); + return (SET_ERROR(ENOTSUP)); } if ((error = zfs_zget(zfsvfs, zfsvfs->z_shares_dir, &dzp)) == 0) { vn_lock(ZTOV(dzp), LK_SHARED | LK_RETRY); @@ -1668,7 +1681,7 @@ zfsctl_lookup_objset(vfs_t *vfsp, uint64_t objsetid, zfsvfs_t **zfsvfsp) error = traverse(&vp, LK_SHARED | LK_RETRY); if (error == 0) { if (vp == sep->se_root) - error = EINVAL; + error = SET_ERROR(EINVAL); else *zfsvfsp = VTOZ(vp)->z_zfsvfs; } @@ -1678,7 +1691,7 @@ zfsctl_lookup_objset(vfs_t *vfsp, uint64_t objsetid, zfsvfs_t **zfsvfsp) else VN_RELE(vp); } else { - error = EINVAL; + error = SET_ERROR(EINVAL); mutex_exit(&sdp->sd_lock); } |