Add -p switch to "zpool get"
[zfs.git] / module / zfs / zfs_dir.c
index 8f1a0c2..4a4969f 100644 (file)
@@ -50,6 +50,7 @@
 #include <sys/zap.h>
 #include <sys/dmu.h>
 #include <sys/atomic.h>
+#include <sys/zfs_ctldir.h>
 #include <sys/zfs_fuid.h>
 #include <sys/sa.h>
 #include <sys/zfs_sa.h>
@@ -415,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;
 
@@ -565,7 +562,7 @@ zfs_unlinked_drain(zfs_sb_t *zsb)
        int             error;
 
        /*
-        * Interate over the contents of the unlinked set.
+        * Iterate over the contents of the unlinked set.
         */
        for (zap_cursor_init(&zc, zsb->z_os, zsb->z_unlinkedobj);
            zap_cursor_retrieve(&zc, &zap) == 0;
@@ -840,8 +837,8 @@ zfs_dropname(zfs_dirlock_t *dl, znode_t *zp, znode_t *dzp, dmu_tx_t *tx,
 }
 
 /*
- * Unlink zp from dl, and mark zp for deletion if this was the last link.
- * Can fail if zp is a mount point (EBUSY) or a non-empty directory (EEXIST).
+ * Unlink zp from dl, and mark zp for deletion if this was the last link. Can
+ * fail if zp is a mount point (EBUSY) or a non-empty directory (ENOTEMPTY).
  * If 'unlinkedp' is NULL, we put unlinked znodes on the unlinked list.
  * If it's non-NULL, we use it to indicate whether the znode needs deletion,
  * and it's the caller's job to do it.
@@ -868,7 +865,7 @@ zfs_link_destroy(zfs_dirlock_t *dl, znode_t *zp, dmu_tx_t *tx, int flag,
 
                if (zp_is_dir && !zfs_dirempty(zp)) {
                        mutex_exit(&zp->z_lock);
-                       return (EEXIST);
+                       return (ENOTEMPTY);
                }
 
                /*