X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=module%2Fzfs%2Fzfs_dir.c;h=6cd9c8508a1ec0e1f29c4a8215c65c6fb2736de4;hb=ebe7e575eae1e03b1faa545a424f008faeac589d;hp=47550ec63915107587f6baef82b44ac5dfecb414;hpb=2cf7f52bc42f215d4ef27d0fd75fc1b1417cb841;p=zfs.git diff --git a/module/zfs/zfs_dir.c b/module/zfs/zfs_dir.c index 47550ec..6cd9c85 100644 --- a/module/zfs/zfs_dir.c +++ b/module/zfs/zfs_dir.c @@ -50,6 +50,7 @@ #include #include #include +#include #include #include #include @@ -64,11 +65,11 @@ static int zfs_match_find(zfs_sb_t *zsb, znode_t *dzp, char *name, boolean_t exact, boolean_t update, int *deflags, pathname_t *rpnp, uint64_t *zoid) { + boolean_t conflict = B_FALSE; int error; if (zsb->z_norm) { matchtype_t mt = MT_FIRST; - boolean_t conflict = B_FALSE; size_t bufsz = 0; char *buf = NULL; @@ -84,11 +85,23 @@ zfs_match_find(zfs_sb_t *zsb, znode_t *dzp, char *name, boolean_t exact, */ error = zap_lookup_norm(zsb->z_os, dzp->z_id, name, 8, 1, zoid, mt, buf, bufsz, &conflict); - if (!error && deflags) - *deflags = conflict ? ED_CASE_CONFLICT : 0; } else { error = zap_lookup(zsb->z_os, dzp->z_id, name, 8, 1, zoid); } + + /* + * Allow multiple entries provided the first entry is + * the object id. Non-zpl consumers may safely make + * use of the additional space. + * + * XXX: This should be a feature flag for compatibility + */ + if (error == EOVERFLOW) + error = 0; + + if (zsb->z_norm && !error && deflags) + *deflags = conflict ? ED_CASE_CONFLICT : 0; + *zoid = ZFS_DIRENT_OBJ(*zoid); #ifdef HAVE_DNLC @@ -403,28 +416,24 @@ zfs_dirlook(znode_t *dzp, char *name, struct inode **ipp, int flags, /* * If we are a snapshot mounted under .zfs, return - * the vp for the snapshot directory. + * the inode pointer for the snapshot directory. */ if ((error = sa_lookup(dzp->z_sa_hdl, SA_ZPL_PARENT(zsb), &parent, sizeof (parent))) != 0) return (error); -#ifdef HAVE_SNAPSHOT + if (parent == dzp->z_id && zsb->z_parent != zsb) { error = zfsctl_root_lookup(zsb->z_parent->z_ctldir, - "snapshot", ipp, NULL, 0, NULL, kcred, - NULL, NULL, NULL); + "snapshot", ipp, 0, kcred, NULL, NULL); return (error); } -#endif /* HAVE_SNAPSHOT */ rw_enter(&dzp->z_parent_lock, RW_READER); error = zfs_zget(zsb, parent, &zp); if (error == 0) *ipp = ZTOI(zp); rw_exit(&dzp->z_parent_lock); -#ifdef HAVE_SNAPSHOT } else if (zfs_has_ctldir(dzp) && strcmp(name, ZFS_CTLDIR_NAME) == 0) { *ipp = zfsctl_root(dzp); -#endif /* HAVE_SNAPSHOT */ } else { int zf;