Cleanup ZFS debug infrastructure
[zfs.git] / module / zfs / zfs_ioctl.c
index e378d8e..532f17a 100644 (file)
@@ -119,42 +119,6 @@ static int zfs_fill_zplprops_root(uint64_t, nvlist_t *, nvlist_t *,
     boolean_t *);
 int zfs_set_prop_nvlist(const char *, zprop_source_t, nvlist_t *, nvlist_t **);
 
-/* _NOTE(PRINTFLIKE(4)) - this is printf-like, but lint is too whiney */
-void
-__dprintf(const char *file, const char *func, int line, const char *fmt, ...)
-{
-       const char *newfile;
-       char buf[512];
-       va_list adx;
-
-       /*
-        * Get rid of annoying "../common/" prefix to filename.
-        */
-       newfile = strrchr(file, '/');
-       if (newfile != NULL) {
-               newfile = newfile + 1; /* Get rid of leading / */
-       } else {
-               newfile = file;
-       }
-
-       va_start(adx, fmt);
-       (void) vsnprintf(buf, sizeof (buf), fmt, adx);
-       va_end(adx);
-
-       /*
-        * To get this data, use the zfs-dprintf probe as so:
-        * dtrace -q -n 'zfs-dprintf \
-        *      /stringof(arg0) == "dbuf.c"/ \
-        *      {printf("%s: %s", stringof(arg1), stringof(arg3))}'
-        * arg0 = file name
-        * arg1 = function name
-        * arg2 = line number
-        * arg3 = message
-        */
-       DTRACE_PROBE4(zfs__dprintf,
-           char *, newfile, char *, func, int, line, char *, buf);
-}
-
 static void
 history_str_free(char *buf)
 {
@@ -701,6 +665,9 @@ zfs_secpolicy_destroy(zfs_cmd_t *zc, cred_t *cr)
  * and destroying snapshots requires descendent permissions, a successfull
  * check of the top level snapshot applies to snapshots of all descendent
  * datasets as well.
+ *
+ * The target snapshot may not exist when doing a recursive destroy.
+ * In this case fallback to permissions of the parent dataset.
  */
 static int
 zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, cred_t *cr)
@@ -711,6 +678,8 @@ zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, cred_t *cr)
        dsname = kmem_asprintf("%s@%s", zc->zc_name, zc->zc_value);
 
        error = zfs_secpolicy_destroy_perms(dsname, cr);
+       if (error == ENOENT)
+               error = zfs_secpolicy_destroy_perms(zc->zc_name, cr);
 
        strfree(dsname);
        return (error);
@@ -1108,8 +1077,7 @@ get_zfs_sb(const char *dsname, zfs_sb_t **zsbp)
        mutex_enter(&os->os_user_ptr_lock);
        *zsbp = dmu_objset_get_user(os);
        if (*zsbp && (*zsbp)->z_sb) {
-               if (atomic_inc_not_zero(&((*zsbp)->z_sb->s_active)))
-                       error = ESRCH;
+               atomic_inc(&((*zsbp)->z_sb->s_active));
        } else {
                error = ESRCH;
        }
@@ -2171,7 +2139,8 @@ zfs_prop_set_special(const char *dsname, zprop_source_t source,
                if (err == 0 && intval >= ZPL_VERSION_USERSPACE) {
                        zfs_cmd_t *zc;
 
-                       zc = kmem_zalloc(sizeof (zfs_cmd_t), KM_SLEEP);
+                       zc = kmem_zalloc(sizeof (zfs_cmd_t),
+                           KM_SLEEP | KM_NODEBUG);
                        (void) strcpy(zc->zc_name, dsname);
                        (void) zfs_ioc_userspace_upgrade(zc);
                        kmem_free(zc, sizeof (zfs_cmd_t));