svn commit: r297133 - stable/10/sys/kern

2016-03-20 Thread Konstantin Belousov
Author: kib
Date: Mon Mar 21 03:29:45 2016
New Revision: 297133
URL: https://svnweb.freebsd.org/changeset/base/297133

Log:
  MFC r296467:
  Convert all panics from the link_elf_obj kernel linker for object
  files format into printfs and errors to caller.

Modified:
  stable/10/sys/kern/link_elf_obj.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/link_elf_obj.c
==
--- stable/10/sys/kern/link_elf_obj.c   Mon Mar 21 03:16:56 2016
(r297132)
+++ stable/10/sys/kern/link_elf_obj.c   Mon Mar 21 03:29:45 2016
(r297133)
@@ -140,7 +140,7 @@ static int  link_elf_each_function_name(l
 static int link_elf_each_function_nameval(linker_file_t,
linker_function_nameval_callback_t,
void *);
-static voidlink_elf_reloc_local(linker_file_t);
+static int link_elf_reloc_local(linker_file_t);
 static longlink_elf_symtab_get(linker_file_t, const Elf_Sym **);
 static longlink_elf_strtab_get(linker_file_t, caddr_t *);
 
@@ -401,15 +401,26 @@ link_elf_link_preload(linker_class_t cls
break;
}
}
-   if (pb != ef->nprogtab)
-   panic("lost progbits");
-   if (rl != ef->nreltab)
-   panic("lost reltab");
-   if (ra != ef->nrelatab)
-   panic("lost relatab");
+   if (pb != ef->nprogtab) {
+   printf("%s: lost progbits\n", filename);
+   error = ENOEXEC;
+   goto out;
+   }
+   if (rl != ef->nreltab) {
+   printf("%s: lost reltab\n", filename);
+   error = ENOEXEC;
+   goto out;
+   }
+   if (ra != ef->nrelatab) {
+   printf("%s: lost relatab\n", filename);
+   error = ENOEXEC;
+   goto out;
+   }
 
/* Local intra-module relocations */
-   link_elf_reloc_local(lf);
+   error = link_elf_reloc_local(lf);
+   if (error != 0)
+   goto out;
 
*result = lf;
return (0);
@@ -612,8 +623,11 @@ link_elf_load_file(linker_class_t cls, c
ef->relatab = malloc(ef->nrelatab * sizeof(*ef->relatab),
M_LINKER, M_WAITOK | M_ZERO);
 
-   if (symtabindex == -1)
-   panic("lost symbol table index");
+   if (symtabindex == -1) {
+   link_elf_error(filename, "lost symbol table index");
+   error = ENOEXEC;
+   goto out;
+   }
/* Allocate space for and load the symbol table */
ef->ddbsymcnt = shdr[symtabindex].sh_size / sizeof(Elf_Sym);
ef->ddbsymtab = malloc(shdr[symtabindex].sh_size, M_LINKER, M_WAITOK);
@@ -628,8 +642,11 @@ link_elf_load_file(linker_class_t cls, c
goto out;
}
 
-   if (symstrindex == -1)
-   panic("lost symbol string index");
+   if (symstrindex == -1) {
+   link_elf_error(filename, "lost symbol string index");
+   error = ENOEXEC;
+   goto out;
+   }
/* Allocate space for and load the symbol strings */
ef->ddbstrcnt = shdr[symstrindex].sh_size;
ef->ddbstrtab = malloc(shdr[symstrindex].sh_size, M_LINKER, M_WAITOK);
@@ -858,19 +875,35 @@ link_elf_load_file(linker_class_t cls, c
break;
}
}
-   if (pb != ef->nprogtab)
-   panic("lost progbits");
-   if (rl != ef->nreltab)
-   panic("lost reltab");
-   if (ra != ef->nrelatab)
-   panic("lost relatab");
-   if (mapbase != (vm_offset_t)ef->address + mapsize)
-   panic("mapbase 0x%lx != address %p + mapsize 0x%lx (0x%lx)\n",
+   if (pb != ef->nprogtab) {
+   link_elf_error(filename, "lost progbits");
+   error = ENOEXEC;
+   goto out;
+   }
+   if (rl != ef->nreltab) {
+   link_elf_error(filename, "lost reltab");
+   error = ENOEXEC;
+   goto out;
+   }
+   if (ra != ef->nrelatab) {
+   link_elf_error(filename, "lost relatab");
+   error = ENOEXEC;
+   goto out;
+   }
+   if (mapbase != (vm_offset_t)ef->address + mapsize) {
+   printf(
+   "%s: mapbase 0x%lx != address %p + mapsize 0x%lx (0x%lx)\n",
+   filename != NULL ? filename : "",
(u_long)mapbase, ef->address, (u_long)mapsize,
(u_long)(vm_offset_t)ef->address + mapsize);
+   error = ENOMEM;
+   goto out;
+   }
 
/* Local intra-module relocations */
-   link_elf_reloc_local(lf);
+   error = link_elf_reloc_local(lf);
+   if (error != 0)
+   goto out;
 
/* Pull in dependencies */
VOP_UNLOCK(nd.ni_vp, 0);
@@ -1005,12 +1038,16 @@ 

svn commit: r297129 - stable/10/cddl/contrib/opensolaris/lib/libdtrace/common

2016-03-20 Thread Pedro F. Giffuni
Author: pfg
Date: Mon Mar 21 01:14:32 2016
New Revision: 297129
URL: https://svnweb.freebsd.org/changeset/base/297129

Log:
  MFC r296816:
  
  libdtrace: use calloc(3) instead of malloc(3) when it makes sense.
  
  calloc(3) is faster and occasionally safer than malloc(3) + bzero(3).
  
  In one case, pointed out by Mark[1], this also cleans up a calculation.
  
  Reviewed by:  markj [1]

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c Mon Mar 
21 00:59:30 2016(r297128)
+++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c Mon Mar 
21 01:14:32 2016(r297129)
@@ -24,6 +24,7 @@
  */
 /*
  * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ * Copyright (c) 2016, Pedro Giffuni.  All rights reserved.
  */
 
 #include 
@@ -704,22 +705,20 @@ dt_module_load_proc(dtrace_hdl_t *dtp, d
return (dt_set_errno(dtp, EDT_CANTLOAD));
}
 
-   dmp->dm_libctfp = malloc(sizeof (ctf_file_t *) * arg.dpa_count);
+   dmp->dm_libctfp = calloc(arg.dpa_count, sizeof (ctf_file_t *));
if (dmp->dm_libctfp == NULL) {
dt_proc_unlock(dtp, p);
dt_proc_release(dtp, p);
return (dt_set_errno(dtp, EDT_NOMEM));
}
-   bzero(dmp->dm_libctfp, sizeof (ctf_file_t *) * arg.dpa_count);
 
-   dmp->dm_libctfn = malloc(sizeof (char *) * arg.dpa_count);
+   dmp->dm_libctfn = calloc(arg.dpa_count, sizeof (char *));
if (dmp->dm_libctfn == NULL) {
free(dmp->dm_libctfp);
dt_proc_unlock(dtp, p);
dt_proc_release(dtp, p);
return (dt_set_errno(dtp, EDT_NOMEM));
}
-   bzero(dmp->dm_libctfn, sizeof (char *) * arg.dpa_count);
 
dmp->dm_nctflibs = arg.dpa_count;
 
@@ -800,17 +799,14 @@ dt_module_load(dtrace_hdl_t *dtp, dt_mod
dmp->dm_nsymbuckets = _dtrace_strbuckets;
dmp->dm_symfree = 1;/* first free element is index 1 */
 
-   dmp->dm_symbuckets = malloc(sizeof (uint_t) * dmp->dm_nsymbuckets);
-   dmp->dm_symchains = malloc(sizeof (dt_sym_t) * dmp->dm_nsymelems + 1);
+   dmp->dm_symbuckets = calloc(dmp->dm_nsymbuckets, sizeof (uint_t));
+   dmp->dm_symchains = calloc(dmp->dm_nsymelems + 1, sizeof (dt_sym_t));
 
if (dmp->dm_symbuckets == NULL || dmp->dm_symchains == NULL) {
dt_module_unload(dtp, dmp);
return (dt_set_errno(dtp, EDT_NOMEM));
}
 
-   bzero(dmp->dm_symbuckets, sizeof (uint_t) * dmp->dm_nsymbuckets);
-   bzero(dmp->dm_symchains, sizeof (dt_sym_t) * dmp->dm_nsymelems + 1);
-
/*
 * Iterate over the symbol table data buffer and insert each symbol
 * name into the name hash if the name and type are valid.  Then

Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c Mon Mar 
21 00:59:30 2016(r297128)
+++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_regset.c Mon Mar 
21 01:14:32 2016(r297129)
@@ -27,6 +27,7 @@
 
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2016 Pedro Giffuni.  All rights reserved.
  */
 
 #include 
@@ -47,15 +48,15 @@ dt_regset_create(ulong_t nregs)
if (drp == NULL)
return (NULL);
 
-   drp->dr_bitmap = malloc(sizeof (ulong_t) * n);
-   drp->dr_size = nregs;
+   drp->dr_bitmap = calloc(n, sizeof (ulong_t));
 
if (drp->dr_bitmap == NULL) {
dt_regset_destroy(drp);
return (NULL);
}
 
-   bzero(drp->dr_bitmap, sizeof (ulong_t) * n);
+   drp->dr_size = nregs;
+
return (drp);
 }
 

Modified: stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c Mon Mar 
21 00:59:30 2016(r297128)
+++ stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_strtab.c Mon Mar 
21 01:14:32 2016(r297129)
@@ -24,6 +24,10 @@
  * Use is subject to license terms.
  */
 
+/*
+ * Portions Copyright 2016 Pedro Giffuni.  All rights reserved.
+ */
+ 
 #pragma ident  "%Z%%M% %I% %E% SMI"
 
 #include 
@@ -70,12 +74,11 @@ dt_strtab_create(size_t bufsz)
return (NULL);
 
bzero(sp, sizeof (dt_strtab_t));
-   sp->str_hash = malloc(nbuckets * 

svn commit: r297125 - stable/10/sys/dev/mrsas

2016-03-20 Thread Steven Hartland
Author: smh
Date: Mon Mar 21 00:31:06 2016
New Revision: 297125
URL: https://svnweb.freebsd.org/changeset/base/297125

Log:
  MFC r296020:
  
  Fix NULL pointer dereferences
  
  Sponsored by: Multiplay

Modified:
  stable/10/sys/dev/mrsas/mrsas.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/mrsas/mrsas.c
==
--- stable/10/sys/dev/mrsas/mrsas.c Mon Mar 21 00:29:45 2016
(r297124)
+++ stable/10/sys/dev/mrsas/mrsas.c Mon Mar 21 00:31:06 2016
(r297125)
@@ -1272,14 +1272,12 @@ mrsas_get_softc_instance(struct cdev *de
 * Application
 */
sc = mrsas_mgmt_info.sc_ptr[user_ioc->host_no];
-   if ((user_ioc->host_no >= mrsas_mgmt_info.max_index) || (sc == 
NULL)) {
-   if (sc == NULL)
-   mrsas_dprint(sc, MRSAS_FAULT,
-   "There is no Controller number %d .\n", 
user_ioc->host_no);
-   else
-   mrsas_dprint(sc, MRSAS_FAULT,
-   "Invalid Controller number %d .\n", 
user_ioc->host_no);
-   }
+   if (sc == NULL)
+   printf("There is no Controller number %d\n",
+   user_ioc->host_no);
+   else if (user_ioc->host_no >= mrsas_mgmt_info.max_index)
+   mrsas_dprint(sc, MRSAS_FAULT,
+   "Invalid Controller number %d\n", 
user_ioc->host_no);
}
 
return sc;
@@ -4018,8 +4016,8 @@ mrsas_aen_handler(struct mrsas_softc *sc
u_int32_t seq_num;
int error;
 
-   if (!sc) {
-   device_printf(sc->mrsas_dev, "invalid instance!\n");
+   if (sc == NULL) {
+   printf("invalid instance!\n");
return;
}
if (sc->evt_detail_mem) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297123 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:29:00 2016
New Revision: 297123
URL: https://svnweb.freebsd.org/changeset/base/297123

Log:
  MFC r296615: Make ZFS ignore stripe sizes above SPA_MAXASHIFT (8KB).
  
  If device has stripe size bigger then maximal sector size supported by
  ZFS, there is nothing can be done to avoid read-modify-write cycles.
  Taking that stripe size into account will only reduce space efficiency
  and pointlessly bother user with warnings that can not be fixed.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Mon Mar 21 00:28:13 2016(r297122)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Mon Mar 21 00:29:00 2016(r297123)
@@ -803,7 +803,7 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi
*logical_ashift = highbit(MAX(pp->sectorsize, SPA_MINBLOCKSIZE)) - 1;
*physical_ashift = 0;
if (pp->stripesize > (1 << *logical_ashift) && ISP2(pp->stripesize) &&
-   pp->stripeoffset == 0)
+   pp->stripesize <= (1 << SPA_MAXASHIFT) && pp->stripeoffset == 0)
*physical_ashift = highbit(pp->stripesize) - 1;
 
/*
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297121 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:27:00 2016
New Revision: 297121
URL: https://svnweb.freebsd.org/changeset/base/297121

Log:
  MFC r296541: MFV r296540: 4448 zfs diff misprints unicode characters
  
  Reviewed by: Igor Kozhukhov 
  Reviewed by: Toomas Soome 
  Approved by: Matthew Ahrens 
  Author: Joshua M. Clulow 
  
  illumos/illumos-gate@b211eb9181f99c20acbf4c528f94cb44b4ca8c31

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c  Mon Mar 
21 00:26:14 2016(r297120)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c  Mon Mar 
21 00:27:00 2016(r297121)
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2016 Joyent, Inc.
  */
 
 /*
@@ -136,12 +137,13 @@ get_stats_for_obj(differ_info_t *di, con
 static void
 stream_bytes(FILE *fp, const char *string)
 {
-   while (*string) {
-   if (*string > ' ' && *string != '\\' && *string < '\177')
-   (void) fprintf(fp, "%c", *string++);
-   else {
-   (void) fprintf(fp, "\\%03hho",
-   (unsigned char)*string++);
+   char c;
+
+   while ((c = *string++) != '\0') {
+   if (c > ' ' && c != '\\' && c < '\177') {
+   (void) fprintf(fp, "%c", c);
+   } else {
+   (void) fprintf(fp, "\\%03o", (uint8_t)c);
}
}
 }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297120 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:26:14 2016
New Revision: 297120
URL: https://svnweb.freebsd.org/changeset/base/297120

Log:
  MFC r296539: MFV r296538:
  6544 incorrect comment in libzfs.h about offline status
  
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Gerhard Roethlin 
  
  illumos/illumos-gate@cb605c4d8ab24b5a900b8b4ca85db65c22d05fad

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Mon Mar 
21 00:25:26 2016(r297119)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h   Mon Mar 
21 00:26:14 2016(r297120)
@@ -327,7 +327,7 @@ typedef enum {
ZPOOL_STATUS_VERSION_OLDER, /* older legacy on-disk version */
ZPOOL_STATUS_FEAT_DISABLED, /* supported features are disabled */
ZPOOL_STATUS_RESILVERING,   /* device being resilvered */
-   ZPOOL_STATUS_OFFLINE_DEV,   /* device online */
+   ZPOOL_STATUS_OFFLINE_DEV,   /* device offline */
ZPOOL_STATUS_REMOVED_DEV,   /* removed device */
ZPOOL_STATUS_NON_NATIVE_ASHIFT, /* (e.g. 512e dev with ashift of 9) */
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297116 - in stable/10/sys/cddl: compat/opensolaris/sys contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:22:55 2016
New Revision: 297116
URL: https://svnweb.freebsd.org/changeset/base/297116

Log:
  MFC r296530: MFV r296529:
  6672 arc_reclaim_thread() should use gethrtime() instead of ddi_get_lbolt()
  6673 want a macro to convert seconds to nanoseconds and vice-versa
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Prakash Surya 
  Reviewed by: Josef 'Jeff' Sipek 
  Reviewed by: Robert Mustacchi 
  Approved by: Dan McDonald 
  Author: Eli Rosenthal 
  
  illumos/illumos-gate@a8f6344fa0921599e1f4511e41b5f9a25c38c0f9

Modified:
  stable/10/sys/cddl/compat/opensolaris/sys/time.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/compat/opensolaris/sys/time.h
==
--- stable/10/sys/cddl/compat/opensolaris/sys/time.hMon Mar 21 00:22:09 
2016(r297115)
+++ stable/10/sys/cddl/compat/opensolaris/sys/time.hMon Mar 21 00:22:55 
2016(r297116)
@@ -40,6 +40,9 @@
 #defineMSEC2NSEC(m)((hrtime_t)(m) * (NANOSEC / MILLISEC))
 #defineNSEC2MSEC(n)((n) / (NANOSEC / MILLISEC))
 
+#defineNSEC2SEC(n) ((n) / (NANOSEC / SEC))
+#defineSEC2NSEC(m) ((hrtime_t)(m) * (NANOSEC / SEC))
+
 typedef longlong_t hrtime_t;
 
 #if defined(__i386__) || defined(__powerpc__)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Mon Mar 
21 00:22:09 2016(r297115)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Mon Mar 
21 00:22:55 2016(r297116)
@@ -3609,7 +3609,7 @@ arc_kmem_reap_now(void)
 static void
 arc_reclaim_thread(void *dummy __unused)
 {
-   clock_t growtime = 0;
+   hrtime_tgrowtime = 0;
callb_cpr_t cpr;
 
CALLB_CPR_INIT(, _reclaim_lock, callb_generic_cpr, FTAG);
@@ -3630,7 +3630,7 @@ arc_reclaim_thread(void *dummy __unused)
 * Wait at least zfs_grow_retry (default 60) seconds
 * before considering growing.
 */
-   growtime = ddi_get_lbolt() + (arc_grow_retry * hz);
+   growtime = gethrtime() + SEC2NSEC(arc_grow_retry);
 
arc_kmem_reap_now();
 
@@ -3650,7 +3650,7 @@ arc_reclaim_thread(void *dummy __unused)
}
} else if (free_memory < arc_c >> arc_no_grow_shift) {
arc_no_grow = B_TRUE;
-   } else if (ddi_get_lbolt() >= growtime) {
+   } else if (gethrtime() >= growtime) {
arc_no_grow = B_FALSE;
}
 
@@ -3684,8 +3684,8 @@ arc_reclaim_thread(void *dummy __unused)
 * even if we aren't being signalled)
 */
CALLB_CPR_SAFE_BEGIN();
-   (void) cv_timedwait(_reclaim_thread_cv,
-   _reclaim_lock, hz);
+   (void) cv_timedwait_hires(_reclaim_thread_cv,
+   _reclaim_lock, SEC2NSEC(1), MSEC2NSEC(1), 0);
CALLB_CPR_SAFE_END(, _reclaim_lock);
}
}
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297115 - in stable/10: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/nvpair sys/cdd...

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:22:09 2016
New Revision: 297115
URL: https://svnweb.freebsd.org/changeset/base/297115

Log:
  MFC r296528: MFV r296527:  6659 nvlist_free(NULL) is a no-op
  
  Reviewed by: Toomas Soome 
  Reviewed by: Marcel Telka 
  Approved by: Robert Mustacchi 
  Author: Josef 'Jeff' Sipek 
  
  illumos/illumos-gate@aab83bb83be7342f6cfccaed8d5fe0b2f404855d

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/10/sys/cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Mon Mar 21 
00:20:49 2016(r297114)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Mon Mar 21 
00:22:09 2016(r297115)
@@ -5407,8 +5407,7 @@ zfs_do_allow_unallow_impl(int argc, char
 
 cleanup0:
nvlist_free(perm_nvl);
-   if (update_perm_nvl != NULL)
-   nvlist_free(update_perm_nvl);
+   nvlist_free(update_perm_nvl);
 cleanup1:
fs_perm_set_fini(_perm_set);
 cleanup2:

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Mar 21 
00:20:49 2016(r297114)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c   Mon Mar 21 
00:22:09 2016(r297115)
@@ -3413,8 +3413,7 @@ zpool_do_split(int argc, char **argv)
if (add_prop_list(
zpool_prop_to_name(ZPOOL_PROP_ALTROOT), optarg,
, B_TRUE) != 0) {
-   if (props)
-   nvlist_free(props);
+   nvlist_free(props);
usage(B_FALSE);
}
break;
@@ -3427,8 +3426,7 @@ zpool_do_split(int argc, char **argv)
propval++;
if (add_prop_list(optarg, propval,
, B_TRUE) != 0) {
-   if (props)
-   nvlist_free(props);
+   nvlist_free(props);
usage(B_FALSE);
}
} else {

Modified: stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c   Mon Mar 21 
00:20:49 2016(r297114)
+++ stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c   Mon Mar 21 
00:22:09 2016(r297115)
@@ -1445,8 +1445,7 @@ split_mirror_vdev(zpool_handle_t *zhp, c
}
 
if (zpool_vdev_split(zhp, newname, , props, flags) != 0) {
-   if (newroot != NULL)
-   nvlist_free(newroot);
+   nvlist_free(newroot);
return (NULL);
}
 

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Mon Mar 21 00:20:49 2016(r297114)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Mon Mar 21 00:22:09 2016(r297115)
@@ -318,8 +318,7 @@ zpool_refresh_stats(zpool_handle_t *zhp,
verify(nvlist_lookup_uint64(config,
ZPOOL_CONFIG_POOL_TXG, ) == 0);
 
-   if (zhp->zpool_old_config != NULL)
-   nvlist_free(zhp->zpool_old_config);
+   nvlist_free(zhp->zpool_old_config);
 
if (oldtxg != newtxg) {
nvlist_free(zhp->zpool_config);

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c

svn commit: r297114 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:20:49 2016
New Revision: 297114
URL: https://svnweb.freebsd.org/changeset/base/297114

Log:
  MFC r296523: MFV r296522:
  6541 Pool feature-flag check defeated if "verify" is included in the dedup
  property value
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Richard Laager 
  Approved by: Robert Mustacchi 
  Author: ilovezfs 
  
  illumos/illumos-gate@971640e6aa954c91b0706543741aa4570299f4d7

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Mon Mar 21 00:19:42 2016(r297113)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Mon Mar 21 00:20:49 2016(r297114)
@@ -3972,7 +3972,7 @@ zfs_check_settable(const char *dsname, n
return (SET_ERROR(EINVAL));
 
/* check prop value is enabled in features */
-   feature = zio_checksum_to_feature(intval);
+   feature = zio_checksum_to_feature(intval & ZIO_CHECKSUM_MASK);
if (feature == SPA_FEATURE_NONE)
break;
 

Modified: 
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c 
Mon Mar 21 00:19:42 2016(r297113)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c 
Mon Mar 21 00:20:49 2016(r297114)
@@ -138,10 +138,16 @@ zio_checksum_info_t zio_checksum_table[Z
 #endif
 };
 
+/*
+ * The flag corresponding to the "verify" in dedup=[checksum,]verify
+ * must be cleared first, so callers should use ZIO_CHECKSUM_MASK.
+ */
 spa_feature_t
 zio_checksum_to_feature(enum zio_checksum cksum)
 {
 #ifdef illumos
+   VERIFY((cksum & ~ZIO_CHECKSUM_MASK) == 0);
+
switch (cksum) {
case ZIO_CHECKSUM_SHA512:
return (SPA_FEATURE_SHA512);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297113 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:19:42 2016
New Revision: 297113
URL: https://svnweb.freebsd.org/changeset/base/297113

Log:
  MFC r296521: MFV r296520:
  6562 Refquota on receive doesn't account for overage
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Yuri Pankov 
  Reviewed by: Toomas Soome 
  Approved by: Gordon Ross 
  Author: Dan McDonald 
  
  illumos/illumos-gate@5f7a8e6d750cb070a3347f045201c6206caee6aa

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c  
Mon Mar 21 00:18:38 2016(r297112)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c  
Mon Mar 21 00:19:42 2016(r297113)
@@ -26,6 +26,7 @@
  * Copyright (c) 2014 RackTop Systems.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
+ * Copyright 2016, OmniTI Computer Consulting, Inc. All rights reserved.
  */
 
 #include 
@@ -85,6 +86,8 @@ SYSCTL_INT(_vfs_zfs, OID_AUTO, max_recor
 
 extern inline dsl_dataset_phys_t *dsl_dataset_phys(dsl_dataset_t *ds);
 
+extern int spa_asize_inflation;
+
 /*
  * Figure out how much of this delta should be propogated to the dsl_dir
  * layer.  If there's a refreservation, that space has already been
@@ -2897,6 +2900,11 @@ int
 dsl_dataset_clone_swap_check_impl(dsl_dataset_t *clone,
 dsl_dataset_t *origin_head, boolean_t force, void *owner, dmu_tx_t *tx)
 {
+   /*
+* "slack" factor for received datasets with refquota set on them.
+* See the bottom of this function for details on its use.
+*/
+   uint64_t refquota_slack = DMU_MAX_ACCESS * spa_asize_inflation;
int64_t unused_refres_delta;
 
/* they should both be heads */
@@ -2939,10 +2947,22 @@ dsl_dataset_clone_swap_check_impl(dsl_da
dsl_dir_space_available(origin_head->ds_dir, NULL, 0, TRUE))
return (SET_ERROR(ENOSPC));
 
-   /* clone can't be over the head's refquota */
+   /*
+* The clone can't be too much over the head's refquota.
+*
+* To ensure that the entire refquota can be used, we allow one
+* transaction to exceed the the refquota.  Therefore, this check
+* needs to also allow for the space referenced to be more than the
+* refquota.  The maximum amount of space that one transaction can use
+* on disk is DMU_MAX_ACCESS * spa_asize_inflation.  Allowing this
+* overage ensures that we are able to receive a filesystem that
+* exceeds the refquota on the source system.
+*
+* So that overage is the refquota_slack we use below.
+*/
if (origin_head->ds_quota != 0 &&
dsl_dataset_phys(clone)->ds_referenced_bytes >
-   origin_head->ds_quota)
+   origin_head->ds_quota + refquota_slack)
return (SET_ERROR(EDQUOT));
 
return (0);
@@ -2956,8 +2976,13 @@ dsl_dataset_clone_swap_sync_impl(dsl_dat
int64_t unused_refres_delta;
 
ASSERT(clone->ds_reserved == 0);
+   /*
+* NOTE: On DEBUG kernels there could be a race between this and
+* the check function if spa_asize_inflation is adjusted...
+*/
ASSERT(origin_head->ds_quota == 0 ||
-   dsl_dataset_phys(clone)->ds_unique_bytes <= origin_head->ds_quota);
+   dsl_dataset_phys(clone)->ds_unique_bytes <= origin_head->ds_quota +
+   DMU_MAX_ACCESS * spa_asize_inflation);
ASSERT3P(clone->ds_prev, ==, origin_head->ds_prev);
 
/*
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297112 - in stable/10: cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zstreamdump cddl/contrib/opensolaris/cmd/ztest cddl/contrib/openso...

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:18:38 2016
New Revision: 297112
URL: https://svnweb.freebsd.org/changeset/base/297112

Log:
  MFC r296519: MFV r296518:  5027 zfs large block support (add copyright)
  
  Author: Matthew Ahrens 
  
  illumos/illumos-gate@c3d26abc9ee97b4f60233556aadeb57e0bd30bb9

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zstreamdump/zstreamdump.c
  stable/10/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs_core/common/libzfs_core.c
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bptree.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Mar 21 00:16:42 
2016(r297111)
+++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.cMon Mar 21 00:18:38 
2016(r297112)
@@ -22,6 +22,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright (c) 2014 Integros [integros.com]
  */
 
 #include 

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Mon Mar 21 
00:16:42 2016(r297111)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Mon Mar 21 
00:18:38 2016(r297112)
@@ -29,6 +29,7 @@
  * Copyright (c) 2012 Martin Matuska . All rights reserved.
  * Copyright (c) 2013 Steven Hartland.  All rights reserved.
  * Copyright 2013 

svn commit: r297111 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:16:42 2016
New Revision: 297111
URL: https://svnweb.freebsd.org/changeset/base/297111

Log:
  MFC r296516: MFV r296515:
  6536 zfs send: want a way to disable setting of DRR_FLAG_FREERECORDS
  
  Reviewed by: Anil Vijarnia 
  Reviewed by: Kim Shrier 
  Reviewed by: Matthew Ahrens 
  Approved by: Dan McDonald 
  Author: Andrew Stormont 
  
  illumos/illumos-gate@880094b6062aebeec8eda6a8651757611c83b13e

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Mar 
21 00:15:41 2016(r297110)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Mar 
21 00:16:42 2016(r297111)
@@ -25,6 +25,7 @@
  * Copyright (c) 2014, Joyent, Inc. All rights reserved.
  * Copyright (c) 2012, Martin Matuska . All rights reserved.
  * Copyright 2014 HybridCluster. All rights reserved.
+ * Copyright 2016 RackTop Systems.
  */
 
 #include 
@@ -64,6 +65,12 @@
 int zfs_send_corrupt_data = B_FALSE;
 int zfs_send_queue_length = 16 * 1024 * 1024;
 int zfs_recv_queue_length = 16 * 1024 * 1024;
+/* Set this tunable to FALSE to disable setting of DRR_FLAG_FREERECORDS */
+int zfs_send_set_freerecords_bit = B_TRUE;
+
+#ifdef _KERNEL
+TUNABLE_INT("vfs.zfs.send_set_freerecords_bit", _send_set_freerecords_bit);
+#endif
 
 static char *dmu_recv_tag = "dmu_recv_tag";
 const char *recv_clone_name = "%recv";
@@ -771,7 +778,8 @@ dmu_send_impl(void *tag, dsl_pool_t *dp,
drr->drr_u.drr_begin.drr_toguid = dsl_dataset_phys(to_ds)->ds_guid;
if (dsl_dataset_phys(to_ds)->ds_flags & DS_FLAG_CI_DATASET)
drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CI_DATA;
-   drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_FREERECORDS;
+   if (zfs_send_set_freerecords_bit)
+   drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_FREERECORDS;
 
if (ancestor_zb != NULL) {
drr->drr_u.drr_begin.drr_fromguid =

Modified: 
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
Mon Mar 21 00:15:41 2016(r297110)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
Mon Mar 21 00:16:42 2016(r297111)
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2015 by Delphix. All rights reserved.
+ * Copyright 2016 RackTop Systems.
  */
 
 #ifndef_SYS_ZFS_IOCTL_H
@@ -124,6 +125,10 @@ typedef enum dmu_send_resume_token_versi
 
 #defineDMU_BACKUP_MAGIC 0x2F5bacbacULL
 
+/*
+ * Send stream flags.  Bits 24-31 are reserved for vendor-specific
+ * implementations and should not be used.
+ */
 #defineDRR_FLAG_CLONE  (1<<0)
 #defineDRR_FLAG_CI_DATA(1<<1)
 /*
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297110 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:15:41 2016
New Revision: 297110
URL: https://svnweb.freebsd.org/changeset/base/297110

Log:
  MFC r296514: MFV r296513:
  6450 scrub/resilver unnecessarily traverses snapshots created after the
  scrub started
  
  Reviewed by: George Wilson 
  Reviewed by: Prakash Surya 
  Reviewed by: Richard Elling 
  Approved by: Richard Lowe 
  Author: Matthew Ahrens 
  
  illumos/illumos-gate@38d61036746e2273cc18f6698392e1e29f87d1bf

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Mar 
21 00:14:30 2016(r297109)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Mar 
21 00:15:41 2016(r297110)
@@ -856,7 +856,16 @@ dsl_scan_ds_destroyed(dsl_dataset_t *ds,
 
if (scn->scn_phys.scn_bookmark.zb_objset == ds->ds_object) {
if (ds->ds_is_snapshot) {
-   /* Note, scn_cur_{min,max}_txg stays the same. */
+   /*
+* Note:
+*  - scn_cur_{min,max}_txg stays the same.
+*  - Setting the flag is not really necessary if
+*scn_cur_max_txg == scn_max_txg, because there
+*is nothing after this snapshot that we care
+*about.  However, we set it anyway and then
+*ignore it when we retraverse it in
+*dsl_scan_visitds().
+*/
scn->scn_phys.scn_bookmark.zb_objset =
dsl_dataset_phys(ds)->ds_next_snap_obj;
zfs_dbgmsg("destroying ds %llu; currently traversing; "
@@ -896,9 +905,6 @@ dsl_scan_ds_destroyed(dsl_dataset_t *ds,
zfs_dbgmsg("destroying ds %llu; in queue; removing",
(u_longlong_t)ds->ds_object);
}
-   } else {
-   zfs_dbgmsg("destroying ds %llu; ignoring",
-   (u_longlong_t)ds->ds_object);
}
 
/*
@@ -1051,6 +1057,46 @@ dsl_scan_visitds(dsl_scan_t *scn, uint64
 
VERIFY3U(0, ==, dsl_dataset_hold_obj(dp, dsobj, FTAG, ));
 
+   if (scn->scn_phys.scn_cur_min_txg >=
+   scn->scn_phys.scn_max_txg) {
+   /*
+* This can happen if this snapshot was created after the
+* scan started, and we already completed a previous snapshot
+* that was created after the scan started.  This snapshot
+* only references blocks with:
+*
+*  birth < our ds_creation_txg
+*  cur_min_txg is no less than ds_creation_txg.
+*  We have already visited these blocks.
+* or
+*  birth > scn_max_txg
+*  The scan requested not to visit these blocks.
+*
+* Subsequent snapshots (and clones) can reference our
+* blocks, or blocks with even higher birth times.
+* Therefore we do not need to visit them either,
+* so we do not add them to the work queue.
+*
+* Note that checking for cur_min_txg >= cur_max_txg
+* is not sufficient, because in that case we may need to
+* visit subsequent snapshots.  This happens when min_txg > 0,
+* which raises cur_min_txg.  In this case we will visit
+* this dataset but skip all of its blocks, because the
+* rootbp's birth time is < cur_min_txg.  Then we will
+* add the next snapshots/clones to the work queue.
+*/
+   char *dsname = kmem_alloc(MAXNAMELEN, KM_SLEEP);
+   dsl_dataset_name(ds, dsname);
+   zfs_dbgmsg("scanning dataset %llu (%s) is unnecessary because "
+   "cur_min_txg (%llu) >= max_txg (%llu)",
+   dsobj, dsname,
+   scn->scn_phys.scn_cur_min_txg,
+   scn->scn_phys.scn_max_txg);
+   kmem_free(dsname, MAXNAMELEN);
+
+   goto out;
+   }
+
if (dmu_objset_from_ds(ds, ))
goto out;
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297109 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:14:30 2016
New Revision: 297109
URL: https://svnweb.freebsd.org/changeset/base/297109

Log:
  MFC r296512: MFV r296511: 6537 Panic on zpool scrub with DEBUG kernel
  
  Reviewed by: Steve Gonczi 
  Reviewed by: Dan McDonald 
  Reviewed by: Igor Kozhukhov 
  Reviewed by: Matthew Ahrens 
  Approved by: Matthew Ahrens 
  Author: Gary Mills 
  
  illumos/illumos-gate@8c04a1fa3f7d569d48fe9b5342d0bd4c533179b9

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Mar 
21 00:13:39 2016(r297108)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Mon Mar 
21 00:14:30 2016(r297109)
@@ -21,6 +21,7 @@
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright 2016 Gary Mills
  */
 
 #include 
@@ -1554,7 +1555,8 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *
}
if (err != 0)
return;
-   if (!scn->scn_async_destroying && zfs_free_leak_on_eio &&
+   if (dp->dp_free_dir != NULL && !scn->scn_async_destroying &&
+   zfs_free_leak_on_eio &&
(dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes != 0 ||
dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes != 0 ||
dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes != 0)) {
@@ -1580,7 +1582,7 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *
-dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes,
-dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes, tx);
}
-   if (!scn->scn_async_destroying) {
+   if (dp->dp_free_dir != NULL && !scn->scn_async_destroying) {
/* finished; verify that space accounting went to zero */
ASSERT0(dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes);
ASSERT0(dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297108 - in stable/10: cddl/contrib/opensolaris/cmd/zinject cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/common/zfs sys/cddl/...

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:13:39 2016
New Revision: 297108
URL: https://svnweb.freebsd.org/changeset/base/297108

Log:
  MFC r296510, r296563, r296567: MFV r296505:
  6531 Provide mechanism to artificially limit disk performance
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Matthew Ahrens 
  Reviewed by: George Wilson 
  Approved by: Dan McDonald 
  Author: Prakash Surya 
  
  illumos/illumos-gate@97e81309571898df9fdd94aab1216dfcf23e060b

Added:
  stable/10/sys/cddl/compat/opensolaris/sys/callo.h
 - copied unchanged from r296510, 
head/sys/cddl/compat/opensolaris/sys/callo.h
Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zinject/zinject.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
  stable/10/sys/cddl/compat/opensolaris/sys/systm.h
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.c
  stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_ioctl_compat.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zinject/zinject.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zinject/zinject.cMon Mar 21 
00:09:56 2016(r297107)
+++ stable/10/cddl/contrib/opensolaris/cmd/zinject/zinject.cMon Mar 21 
00:13:39 2016(r297108)
@@ -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) 2012, 2015 by Delphix. All rights reserved.
  */
 
 /*
@@ -229,21 +229,57 @@ usage(void)
"\t\tall records if 'all' is specificed.\n"
"\n"
"\tzinject -p  pool\n"
+   "\n"
"\t\tInject a panic fault at the specified function. Only \n"
"\t\tfunctions which call spa_vdev_config_exit(), or \n"
"\t\tspa_vdev_exit() will trigger a panic.\n"
"\n"
"\tzinject -d device [-e errno] [-L ] [-F]\n"
"\t[-T  pool\n"
+   "\n"
"\t\tInject a fault into a particular device or the device's\n"
"\t\tlabel.  Label injection can either be 'nvlist', 'uber',\n "
"\t\t'pad1', or 'pad2'.\n"
"\t\t'errno' can be 'nxio' (the default), 'io', or 'dtl'.\n"
"\n"
"\tzinject -d device -A  pool\n"
+   "\n"
"\t\tPerform a specific action on a particular device\n"
"\n"
+   "\tzinject -d device -D latency:lanes pool\n"
+   "\n"
+   "\t\tAdd an artificial delay to IO requests on a particular\n"
+   "\t\tdevice, such that the requests take a minimum of 'latency'\n"
+   "\t\tmilliseconds to complete. Each delay has an associated\n"
+   "\t\tnumber of 'lanes' which defines the number of concurrent\n"
+   "\t\tIO requests that can be processed.\n"
+   "\n"
+   "\t\tFor example, with a single lane delay of 10 ms (-D 10:1),\n"
+   "\t\tthe device will only be able to service a single IO request\n"
+   "\t\tat a time with each request taking 10 ms to complete. So,\n"
+   "\t\tif only a single request is submitted every 10 ms, the\n"
+   "\t\taverage latency will be 10 ms; but if more than one request\n"
+   "\t\tis submitted every 10 ms, the average latency will be more\n"
+   "\t\tthan 10 ms.\n"
+   "\n"
+   "\t\tSimilarly, if a delay of 10 ms is specified to have two\n"
+   "\t\tlanes (-D 10:2), then the device will be able to service\n"
+   "\t\ttwo requests at a time, each with a minimum latency of\n"
+   "\t\t10 ms. So, if two requests are submitted every 10 ms, then\n"
+   "\t\tthe average latency will be 10 ms; but if more than two\n"
+   "\t\trequests are submitted every 10 ms, the average latency\n"
+   "\t\twill be more than 10 ms.\n"
+   "\n"
+   "\t\tAlso note, these delays are additive. So two invocations\n"
+   "\t\tof '-D 10:1', is roughly 

svn commit: r297107 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:09:56 2016
New Revision: 297107
URL: https://svnweb.freebsd.org/changeset/base/297107

Log:
  MFC r296021 (by smh): Removed unused label and fix mutex_exit order
  
  Remove unused done label from zfs_setacl fixing PVS-Studio V729.
  
  Fix mutex_exit order to mirror the mutex_enter order.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c  Mon Mar 
21 00:07:56 2016(r297106)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c  Mon Mar 
21 00:09:56 2016(r297107)
@@ -1994,8 +1994,8 @@ top:
zfs_sa_upgrade_txholds(tx, zp);
error = dmu_tx_assign(tx, TXG_NOWAIT);
if (error) {
-   mutex_exit(>z_acl_lock);
mutex_exit(>z_lock);
+   mutex_exit(>z_acl_lock);
 
if (error == ERESTART) {
dmu_tx_wait(tx);
@@ -2020,7 +2020,6 @@ top:
if (fuidp)
zfs_fuid_info_free(fuidp);
dmu_tx_commit(tx);
-done:
mutex_exit(>z_lock);
mutex_exit(>z_acl_lock);
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297106 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:07:56 2016
New Revision: 297106
URL: https://svnweb.freebsd.org/changeset/base/297106

Log:
  MFC r295125: MFV r294821:
  6529 Properly handle updates of variably-sized SA entries.
  
  Reviewed by: Brian Behlendorf 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Ned Bass 
  Reviewed by: Tim Chase 
  Approved by: Gordon Ross 
  Author: Andriy Gapon 
  
  illumos/illumos-gate@e7e978b1f75353cb29673af9b35453c20c2827bf
  
  During the update process in sa_modify_attrs(), the sizes of existing
  variably-sized SA entries are obtained from sa_lengths[]. The case where
  a variably-sized SA was being replaced neglected to increment the index
  into sa_lengths[], so subsequent variable-length SAs would be rewritten
  with the wrong length. This patch adds the missing increment operation
  so all variably-sized SA entries are stored with their correct lengths.
  
  Another problem was that index into attr_desc[] was increased even when
  an attribute was removed. If that attribute was not the last attribute,
  then the last attribute was lost.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c   Mon Mar 
21 00:06:42 2016(r297105)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c   Mon Mar 
21 00:07:56 2016(r297106)
@@ -1652,7 +1652,7 @@ sa_modify_attrs(sa_handle_t *hdl, sa_att
int spill_data_size = 0;
int spill_attr_count = 0;
int error;
-   uint16_t length;
+   uint16_t length, reg_length;
int i, j, k, length_idx;
sa_hdr_phys_t *hdr;
sa_idx_tab_t *idx_tab;
@@ -1712,34 +1712,50 @@ sa_modify_attrs(sa_handle_t *hdl, sa_att
hdr = SA_GET_HDR(hdl, SA_BONUS);
idx_tab = SA_IDX_TAB_GET(hdl, SA_BONUS);
for (; k != 2; k++) {
-   /* iterate over each attribute in layout */
+   /*
+* Iterate over each attribute in layout.  Fetch the
+* size of variable-length attributes needing rewrite
+* from sa_lengths[].
+*/
for (i = 0, length_idx = 0; i != count; i++) {
sa_attr_type_t attr;
 
attr = idx_tab->sa_layout->lot_attrs[i];
+   reg_length = SA_REGISTERED_LEN(sa, attr);
+   if (reg_length == 0) {
+   length = hdr->sa_lengths[length_idx];
+   length_idx++;
+   } else {
+   length = reg_length;
+   }
if (attr == newattr) {
-   /* duplicate attributes are not allowed */
-   ASSERT(action == SA_REPLACE ||
-   action == SA_REMOVE);
-   /* must be variable-sized to be replaced here */
-   if (action == SA_REPLACE) {
-   ASSERT(SA_REGISTERED_LEN(sa, attr) == 
0);
-   SA_ADD_BULK_ATTR(attr_desc, j, attr,
-   locator, datastart, buflen);
-   }
+   /*
+* There is nothing to do for SA_REMOVE,
+* so it is just skipped.
+*/
+   if (action == SA_REMOVE)
+   continue;
+
+   /*
+* Duplicate attributes are not allowed, so the
+* action can not be SA_ADD here.
+*/
+   ASSERT3S(action, ==, SA_REPLACE);
+
+   /*
+* Only a variable-sized attribute can be
+* replaced here, and its size must be changing.
+*/
+   ASSERT3U(reg_length, ==, 0);
+   ASSERT3U(length, !=, buflen);
+   SA_ADD_BULK_ATTR(attr_desc, j, attr,
+   locator, datastart, buflen);
} else {
-   length = SA_REGISTERED_LEN(sa, attr);
-   if (length == 0) {
-   length = hdr->sa_lengths[length_idx];
-   }
-

svn commit: r297105 - stable/10/cddl/contrib/opensolaris/lib/libzfs/common

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:06:42 2016
New Revision: 297105
URL: https://svnweb.freebsd.org/changeset/base/297105

Log:
  MFC r295047: MFV 295046:
  6358 A faulted pool with only unavailable vdevs triggers assertion
  failure in libzfs
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Andrew Stormont 
  Reviewed by: Serban Maduta 
  Approved by: Dan McDonald 
  Author: Dan Vatca 
  
  illumos/illumos-gate@b289d045e084af53efcc025255af8242e41f28fa

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Mon Mar 21 00:04:53 2016(r297104)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_config.c
Mon Mar 21 00:06:42 2016(r297105)
@@ -26,6 +26,7 @@
 
 /*
  * Copyright (c) 2012 by Delphix. All rights reserved.
+ * Copyright (c) 2015 by Syneto S.R.L. All rights reserved.
  */
 
 /*
@@ -246,8 +247,9 @@ zpool_get_features(zpool_handle_t *zhp)
config = zpool_get_config(zhp, NULL);
}
 
-   verify(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS,
-   ) == 0);
+   if (nvlist_lookup_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS,
+   ) != 0)
+   return (NULL);
 
return (features);
 }
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297103 - in stable/10: cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:03:55 2016
New Revision: 297103
URL: https://svnweb.freebsd.org/changeset/base/297103

Log:
  MFC r294817: MFV r294816:
  4986 receiving replication stream fails if any snapshot exceeds refquota
  
  Reviewed by: John Kennedy 
  Reviewed by: Matthew Ahrens 
  Approved by: Gordon Ross 
  Author: Dan McDonald 
  
  illumos/illumos-gate@5878fad70d76d8711f6608c1f80b0447601261c6

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Mon Mar 21 00:01:59 2016(r297102)
+++ stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c  
Mon Mar 21 00:03:55 2016(r297103)
@@ -26,6 +26,7 @@
  * Copyright (c) 2012 Pawel Jakub Dawidek .
  * All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
+ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  */
 
 #include 
@@ -67,7 +68,7 @@ extern void zfs_setprop_error(libzfs_han
 
 static int zfs_receive_impl(libzfs_handle_t *, const char *, const char *,
 recvflags_t *, int, const char *, nvlist_t *, avl_tree_t *, char **, int,
-uint64_t *);
+uint64_t *, const char *);
 static int guid_to_name(libzfs_handle_t *, const char *,
 uint64_t, boolean_t, char *);
 
@@ -2602,6 +2603,7 @@ zfs_receive_package(libzfs_handle_t *hdl
nvlist_t *stream_nv = NULL;
avl_tree_t *stream_avl = NULL;
char *fromsnap = NULL;
+   char *sendsnap = NULL;
char *cp;
char tofs[ZFS_MAXNAMELEN];
char sendfs[ZFS_MAXNAMELEN];
@@ -2750,8 +2752,16 @@ zfs_receive_package(libzfs_handle_t *hdl
 */
(void) strlcpy(sendfs, drr->drr_u.drr_begin.drr_toname,
ZFS_MAXNAMELEN);
-   if ((cp = strchr(sendfs, '@')) != NULL)
+   if ((cp = strchr(sendfs, '@')) != NULL) {
*cp = '\0';
+   /*
+* Find the "sendsnap", the final snapshot in a replication
+* stream.  zfs_receive_one() handles certain errors
+* differently, depending on if the contained stream is the
+* last one or not.
+*/
+   sendsnap = (cp + 1);
+   }
 
/* Finally, receive each contained stream */
do {
@@ -2764,7 +2774,7 @@ zfs_receive_package(libzfs_handle_t *hdl
 */
error = zfs_receive_impl(hdl, destname, NULL, flags, fd,
sendfs, stream_nv, stream_avl, top_zfs, cleanup_fd,
-   action_handlep);
+   action_handlep, sendsnap);
if (error == ENODATA) {
error = 0;
break;
@@ -2930,7 +2940,7 @@ zfs_receive_one(libzfs_handle_t *hdl, in
 const char *originsnap, recvflags_t *flags, dmu_replay_record_t *drr,
 dmu_replay_record_t *drr_noswap, const char *sendfs, nvlist_t *stream_nv,
 avl_tree_t *stream_avl, char **top_zfs, int cleanup_fd,
-uint64_t *action_handlep)
+uint64_t *action_handlep, const char *finalsnap)
 {
zfs_cmd_t zc = { 0 };
time_t begin_time;
@@ -2947,6 +2957,7 @@ zfs_receive_one(libzfs_handle_t *hdl, in
nvlist_t *snapprops_nvlist = NULL;
zprop_errflags_t prop_errflags;
boolean_t recursive;
+   char *snapname = NULL;
 
begin_time = time(NULL);
 
@@ -2957,7 +2968,6 @@ zfs_receive_one(libzfs_handle_t *hdl, in
ENOENT);
 
if (stream_avl != NULL) {
-   char *snapname;
nvlist_t *fs = fsavl_find(stream_avl, drrb->drr_toguid,
);
nvlist_t *props;
@@ -3313,7 +3323,21 @@ zfs_receive_one(libzfs_handle_t *hdl, in
ZPROP_N_MORE_ERRORS) == 0) {
trunc_prop_errs(intval);
break;
-   } else {
+   } else if (snapname == NULL || finalsnap == NULL ||
+   strcmp(finalsnap, snapname) == 0 ||
+   strcmp(nvpair_name(prop_err),
+   zfs_prop_to_name(ZFS_PROP_REFQUOTA)) != 0) {
+   /*
+* Skip the special case of, for example,
+* "refquota", errors on intermediate
+* snapshots leading up to a final one.
+* That's why we have all of the checks above.
+*
+

svn commit: r297102 - in stable/10: cddl/contrib/opensolaris/cmd/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2016-03-20 Thread Alexander Motin
Author: mav
Date: Mon Mar 21 00:01:59 2016
New Revision: 297102
URL: https://svnweb.freebsd.org/changeset/base/297102

Log:
  MFC r294815: MFV r294814: 6393 zfs receive a full send as a clone
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Prakash Surya 
  Reviewed by: Richard Elling 
  Approved by: Dan McDonald 
  Author: Paul Dagnelie 
  
  illumos/illumos-gate@68ecb2ec930c4b0f00acaf8e0abb2b19c4b8b76f
  
  This allows to do a full (non-incremental send) and receive it as a clone
  of an existing dataset. It can leverage nopwrite to share blocks with the
  origin. This can be used to change the relationship of datasets on the
  target. For example, maybe on the source you have:
  
  A  B  C
  
  And you have sent to the target a full of B, and the incremental B->C:
  
  B  C
  
  You later realize that you want to have A on the target. You will have to
  do a full send of A, but nopwrite can save you space on the target if you
  receive it as a clone of B, assuming that A and B have some blocks inxi
  common:
  
  B  C
   \
A

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8Sun Mar 20 23:58:44 
2016(r297101)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8Mon Mar 21 00:01:59 
2016(r297102)
@@ -2839,8 +2839,11 @@ Do not actually receive the stream. This
 option to verify the name the receive operation would use.
 .It Fl o Sy origin Ns = Ns Ar snapshot
 Forces the stream to be received as a clone of the given snapshot.
-This is only valid if the stream is an incremental stream whose source
-is the same as the provided origin.
+If the stream is a full send stream, this will create the filesystem
+described by the stream as a clone of the specified snapshot. Which
+snapshot was specified will not affect the success or failure of the
+receive, as long as the snapshot does exist.  If the stream is an
+incremental send stream, all the normal verification will be performed.
 .It Fl F
 Force a rollback of the file system to the most recent snapshot before
 performing the receive operation. If receiving an incremental replication

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Sun Mar 
20 23:58:44 2016(r297101)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Mon Mar 
21 00:01:59 2016(r297102)
@@ -158,6 +158,14 @@ dump_record(dmu_sendarg_t *dsp, void *pa
return (0);
 }
 
+/*
+ * Fill in the drr_free struct, or perform aggregation if the previous record 
is
+ * also a free record, and the two are adjacent.
+ *
+ * Note that we send free records even for a full send, because we want to be
+ * able to receive a full send as a clone, which requires a list of all the 
free
+ * and freeobject records that were generated on the source.
+ */
 static int
 dump_free(dmu_sendarg_t *dsp, uint64_t object, uint64_t offset,
 uint64_t length)
@@ -181,15 +189,6 @@ dump_free(dmu_sendarg_t *dsp, uint64_t o
(object == dsp->dsa_last_data_object &&
offset > dsp->dsa_last_data_offset));
 
-   /*
-* If we are doing a non-incremental send, then there can't
-* be any data in the dataset we're receiving into.  Therefore
-* a free record would simply be a no-op.  Save space by not
-* sending it to begin with.
-*/
-   if (!dsp->dsa_incremental)
-   return (0);
-
if (length != -1ULL && offset + length < offset)
length = -1ULL;
 
@@ -368,10 +367,6 @@ dump_freeobjects(dmu_sendarg_t *dsp, uin
 {
struct drr_freeobjects *drrfo = &(dsp->dsa_drr->drr_u.drr_freeobjects);
 
-   /* See comment in dump_free(). */
-   if (!dsp->dsa_incremental)
-   return (0);
-
/*
 * If there is a pending op, but it's not PENDING_FREEOBJECTS,
 * push it out, since free block aggregation can only be done for
@@ -776,6 +771,7 @@ dmu_send_impl(void *tag, dsl_pool_t *dp,
drr->drr_u.drr_begin.drr_toguid = dsl_dataset_phys(to_ds)->ds_guid;
if (dsl_dataset_phys(to_ds)->ds_flags & DS_FLAG_CI_DATASET)
drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_CI_DATA;
+   drr->drr_u.drr_begin.drr_flags |= DRR_FLAG_FREERECORDS;
 
if 

svn commit: r297101 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:58:44 2016
New Revision: 297101
URL: https://svnweb.freebsd.org/changeset/base/297101

Log:
  MFC r294813: MFV r294812:
  6434 sa_find_sizes() may compute wrong SA header size
  
  Reviewed-by: Ned Bass 
  Reviewed-by: Brian Behlendorf 
  Reviewed by: Andriy Gapon 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: James Pan 
  
  illumos/illumos-gate@3502ed6e7cb3f3d2e781960ab8fe465fdc884834

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c   Sun Mar 
20 23:57:46 2016(r297100)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sa.c   Sun Mar 
20 23:58:44 2016(r297101)
@@ -547,10 +547,9 @@ sa_find_sizes(sa_os_t *sa, sa_bulk_attr_
 {
int var_size = 0;
int i;
-   int j = -1;
int full_space;
int hdrsize;
-   boolean_t done = B_FALSE;
+   int extra_hdrsize;
 
if (buftype == SA_BONUS && sa->sa_force_spill) {
*total = 0;
@@ -561,10 +560,9 @@ sa_find_sizes(sa_os_t *sa, sa_bulk_attr_
 
*index = -1;
*total = 0;
+   *will_spill = B_FALSE;
 
-   if (buftype == SA_BONUS)
-   *will_spill = B_FALSE;
-
+   extra_hdrsize = 0;
hdrsize = (SA_BONUSTYPE_FROM_DB(db) == DMU_OT_ZNODE) ? 0 :
sizeof (sa_hdr_phys_t);
 
@@ -576,8 +574,8 @@ sa_find_sizes(sa_os_t *sa, sa_bulk_attr_
 
*total = P2ROUNDUP(*total, 8);
*total += attr_desc[i].sa_length;
-   if (done)
-   goto next;
+   if (*will_spill)
+   continue;
 
is_var_sz = (SA_REGISTERED_LEN(sa, attr_desc[i].sa_attr) == 0);
if (is_var_sz) {
@@ -585,21 +583,28 @@ sa_find_sizes(sa_os_t *sa, sa_bulk_attr_
}
 
if (is_var_sz && var_size > 1) {
-   if (P2ROUNDUP(hdrsize + sizeof (uint16_t), 8) +
+   /*
+* Don't worry that the spill block might overflow.
+* It will be resized if needed in sa_build_layouts().
+*/
+   if (buftype == SA_SPILL ||
+   P2ROUNDUP(hdrsize + sizeof (uint16_t), 8) +
*total < full_space) {
/*
 * Account for header space used by array of
 * optional sizes of variable-length attributes.
-* Record the index in case this increase needs
-* to be reversed due to spill-over.
+* Record the extra header size in case this
+* increase needs to be reversed due to
+* spill-over.
 */
hdrsize += sizeof (uint16_t);
-   j = i;
+   if (*index != -1)
+   extra_hdrsize += sizeof (uint16_t);
} else {
-   done = B_TRUE;
-   *index = i;
-   if (buftype == SA_BONUS)
-   *will_spill = B_TRUE;
+   ASSERT(buftype == SA_BONUS);
+   if (*index == -1)
+   *index = i;
+   *will_spill = B_TRUE;
continue;
}
}
@@ -614,22 +619,15 @@ sa_find_sizes(sa_os_t *sa, sa_bulk_attr_
(*total + P2ROUNDUP(hdrsize, 8)) >
(full_space - sizeof (blkptr_t))) {
*index = i;
-   done = B_TRUE;
}
 
-next:
if ((*total + P2ROUNDUP(hdrsize, 8)) > full_space &&
buftype == SA_BONUS)
*will_spill = B_TRUE;
}
 
-   /*
-* j holds the index of the last variable-sized attribute for
-* which hdrsize was increased.  Reverse the increase if that
-* attribute will be relocated to the spill block.
-*/
-   if (*will_spill && j == *index)
-   hdrsize -= sizeof (uint16_t);
+   if (*will_spill)
+   hdrsize -= extra_hdrsize;
 
hdrsize = P2ROUNDUP(hdrsize, 8);
return (hdrsize);

svn commit: r297100 - in stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:57:46 2016
New Revision: 297100
URL: https://svnweb.freebsd.org/changeset/base/297100

Log:
  MFC r294811: MFV r294810: 6414 vdev_config_sync could be simpler
  
  Reviewed by: George Wilson 
  Reviewed by: Matthew Ahrens 
  Approved by: Robert Mustacchi 
  Author: Will Andrews 
  
  illumos/illumos-gate@eb5bb58421f46cee79155a55688e6c675e7dd361

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Sun Mar 
20 23:56:59 2016(r297099)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Sun Mar 
20 23:57:46 2016(r297100)
@@ -6772,16 +6772,10 @@ spa_sync(spa_t *spa, uint64_t txg)
if (svdcount == SPA_DVAS_PER_BP)
break;
}
-   error = vdev_config_sync(svd, svdcount, txg, B_FALSE);
-   if (error != 0)
-   error = vdev_config_sync(svd, svdcount, txg,
-   B_TRUE);
+   error = vdev_config_sync(svd, svdcount, txg);
} else {
error = vdev_config_sync(rvd->vdev_child,
-   rvd->vdev_children, txg, B_FALSE);
-   if (error != 0)
-   error = vdev_config_sync(rvd->vdev_child,
-   rvd->vdev_children, txg, B_TRUE);
+   rvd->vdev_children, txg);
}
 
if (error == 0)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Sun Mar 
20 23:56:59 2016(r297099)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h Sun Mar 
20 23:57:46 2016(r297100)
@@ -127,8 +127,7 @@ extern void vdev_queue_register_lastoffs
 
 extern void vdev_config_dirty(vdev_t *vd);
 extern void vdev_config_clean(vdev_t *vd);
-extern int vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg,
-boolean_t);
+extern int vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg);
 
 extern void vdev_state_dirty(vdev_t *vd);
 extern void vdev_state_clean(vdev_t *vd);

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c   
Sun Mar 20 23:56:59 2016(r297099)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c   
Sun Mar 20 23:57:46 2016(r297100)
@@ -1194,15 +1194,16 @@ vdev_label_sync_list(spa_t *spa, int l, 
  * at any time, you can just call it again, and it will resume its work.
  */
 int
-vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, boolean_t tryhard)
+vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg)
 {
spa_t *spa = svd[0]->vdev_spa;
uberblock_t *ub = >spa_uberblock;
vdev_t *vd;
zio_t *zio;
-   int error;
+   int error = 0;
int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL;
 
+retry:
/*
 * Normally, we don't want to try too hard to write every label and
 * uberblock.  If there is a flaky disk, we don't want the rest of the
@@ -1210,8 +1211,11 @@ vdev_config_sync(vdev_t **svd, int svdco
 * single label out, we should retry with ZIO_FLAG_TRYHARD before
 * bailing out and declaring the pool faulted.
 */
-   if (tryhard)
+   if (error != 0) {
+   if ((flags & ZIO_FLAG_TRYHARD) != 0)
+   return (error);
flags |= ZIO_FLAG_TRYHARD;
+   }
 
ASSERT(ub->ub_txg <= txg);
 
@@ -1255,7 +1259,7 @@ vdev_config_sync(vdev_t **svd, int svdco
 * are committed to stable storage before the uberblock update.
 */
if ((error = vdev_label_sync_list(spa, 0, txg, flags)) != 0)
-   return (error);
+   goto retry;
 
/*
 * Sync the uberblocks to all vdevs in svd[].
@@ -1273,7 +1277,7 @@ vdev_config_sync(vdev_t **svd, int svdco
 *  to the new uberblocks.
 */
if ((error = vdev_uberblock_sync_list(svd, svdcount, ub, flags)) != 0)
-   return (error);
+   goto retry;
 

svn commit: r297099 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:56:59 2016
New Revision: 297099
URL: https://svnweb.freebsd.org/changeset/base/297099

Log:
  MFC r294809: MFV r294808:
  6421 Add missing multilist_destroy calls to arc_fini
  
  Reviewed by: Dan Kimmel 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Jorgen Lundman 
  Approved by: Robert Mustacchi 
  Author: Prakash Surya 
  
  illumos/illumos-gate@57deb2328260c447bf1db25fe74e0eece102733e

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Sun Mar 
20 23:56:02 2016(r297098)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c  Sun Mar 
20 23:56:59 2016(r297099)
@@ -5570,10 +5570,12 @@ arc_fini(void)
multilist_destroy(_mru_ghost->arcs_list[ARC_BUFC_METADATA]);
multilist_destroy(_mfu->arcs_list[ARC_BUFC_METADATA]);
multilist_destroy(_mfu_ghost->arcs_list[ARC_BUFC_METADATA]);
+   multilist_destroy(_l2c_only->arcs_list[ARC_BUFC_METADATA]);
multilist_destroy(_mru->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(_mru_ghost->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(_mfu->arcs_list[ARC_BUFC_DATA]);
multilist_destroy(_mfu_ghost->arcs_list[ARC_BUFC_DATA]);
+   multilist_destroy(_l2c_only->arcs_list[ARC_BUFC_DATA]);
 
buf_fini();
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297098 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:56:02 2016
New Revision: 297098
URL: https://svnweb.freebsd.org/changeset/base/297098

Log:
  MFC r294807: MFV r294806:
  6388 Failure of userland copy should return EFAULT
  
  Reviewed by: Brian Behlendorf 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Dan Kimmel 
  Approved by: Robert Mustacchi 
  Author: Richard Yao 
  
  illumos/illumos-gate@c71c00bbe8a9cdc7e3f4048b751f48e80441d506

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sun Mar 20 23:54:59 2016(r297097)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sun Mar 20 23:56:02 2016(r297098)
@@ -1338,7 +1338,7 @@ get_nvlist(uint64_t nvl, uint64_t size, 
if ((error = ddi_copyin((void *)(uintptr_t)nvl, packed, size,
iflag)) != 0) {
kmem_free(packed, size);
-   return (error);
+   return (SET_ERROR(EFAULT));
}
 
if ((error = nvlist_unpack(packed, size, , 0)) != 0) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297097 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:54:59 2016
New Revision: 297097
URL: https://svnweb.freebsd.org/changeset/base/297097

Log:
  MFC r294805: MFV r294804:
  6386 Fix function call with uninitialized value in vdev_inuse
  
  Reviewed by: Brian Behlendorf 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Dan Kimmel 
  Approved by: Robert Mustacchi 
  Author: Richard Yao 
  
  illumos/illumos-gate@5bdd995ddb777f538bfbcc5e2d5ff1bed07ae56e

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c   
Sun Mar 20 23:54:05 2016(r297096)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c   
Sun Mar 20 23:54:59 2016(r297097)
@@ -602,7 +602,8 @@ vdev_inuse(vdev_t *vd, uint64_t crtxg, v
 * read-only.  Instead we look to see if the pools is marked
 * read-only in the namespace and set the state to active.
 */
-   if ((spa = spa_by_guid(pool_guid, device_guid)) != NULL &&
+   if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE &&
+   (spa = spa_by_guid(pool_guid, device_guid)) != NULL &&
spa_mode(spa) == FREAD)
state = POOL_STATE_ACTIVE;
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297096 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:54:05 2016
New Revision: 297096
URL: https://svnweb.freebsd.org/changeset/base/297096

Log:
  MFC r294803: MFV r294802: 6334 Cannot unlink files when over quota
  
  Reviewed by: Matthew Ahrens 
  Reviewed by: Toomas Soome 
  Approved by: Dan McDonald 
  Author: Simon Klinkert 
  
  illumos/illumos-gate@6575bca01367958c7237253d88e5fa9ef0b1650a

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Sun Mar 20 23:52:45 2016(r297095)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Sun Mar 20 23:54:05 2016(r297096)
@@ -2009,12 +2009,9 @@ top:
dmu_tx_hold_zap(tx, zfsvfs->z_unlinkedobj, FALSE, NULL);
 
/*
-* Mark this transaction as typically resulting in a net free of
-* space, unless object removal will be delayed indefinitely
-* (due to active holds on the vnode due to the file being open).
+* Mark this transaction as typically resulting in a net free of space
 */
-   if (may_delete_now)
-   dmu_tx_mark_netfree(tx);
+   dmu_tx_mark_netfree(tx);
 
error = dmu_tx_assign(tx, waited ? TXG_WAITED : TXG_NOWAIT);
if (error) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297095 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:52:45 2016
New Revision: 297095
URL: https://svnweb.freebsd.org/changeset/base/297095

Log:
  MFC r294801: MFV r294800: 6385 Fix unlocking order in zfs_zget
  
  Reviewed by: Brian Behlendorf 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Dan Kimmel 
  Reviewed by: Andriy Gapon 
  Approved by: Robert Mustacchi 
  Author: Richard Yao 
  
  illumos/illumos-gate@eaef6a96de3f6afbbccc69bd7a0aed4463689d0a

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Sun Mar 20 23:51:56 2016(r297094)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
Sun Mar 20 23:52:45 2016(r297095)
@@ -1175,13 +1175,13 @@ again:
*zpp = zp;
err = 0;
}
-   sa_buf_rele(db, NULL);
 
/* Don't let the vnode disappear after ZFS_OBJ_HOLD_EXIT. */
if (err == 0)
VN_HOLD(vp);
 
mutex_exit(>z_lock);
+   sa_buf_rele(db, NULL);
ZFS_OBJ_HOLD_EXIT(zfsvfs, obj_num);
 
if (err == 0) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297094 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:51:56 2016
New Revision: 297094
URL: https://svnweb.freebsd.org/changeset/base/297094

Log:
  MFC r294799: MFV r294798:
  6292 exporting a pool while an async destroy is running can leave entries
  in the deferred tree
  
  Reviewed by: Paul Dagnelie 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Andriy Gapon 
  Reviewed by: Fabian Keil 
  Approved by: Gordon Ross 
  
  illumos/illumos-gate@a443cc80c742af740aa82130db840f02b4389365

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Sun Mar 
20 23:51:11 2016(r297093)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c Sun Mar 
20 23:51:56 2016(r297094)
@@ -1450,10 +1450,23 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *
}
 
/*
+* Only process scans in sync pass 1.
+*/
+   if (spa_sync_pass(dp->dp_spa) > 1)
+   return;
+
+   /*
+* If the spa is shutting down, then stop scanning. This will
+* ensure that the scan does not dirty any new data during the
+* shutdown phase.
+*/
+   if (spa_shutting_down(spa))
+   return;
+
+   /*
 * If the scan is inactive due to a stalled async destroy, try again.
 */
-   if ((!scn->scn_async_stalled && !dsl_scan_active(scn)) ||
-   spa_sync_pass(dp->dp_spa) > 1)
+   if (!scn->scn_async_stalled && !dsl_scan_active(scn))
return;
 
scn->scn_visited_this_txg = 0;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297093 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:51:11 2016
New Revision: 297093
URL: https://svnweb.freebsd.org/changeset/base/297093

Log:
  MFC r294797: MFV r294796:
  6319 assertion failed in zio_ddt_write: bp->blk_birth == txg
  
  Reviewed by: George Wilson 
  Approved by: Dan McDonald 
  
  illumos/illumos-gate@b39b744be78c6327db43c1f69d11c2f5909f73cb
  
  This is revert of 5693.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c  Sun Mar 
20 23:49:58 2016(r297092)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c  Sun Mar 
20 23:51:11 2016(r297093)
@@ -1222,6 +1222,8 @@ zio_write_bp_init(zio_t *zio)
zio->io_pipeline |= ZIO_STAGE_DDT_WRITE;
return (ZIO_PIPELINE_CONTINUE);
}
+   zio->io_bp_override = NULL;
+   BP_ZERO(bp);
}
 
if (!BP_IS_HOLE(bp) && bp->blk_birth == zio->io_txg) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297092 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:49:58 2016
New Revision: 297092
URL: https://svnweb.freebsd.org/changeset/base/297092

Log:
  MFC r294794: MFV r294793:
  6367 spa_config_tryenter incorrectly handles the multiple-lock case
  
  Reviewed by: Alek Pinchuk 
  Reviewed by: Josef 'Jeff' Sipek 
  Reviewed by: Prashanth Sreenivasa 
  Reviewed by: Matthew Ahrens 
  Reviewed by: Dan McDonald 
  Reviewed by: Steven Hartland 
  Approved by: Matthew Ahrens 
  
  illumos/illumos-gate@e495b6e6735b803e422025a630352ef9bba788c5

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Mar 
20 23:48:26 2016(r297091)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Mar 
20 23:49:58 2016(r297092)
@@ -21,7 +21,7 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
- * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2015 Nexenta Systems, Inc.  All rights reserved.
  * Copyright 2013 Martin Matuska . All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
  * Copyright 2013 Saso Kiselkov. All rights reserved.
@@ -459,14 +459,16 @@ spa_config_tryenter(spa_t *spa, int lock
if (rw == RW_READER) {
if (scl->scl_writer || scl->scl_write_wanted) {
mutex_exit(>scl_lock);
-   spa_config_exit(spa, locks ^ (1 << i), tag);
+   spa_config_exit(spa, locks & ((1 << i) - 1),
+   tag);
return (0);
}
} else {
ASSERT(scl->scl_writer != curthread);
if (!refcount_is_zero(>scl_count)) {
mutex_exit(>scl_lock);
-   spa_config_exit(spa, locks ^ (1 << i), tag);
+   spa_config_exit(spa, locks & ((1 << i) - 1),
+   tag);
return (0);
}
scl->scl_writer = curthread;
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297091 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:48:26 2016
New Revision: 297091
URL: https://svnweb.freebsd.org/changeset/base/297091

Log:
  MFC r294625 (by trasz):
  Fix ru_oublocks accounting for ZFS. There are two code paths that can be
  called from zfs_write() - one of them, through dmu_write(), was handled
  correctly; the other wasn't.
  
  Differential Revision:  https://reviews.freebsd.org/D4923

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c  Sun Mar 
20 23:43:26 2016(r297090)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c  Sun Mar 
20 23:48:26 2016(r297091)
@@ -1421,6 +1421,9 @@ dmu_assign_arcbuf(dmu_buf_t *handle, uin
 */
if (offset == db->db.db_offset && blksz == db->db.db_size &&
DBUF_GET_BUFC_TYPE(db) == ARC_BUFC_DATA) {
+#ifdef _KERNEL
+   curthread->td_ru.ru_oublock++;
+#endif
dbuf_assign_arcbuf(db, buf, tx);
dbuf_rele(db, FTAG);
} else {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


Re: svn commit: r297089 - stable/10/cddl/contrib/opensolaris/cmd/zdb

2016-03-20 Thread Dimitry Andric
On 21 Mar 2016, at 00:29, Alexander Motin  wrote:
> Author: mav
> Date: Sun Mar 20 23:29:58 2016
> New Revision: 297089
> URL: https://svnweb.freebsd.org/changeset/base/297089
> 
> Log:
>  MFC r292653 (by bapt): Report an error if zdb cannot initialize zfs
> 
>  If the zfs module is not present and not loadable, report an error
>  to the user instead of crashing
> 
>  Differential Revision:  https://reviews.freebsd.org/D4691
> 
> Modified:
>  stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
> Directory Properties:
>  stable/10/   (props changed)
> 
> Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
> ==
> --- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c  Sun Mar 20 23:26:52 
> 2016(r297088)
> +++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c  Sun Mar 20 23:29:58 
> 2016(r297089)
> @@ -3658,7 +3658,8 @@ main(int argc, char **argv)
> 
>   kernel_init(FREAD);
>   g_zfs = libzfs_init();
> - ASSERT(g_zfs != NULL);
> + if (g_zfs == NULL)
> + fatal("Fail to initialize zfs");

Minor nit: "Failed to" or "Unable to" is probably better here.

-Dimitry



signature.asc
Description: Message signed with OpenPGP using GPGMail


svn commit: r297090 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:43:26 2016
New Revision: 297090
URL: https://svnweb.freebsd.org/changeset/base/297090

Log:
  MFC r293677 (by asomers): Record physical path information in ZFS Vdevs
  
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c:
  If available, record the physical path of a vdev in ZFS meta-data.
  Do this both when opening the vdev, and when receiving an attribute
  change notification from GEOM.
  
  Make vdev_geom_close() synchronous instead of deferring its work to
  a GEOM event handler. There is no benefit to deferring the work and
  this prevents a future open call from referencing a consumer that is
  scheduled for destruction. The close followed by an immediate open
  will occur during a vdev reprobe triggered by any type of I/O error.
  
  Consolidate vdev_geom_close() and vdev_geom_detach() into
  vdev_geom_close() and vdev_geom_close_locked(). This also moves the
  cross linking operations between vdev and GEOM consumer into a
  single place (linking in vdev_geom_attach() and unlinking in
  vdev_geom_close_locked()).
  
  Differential Revision:  https://reviews.freebsd.org/D4524

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Sun Mar 20 23:29:58 2016(r297089)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
Sun Mar 20 23:43:26 2016(r297090)
@@ -80,6 +80,9 @@ static void
 vdev_geom_attrchanged(struct g_consumer *cp, const char *attr)
 {
vdev_t *vd;
+   spa_t *spa;
+   char *physpath;
+   int error, physpath_len;
 
vd = cp->private;
if (vd == NULL)
@@ -89,6 +92,47 @@ vdev_geom_attrchanged(struct g_consumer 
vdev_geom_set_rotation_rate(vd, cp);
return;
}
+
+   if (strcmp(attr, "GEOM::physpath") != 0)
+   return;
+
+   if (g_access(cp, 1, 0, 0) != 0)
+   return;
+
+   /*
+* Record/Update physical path information for this device.
+*/
+   spa = vd->vdev_spa;
+   physpath_len = MAXPATHLEN;
+   physpath = g_malloc(physpath_len, M_WAITOK|M_ZERO);
+   error = g_io_getattr("GEOM::physpath", cp, _len, physpath);
+   g_access(cp, -1, 0, 0);
+   if (error == 0) {
+   char *old_physpath;
+
+   old_physpath = vd->vdev_physpath;
+   vd->vdev_physpath = spa_strdup(physpath);
+   spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE);
+
+   if (old_physpath != NULL) {
+   int held_lock;
+
+   held_lock = spa_config_held(spa, SCL_STATE, RW_WRITER);
+   if (held_lock == 0) {
+   g_topology_unlock();
+   spa_config_enter(spa, SCL_STATE, FTAG,
+   RW_WRITER);
+   }
+
+   spa_strfree(old_physpath);
+
+   if (held_lock == 0) {
+   spa_config_exit(spa, SCL_STATE, FTAG);
+   g_topology_lock();
+   }
+   }
+   }
+   g_free(physpath);
 }
 
 static void
@@ -99,8 +143,10 @@ vdev_geom_orphan(struct g_consumer *cp)
g_topology_assert();
 
vd = cp->private;
-   if (vd == NULL)
+   if (vd == NULL) {
+   /* Vdev close in progress.  Ignore the event. */
return;
+   }
 
/*
 * Orphan callbacks occur from the GEOM event thread.
@@ -121,7 +167,7 @@ vdev_geom_orphan(struct g_consumer *cp)
 }
 
 static struct g_consumer *
-vdev_geom_attach(struct g_provider *pp)
+vdev_geom_attach(struct g_provider *pp, vdev_t *vd)
 {
struct g_geom *gp;
struct g_consumer *cp;
@@ -140,6 +186,7 @@ vdev_geom_attach(struct g_provider *pp)
if (gp == NULL) {
gp = g_new_geomf(_vdev_class, "zfs::vdev");
gp->orphan = vdev_geom_orphan;
+   gp->attrchanged = vdev_geom_attrchanged;
cp = g_new_consumer(gp);
if (g_attach(cp, pp) != 0) {
g_wither_geom(gp, ENXIO);
@@ -176,28 +223,56 @@ vdev_geom_attach(struct g_provider *pp)
ZFS_LOG(1, "Used existing consumer for %s.", pp->name);
}
}
+
+   /* 
+* BUG: cp may already belong to a vdev.  This could happen if:
+* 1) That vdev is a shared spare, or
+* 2) We are trying to reopen a missing vdev and we are scanning by
+*guid.  In that case, we'll 

svn commit: r297089 - stable/10/cddl/contrib/opensolaris/cmd/zdb

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:29:58 2016
New Revision: 297089
URL: https://svnweb.freebsd.org/changeset/base/297089

Log:
  MFC r292653 (by bapt): Report an error if zdb cannot initialize zfs
  
  If the zfs module is not present and not loadable, report an error
  to the user instead of crashing
  
  Differential Revision:  https://reviews.freebsd.org/D4691

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.cSun Mar 20 23:26:52 
2016(r297088)
+++ stable/10/cddl/contrib/opensolaris/cmd/zdb/zdb.cSun Mar 20 23:29:58 
2016(r297089)
@@ -3658,7 +3658,8 @@ main(int argc, char **argv)
 
kernel_init(FREAD);
g_zfs = libzfs_init();
-   ASSERT(g_zfs != NULL);
+   if (g_zfs == NULL)
+   fatal("Fail to initialize zfs");
 
if (dump_all)
verbose = MAX(verbose, 1);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297087 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 23:20:16 2016
New Revision: 297087
URL: https://svnweb.freebsd.org/changeset/base/297087

Log:
  MFC r290266 (by avg):
  zfs: allow the lookup of extended attributes of an unlinked file
  
  That's required for extattr_get_fd(2) and the like to work properly.
  
  PR:   203201

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c  Sun Mar 
20 21:48:26 2016(r297086)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c  Sun Mar 
20 23:20:16 2016(r297087)
@@ -222,7 +222,7 @@ zfs_dirent_lock(zfs_dirlock_t **dlpp, zn
 
mutex_enter(>z_lock);
for (;;) {
-   if (dzp->z_unlinked) {
+   if (dzp->z_unlinked && !(flag & ZXATTR)) {
mutex_exit(>z_lock);
if (!(flag & ZHAVELOCK))
rw_exit(>z_name_lock);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297085 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 20:37:26 2016
New Revision: 297085
URL: https://svnweb.freebsd.org/changeset/base/297085

Log:
  MFC r274627 (by avg):
  Revert r269093 which introduced physical zio alignment transform
  
  Size of physical ZIOs must never be implicitly adjusted, it's
  a responsibility of a caller to make sure that such a ZIO has proper offset
  and size.
  
  Discussed with: delphij, gibbs

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c  Sun Mar 
20 20:33:03 2016(r297084)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c  Sun Mar 
20 20:37:26 2016(r297085)
@@ -2727,8 +2727,7 @@ zio_vdev_io_start(zio_t *zio)
 
align = 1ULL << vd->vdev_top->vdev_ashift;
 
-   if ((!(zio->io_flags & ZIO_FLAG_PHYSICAL) ||
-   (vd->vdev_top->vdev_physical_ashift > SPA_MINBLOCKSHIFT)) &&
+   if (!(zio->io_flags & ZIO_FLAG_PHYSICAL) &&
P2PHASE(zio->io_size, align) != 0) {
/* Transform logical writes to be a full physical block size. */
uint64_t asize = P2ROUNDUP(zio->io_size, align);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


Re: svn commit: r297077 - in stable/10: cddl/contrib/opensolaris/cmd/dtrace cddl/contrib/opensolaris/cmd/lockstat cddl/contrib/opensolaris/cmd/mdb/tools/common cddl/contrib/opensolaris/cmd/plockstat c

2016-03-20 Thread Pedro Giffuni


On 20/03/2016  15:00, Alexander Motin wrote:

Author: mav
Date: Sun Mar 20 20:00:25 2016
New Revision: 297077
URL: https://svnweb.freebsd.org/changeset/base/297077

Log:
   MFC r277300 (by smh): Mechanically convert cddl sun #ifdef's to illumos
   
   Since the upstream for cddl code is now illumos not sun, mechanically

   convert all sun #ifdef's to illumos #ifdef's which have been used in all
   newer code for some time.
   
   Also do a manual pass to correct the use if #ifdef comments as per style(9)

   as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos.

Modified:
   stable/10/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
   stable/10/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c
   ...


Nice, this reminds me ...

We should probably also
svn mv cddl/contrib/opensolaris cddl/contrib/illumos (new path is shorter)
and
svn rm ~/vendor/opensolaris (to avoid confusion)

I find myself too lazy to figure out the build path updates though, and
MFCs would become "interesting" ;).

Pedro.

___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297084 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 20:33:03 2016
New Revision: 297084
URL: https://svnweb.freebsd.org/changeset/base/297084

Log:
  MFV r258597 (by pjd):
  When append-only, immutable or read-only flag is set don't allow for
  hard links creation. This matches UFS behaviour.
  
  Reported by:Oleg Ginzburg 

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Sun Mar 20 20:31:30 2016(r297083)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
Sun Mar 20 20:33:03 2016(r297084)
@@ -4402,6 +4402,11 @@ zfs_link(vnode_t *tdvp, vnode_t *svp, ch
szp = VTOZ(svp);
ZFS_VERIFY_ZP(szp);
 
+   if (szp->z_pflags & (ZFS_APPENDONLY | ZFS_IMMUTABLE | ZFS_READONLY)) {
+   ZFS_EXIT(zfsvfs);
+   return (SET_ERROR(EPERM));
+   }
+
/*
 * We check z_zfsvfs rather than v_vfsp here, because snapshots and the
 * ctldir appear to have the same v_vfsp.
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297082 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 20:27:52 2016
New Revision: 297082
URL: https://svnweb.freebsd.org/changeset/base/297082

Log:
  MFC r272359 (by will):
  zfsvfs_create(): Refuse to mount datasets whose names are too long.
  
  This is checked for in the zfs_snapshot_004_neg STF/ATF test (currently
  still in projects/zfsd rather than head).
  
  sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c:
  - zfsvfs_create(): Check whether the objset name fits into
statfs.f_mntfromname, and return ENAMETOOLONG if not.  Although
the filesystem can be unmounted via the umount(8) command, any
interface that relies on iterating on statfs (e.g. libzfs) will
fail to find the filesystem by its objset name, and thus assume
it's not mounted.  This causes "zfs unmount", "zfs destroy",
etc. to fail on these filesystems, whether or not -f is passed.
  
  MFSpectraBSD:   974872 on 2013/08/09

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Sun Mar 20 20:25:36 2016(r297081)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Sun Mar 20 20:27:52 2016(r297082)
@@ -855,6 +855,17 @@ zfsvfs_create(const char *osname, zfsvfs
int i, error;
uint64_t sa_obj;
 
+   /*
+* XXX: Fix struct statfs so this isn't necessary!
+*
+* The 'osname' is used as the filesystem's special node, which means
+* it must fit in statfs.f_mntfromname, or else it can't be
+* enumerated, so libzfs_mnttab_find() returns NULL, which causes
+* 'zfs unmount' to think it's not mounted when it is.
+*/
+   if (strlen(osname) >= MNAMELEN)
+   return (SET_ERROR(ENAMETOOLONG));
+
zfsvfs = kmem_zalloc(sizeof (zfsvfs_t), KM_SLEEP);
 
/*
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297081 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 20:25:36 2016
New Revision: 297081
URL: https://svnweb.freebsd.org/changeset/base/297081

Log:
  MFC r277503 (by will): Ignore sync requests from the system syncher,
  i.e. VFS_SYNC(waitfor=MNT_LAZY).
  
  ZFS already commits outstanding data every zfs_txg_timeout seconds, so these
  syncs are unnecessarily intrusive.
  
  MFSpectraBSD:   1105759 on 2014/12/11

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Sun Mar 20 20:23:20 2016(r297080)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Sun Mar 20 20:25:36 2016(r297081)
@@ -133,6 +133,13 @@ zfs_sync(vfs_t *vfsp, int waitfor)
if (panicstr)
return (0);
 
+   /*
+* Ignore the system syncher.  ZFS already commits async data
+* at zfs_txg_timeout intervals.
+*/
+   if (waitfor == MNT_LAZY)
+   return (0);
+
if (vfsp != NULL) {
/*
 * Sync a specific filesystem.
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297080 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 20:23:20 2016
New Revision: 297080
URL: https://svnweb.freebsd.org/changeset/base/297080

Log:
  MFC r277501 (by will): Eliminate an #ifdef illumos for zfs_ioc_rename().
  
  Since allow_mounted is a FreeBSD-specific change, default to B_TRUE, then
  locally check for the magic bit.  Unconditionally check allow_mounted below.
  Convert the setting of allow_mounted to an explicit boolean.
  
  MFSpectraBSD:   672578 (in part) on 2013/07/19

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sun Mar 20 20:20:37 2016(r297079)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sun Mar 20 20:23:20 2016(r297080)
@@ -3748,10 +3748,12 @@ static int
 zfs_ioc_rename(zfs_cmd_t *zc)
 {
boolean_t recursive = zc->zc_cookie & 1;
+   char *at;
+   boolean_t allow_mounted = B_TRUE;
+
 #ifdef __FreeBSD__
-   boolean_t allow_mounted = zc->zc_cookie & 2;
+   allow_mounted = (zc->zc_cookie & 2) != 0;
 #endif
-   char *at;
 
zc->zc_value[sizeof (zc->zc_value) - 1] = '\0';
if (dataset_namecheck(zc->zc_value, NULL, NULL) != 0 ||
@@ -3766,11 +3768,7 @@ zfs_ioc_rename(zfs_cmd_t *zc)
if (strncmp(zc->zc_name, zc->zc_value, at - zc->zc_name + 1))
return (SET_ERROR(EXDEV));
*at = '\0';
-#ifdef illumos
-   if (zc->zc_objset_type == DMU_OST_ZFS) {
-#else
if (zc->zc_objset_type == DMU_OST_ZFS && allow_mounted) {
-#endif
error = dmu_objset_find(zc->zc_name,
recursive_unmount, at + 1,
recursive ? DS_FIND_CHILDREN : 0);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297079 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 20:20:37 2016
New Revision: 297079
URL: https://svnweb.freebsd.org/changeset/base/297079

Log:
  MFC r286223 (by smh): Fix KSTACK_PAGES check in ZFS module
  
  The check introduced by r285946 failed to add the dependency on
  opt_kstack_pages.h which meant the default value for the platform instead
  of the customised options KSTACK_PAGES=X was being tested.
  
  Also wrap in #ifdef __FreeBSD__ for portability.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sun Mar 20 20:12:14 2016(r297078)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Sun Mar 20 20:20:37 2016(r297079)
@@ -132,6 +132,9 @@
  * distinguish between the operation failing, and
  * deserialization failing.
  */
+#ifdef __FreeBSD__
+#include "opt_kstack_pages.h"
+#endif
 
 #include 
 #include 
@@ -6573,18 +6576,22 @@ static void zfs_shutdown(void *, int);
 
 static eventhandler_tag zfs_shutdown_event_tag;
 
+#ifdef __FreeBSD__
 #define ZFS_MIN_KSTACK_PAGES 4
+#endif
 
 int
 zfs__init(void)
 {
 
+#ifdef __FreeBSD__
 #if KSTACK_PAGES < ZFS_MIN_KSTACK_PAGES
printf("ZFS NOTICE: KSTACK_PAGES is %d which could result in stack "
"overflow panic!\nPlease consider adding "
"'options KSTACK_PAGES=%d' to your kernel config\n", KSTACK_PAGES,
ZFS_MIN_KSTACK_PAGES);
 #endif
+#endif
zfs_root_token = root_mount_hold("ZFS");
 
mutex_init(_share_lock, NULL, MUTEX_DEFAULT, NULL);
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297078 - in stable/10: cddl/contrib/opensolaris/lib/libzpool/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 20:12:14 2016
New Revision: 297078
URL: https://svnweb.freebsd.org/changeset/base/297078

Log:
  MFC r274304 (by delphij): MFV r274272 and diff reduction with upstream.
  
  Illumos issue:
  5244 zio pipeline callers should explicitly invoke next stage

Modified:
  stable/10/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c
==
--- stable/10/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c  Sun Mar 
20 20:00:25 2016(r297077)
+++ stable/10/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c  Sun Mar 
20 20:12:14 2016(r297078)
@@ -25,6 +25,7 @@
 /*
  * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright 2012 Garrett D'Amore .  All rights reserved.
+ * Copyright (c) 2014 by Delphix. All rights reserved.
  */
 
 #include 
@@ -33,8 +34,10 @@ int taskq_now;
 taskq_t *system_taskq;
 
 #defineTASKQ_ACTIVE0x0001
+#defineTASKQ_NAMELEN   31
 
 struct taskq {
+   chartq_name[TASKQ_NAMELEN + 1];
kmutex_ttq_lock;
krwlock_t   tq_threadlock;
kcondvar_t  tq_dispatch_cv;
@@ -247,6 +250,7 @@ taskq_create(const char *name, int nthre
cv_init(>tq_dispatch_cv, NULL, CV_DEFAULT, NULL);
cv_init(>tq_wait_cv, NULL, CV_DEFAULT, NULL);
cv_init(>tq_maxalloc_cv, NULL, CV_DEFAULT, NULL);
+   (void) strncpy(tq->tq_name, name, TASKQ_NAMELEN + 1);
tq->tq_flags = flags | TASKQ_ACTIVE;
tq->tq_active = nthreads;
tq->tq_nthreads = nthreads;

Modified: 
stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
Sun Mar 20 20:00:25 2016(r297077)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
Sun Mar 20 20:12:14 2016(r297078)
@@ -60,7 +60,7 @@ typedef int   vdev_open_func_t(vdev_t *vd,
 uint64_t *logical_ashift, uint64_t *physical_ashift);
 typedef void   vdev_close_func_t(vdev_t *vd);
 typedef uint64_t vdev_asize_func_t(vdev_t *vd, uint64_t psize);
-typedef intvdev_io_start_func_t(zio_t *zio);
+typedef void   vdev_io_start_func_t(zio_t *zio);
 typedef void   vdev_io_done_func_t(zio_t *zio);
 typedef void   vdev_state_change_func_t(vdev_t *vd, int, int);
 typedef void   vdev_hold_func_t(vdev_t *vd);

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h  Sun Mar 
20 20:00:25 2016(r297077)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h  Sun Mar 
20 20:12:14 2016(r297078)
@@ -150,9 +150,6 @@ enum zio_compress {
 #defineZIO_FAILURE_MODE_CONTINUE   1
 #defineZIO_FAILURE_MODE_PANIC  2
 
-#defineZIO_PIPELINE_CONTINUE   0x100
-#defineZIO_PIPELINE_STOP   0x101
-
 enum zio_flag {
/*
 * Flags inherited by gang, ddt, and vdev children,

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
Sun Mar 20 20:00:25 2016(r297077)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c
Sun Mar 20 20:12:14 2016(r297078)
@@ -715,7 +715,7 @@ vdev_disk_ioctl_done(void *zio_arg, int 
zio_interrupt(zio);
 }
 
-static int
+static void
 vdev_disk_io_start(zio_t *zio)
 {
vdev_t *vd = zio->io_vd;
@@ -732,7 +732,7 @@ vdev_disk_io_start(zio_t *zio)
if (dvd == NULL || (dvd->vd_ldi_offline && dvd->vd_lh == NULL)) {
zio->io_error = SET_ERROR(ENXIO);
zio_interrupt(zio);
-   return (ZIO_PIPELINE_STOP);
+   return;
}
 
if (zio->io_type == ZIO_TYPE_IOCTL) {
@@ -740,7 +740,7 @@ 

svn commit: r297077 - in stable/10: cddl/contrib/opensolaris/cmd/dtrace cddl/contrib/opensolaris/cmd/lockstat cddl/contrib/opensolaris/cmd/mdb/tools/common cddl/contrib/opensolaris/cmd/plockstat cd...

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 20:00:25 2016
New Revision: 297077
URL: https://svnweb.freebsd.org/changeset/base/297077

Log:
  MFC r277300 (by smh): Mechanically convert cddl sun #ifdef's to illumos
  
  Since the upstream for cddl code is now illumos not sun, mechanically
  convert all sun #ifdef's to illumos #ifdef's which have been used in all
  newer code for some time.
  
  Also do a manual pass to correct the use if #ifdef comments as per style(9)
  as well as few uses of #if defined(__FreeBSD__) vs #ifndef illumos.

Modified:
  stable/10/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c
  stable/10/cddl/contrib/opensolaris/cmd/lockstat/lockstat.c
  stable/10/cddl/contrib/opensolaris/cmd/lockstat/sym.c
  stable/10/cddl/contrib/opensolaris/cmd/mdb/tools/common/die.c
  stable/10/cddl/contrib/opensolaris/cmd/mdb/tools/common/util.h
  stable/10/cddl/contrib/opensolaris/cmd/plockstat/plockstat.c
  stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  stable/10/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c
  stable/10/cddl/contrib/opensolaris/common/util/strtolctype.h
  stable/10/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/drti.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_aggregate.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_cc.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_dof.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_error.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_ident.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_impl.h
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_map.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_module.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_options.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_parser.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pid.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_pragma.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_printf.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_proc.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_program.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_provider.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dt_work.c
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/common/dtrace.h
  stable/10/cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c
  stable/10/cddl/contrib/opensolaris/lib/libgen/common/gmatch.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
  stable/10/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c
  stable/10/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.c
  stable/10/cddl/contrib/opensolaris/tools/ctf/cvt/barrier.h
  stable/10/cddl/contrib/opensolaris/tools/ctf/cvt/ctfconvert.c
  stable/10/cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c
  stable/10/cddl/contrib/opensolaris/tools/ctf/cvt/dwarf.c
  stable/10/cddl/contrib/opensolaris/tools/ctf/cvt/output.c
  stable/10/cddl/contrib/opensolaris/tools/ctf/cvt/tdata.c
  stable/10/cddl/contrib/opensolaris/tools/ctf/cvt/util.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c
  

svn commit: r297075 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 19:14:51 2016
New Revision: 297075
URL: https://svnweb.freebsd.org/changeset/base/297075

Log:
  MFC r269222: Reschedule the 'deadman' callout after handling, this makes our
  code behave more like it is on Solaris.
  
  Differential Revision: https://phabric.freebsd.org/D457

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Mar 
20 19:11:17 2016(r297074)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Mar 
20 19:14:51 2016(r297075)
@@ -608,6 +608,12 @@ spa_deadman(void *arg)
++spa->spa_deadman_calls);
if (zfs_deadman_enabled)
vdev_deadman(spa->spa_root_vdev);
+#ifdef __FreeBSD__
+#ifdef _KERNEL
+   callout_schedule(>spa_deadman_cycid,
+   hz * zfs_deadman_checktime_ms / MILLISEC);
+#endif
+#endif
 }
 
 /*
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297074 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 19:11:17 2016
New Revision: 297074
URL: https://svnweb.freebsd.org/changeset/base/297074

Log:
  MFC r271788 (by will):
  Enable ZFS debug flags to be modified via vfs.zfs.debug_flags.
  
  This is primarily only of interest to ZFS developers, but it makes it
  easier to get additional debugging.
  
  MFSpectraBSD:   517074 on 2011/12/15 (by will), 662343 on 2013/03/20 (by 
gibbs)

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Mar 
20 19:07:12 2016(r297073)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c Sun Mar 
20 19:11:17 2016(r297074)
@@ -263,6 +263,33 @@ TUNABLE_INT("vfs.zfs.recover", _reco
 SYSCTL_INT(_vfs_zfs, OID_AUTO, recover, CTLFLAG_RWTUN, _recover, 0,
 "Try to recover from otherwise-fatal errors.");
 
+static int
+sysctl_vfs_zfs_debug_flags(SYSCTL_HANDLER_ARGS)
+{
+   int err, val;
+
+   val = zfs_flags;
+   err = sysctl_handle_int(oidp, , 0, req);
+   if (err != 0 || req->newptr == NULL)
+   return (err);
+
+   /*
+* ZFS_DEBUG_MODIFY must be enabled prior to boot so all
+* arc buffers in the system have the necessary additional
+* checksum data.  However, it is safe to disable at any
+* time.
+*/
+   if (!(zfs_flags & ZFS_DEBUG_MODIFY))
+   val &= ~ZFS_DEBUG_MODIFY;
+   zfs_flags = val;
+
+   return (0);
+}
+TUNABLE_INT("vfs.zfs.debug_flags", _flags);
+SYSCTL_PROC(_vfs_zfs, OID_AUTO, debug_flags,
+CTLTYPE_UINT | CTLFLAG_MPSAFE | CTLFLAG_RW, 0, sizeof(int),
+sysctl_vfs_zfs_debug_flags, "IU", "Debug flags for ZFS testing.");
+
 /*
  * If destroy encounters an EIO while reading metadata (e.g. indirect
  * blocks), space referenced by the missing metadata can not be freed.
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297073 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 19:07:12 2016
New Revision: 297073
URL: https://svnweb.freebsd.org/changeset/base/297073

Log:
  MFC r277492 (by will): Add vfs.zfs.reference_tracking_enable sysctl/tunable.
  
  This is primarily for developer/debugging use; it enables built-in tagged
  tracking of refcounts inside ZFS.  It can only be enabled from the loader,
  since it modifies how in-core state is managed.  Default remains disabled.

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c Sun Mar 
20 19:06:21 2016(r297072)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c Sun Mar 
20 19:07:12 2016(r297073)
@@ -30,6 +30,11 @@
 
 #ifdef _KERNEL
 int reference_tracking_enable = FALSE; /* runs out of memory too easily */
+SYSCTL_DECL(_vfs_zfs);
+TUNABLE_INT("vfs.zfs.reference_tracking_enable", _tracking_enable);
+SYSCTL_INT(_vfs_zfs, OID_AUTO, reference_tracking_enable, CTLFLAG_RDTUN,
+_tracking_enable, 0,
+"Track reference holders to refcount_t objects, used mostly by ZFS");
 #else
 int reference_tracking_enable = TRUE;
 #endif
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297071 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 18:56:03 2016
New Revision: 297071
URL: https://svnweb.freebsd.org/changeset/base/297071

Log:
  MFC r271781i (by will):
  bpobj_iterate_impl(): Close a refcount leak iterating on a sublist.
  
  If bpobj_space() returned non-zero here, the sublist would have been
  left open, along with the bonus buffer hold it requires.  This call
  does not invoke any calls to bpobj_close() itself.
  
  This bug doesn't have any known vector, but was found on inspection.
  
  MFC after:  1 week
  Sponsored by:   Spectra Logic
  Affects:All ZFS versions starting 21 May 2010 (illumos cde58dbc)
  MFSpectraBSD:   r1050998 on 2014/03/26

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.cSun Mar 
20 18:31:30 2016(r297070)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bpobj.cSun Mar 
20 18:56:03 2016(r297071)
@@ -300,8 +300,10 @@ bpobj_iterate_impl(bpobj_t *bpo, bpobj_i
if (free) {
err = bpobj_space(,
_before, _before, _before);
-   if (err)
+   if (err != 0) {
+   bpobj_close();
break;
+   }
}
err = bpobj_iterate_impl(, func, arg, tx, free);
if (free) {
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297067 - stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 16:00:05 2016
New Revision: 297067
URL: https://svnweb.freebsd.org/changeset/base/297067

Log:
  MFC r264670: MFV r264667:
  
  4752 fan out read zio taskqs
  
  illumos/illumos-gate@1b497ab83e8f1c58bba5da59c649207a442a4720

Modified:
  stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Sun Mar 
20 14:37:37 2016(r297066)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c  Sun Mar 
20 16:00:05 2016(r297067)
@@ -21,7 +21,7 @@
 
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2013 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2014 by Delphix. All rights reserved.
  * Copyright (c) 2015, Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 Martin Matuska . All rights reserved.
  * Copyright (c) 2014 Spectra Logic Corporation, All rights reserved.
@@ -140,7 +140,7 @@ static const char *const zio_taskq_types
 const zio_taskq_info_t zio_taskqs[ZIO_TYPES][ZIO_TASKQ_TYPES] = {
/* ISSUEISSUE_HIGH  INTRINTR_HIGH */
{ ZTI_ONE,  ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* NULL */
-   { ZTI_N(8), ZTI_NULL,   ZTI_BATCH,  ZTI_NULL }, /* READ */
+   { ZTI_N(8), ZTI_NULL,   ZTI_P(12, 8),   ZTI_NULL }, /* READ */
{ ZTI_BATCH,ZTI_N(5),   ZTI_N(8),   ZTI_N(5) }, /* WRITE */
{ ZTI_P(12, 8), ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* FREE */
{ ZTI_ONE,  ZTI_NULL,   ZTI_ONE,ZTI_NULL }, /* CLAIM */
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297066 - stable/10/sys/kern

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 14:37:37 2016
New Revision: 297066
URL: https://svnweb.freebsd.org/changeset/base/297066

Log:
  MFC r256613, r256862: MFprojects/camlock r254763:
  Move tq_enqueue() call out of the queue lock for known handlers (actually
  I have found no others in the base system).  This reduces queue lock hold
  time and congestion spinning under active multithreaded enqueuing.

Modified:
  stable/10/sys/kern/subr_taskqueue.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/subr_taskqueue.c
==
--- stable/10/sys/kern/subr_taskqueue.c Sun Mar 20 14:21:07 2016
(r297065)
+++ stable/10/sys/kern/subr_taskqueue.c Sun Mar 20 14:37:37 2016
(r297066)
@@ -46,6 +46,9 @@ __FBSDID("$FreeBSD$");
 static MALLOC_DEFINE(M_TASKQUEUE, "taskqueue", "Task Queues");
 static void*taskqueue_giant_ih;
 static void*taskqueue_ih;
+static void taskqueue_fast_enqueue(void *);
+static void taskqueue_swi_enqueue(void *);
+static void taskqueue_swi_giant_enqueue(void *);
 
 struct taskqueue_busy {
struct task *tb_running;
@@ -69,6 +72,7 @@ struct taskqueue {
 
 #defineTQ_FLAGS_ACTIVE (1 << 0)
 #defineTQ_FLAGS_BLOCKED(1 << 1)
+#defineTQ_FLAGS_UNLOCKED_ENQUEUE   (1 << 2)
 
 #defineDT_CALLOUT_ARMED(1 << 0)
 
@@ -96,7 +100,8 @@ _timeout_task_init(struct taskqueue *que
 {
 
TASK_INIT(_task->t, priority, func, context);
-   callout_init_mtx(_task->c, >tq_mutex, 0);
+   callout_init_mtx(_task->c, >tq_mutex,
+   CALLOUT_RETURNUNLOCKED);
timeout_task->q = queue;
timeout_task->f = 0;
 }
@@ -127,6 +132,11 @@ _taskqueue_create(const char *name __unu
queue->tq_context = context;
queue->tq_spin = (mtxflags & MTX_SPIN) != 0;
queue->tq_flags |= TQ_FLAGS_ACTIVE;
+   if (enqueue == taskqueue_fast_enqueue ||
+   enqueue == taskqueue_swi_enqueue ||
+   enqueue == taskqueue_swi_giant_enqueue ||
+   enqueue == taskqueue_thread_enqueue)
+   queue->tq_flags |= TQ_FLAGS_UNLOCKED_ENQUEUE;
mtx_init(>tq_mutex, mtxname, NULL, mtxflags);
 
return queue;
@@ -196,6 +206,7 @@ taskqueue_enqueue_locked(struct taskqueu
if (task->ta_pending) {
if (task->ta_pending < USHRT_MAX)
task->ta_pending++;
+   TQ_UNLOCK(queue);
return (0);
}
 
@@ -219,9 +230,14 @@ taskqueue_enqueue_locked(struct taskqueu
}
 
task->ta_pending = 1;
+   if ((queue->tq_flags & TQ_FLAGS_UNLOCKED_ENQUEUE) != 0)
+   TQ_UNLOCK(queue);
if ((queue->tq_flags & TQ_FLAGS_BLOCKED) == 0)
queue->tq_enqueue(queue->tq_context);
+   if ((queue->tq_flags & TQ_FLAGS_UNLOCKED_ENQUEUE) == 0)
+   TQ_UNLOCK(queue);
 
+   /* Return with lock released. */
return (0);
 }
 int
@@ -231,7 +247,7 @@ taskqueue_enqueue(struct taskqueue *queu
 
TQ_LOCK(queue);
res = taskqueue_enqueue_locked(queue, task);
-   TQ_UNLOCK(queue);
+   /* The lock is released inside. */
 
return (res);
 }
@@ -248,6 +264,7 @@ taskqueue_timeout_func(void *arg)
timeout_task->f &= ~DT_CALLOUT_ARMED;
queue->tq_callouts--;
taskqueue_enqueue_locked(timeout_task->q, _task->t);
+   /* The lock is released inside. */
 }
 
 int
@@ -264,6 +281,7 @@ taskqueue_enqueue_timeout(struct taskque
res = timeout_task->t.ta_pending;
if (ticks == 0) {
taskqueue_enqueue_locked(queue, _task->t);
+   /* The lock is released inside. */
} else {
if ((timeout_task->f & DT_CALLOUT_ARMED) != 0) {
res++;
@@ -277,8 +295,8 @@ taskqueue_enqueue_timeout(struct taskque
callout_reset(_task->c, ticks,
taskqueue_timeout_func, timeout_task);
}
+   TQ_UNLOCK(queue);
}
-   TQ_UNLOCK(queue);
return (res);
 }
 
@@ -591,7 +609,6 @@ taskqueue_thread_enqueue(void *context)
tqp = context;
tq = *tqp;
 
-   TQ_ASSERT_LOCKED(tq);
wakeup_one(tq);
 }
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"


svn commit: r297064 - stable/10/sys/kern

2016-03-20 Thread Alexander Motin
Author: mav
Date: Sun Mar 20 14:11:37 2016
New Revision: 297064
URL: https://svnweb.freebsd.org/changeset/base/297064

Log:
  MFC r256612: MFprojects/camlock r254685:
  Remove TQ_FLAGS_PENDING flag, softly duplicating queue emptiness status.

Modified:
  stable/10/sys/kern/subr_taskqueue.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/kern/subr_taskqueue.c
==
--- stable/10/sys/kern/subr_taskqueue.c Sun Mar 20 14:06:27 2016
(r297063)
+++ stable/10/sys/kern/subr_taskqueue.c Sun Mar 20 14:11:37 2016
(r297064)
@@ -69,7 +69,6 @@ struct taskqueue {
 
 #defineTQ_FLAGS_ACTIVE (1 << 0)
 #defineTQ_FLAGS_BLOCKED(1 << 1)
-#defineTQ_FLAGS_PENDING(1 << 2)
 
 #defineDT_CALLOUT_ARMED(1 << 0)
 
@@ -222,8 +221,6 @@ taskqueue_enqueue_locked(struct taskqueu
task->ta_pending = 1;
if ((queue->tq_flags & TQ_FLAGS_BLOCKED) == 0)
queue->tq_enqueue(queue->tq_context);
-   else
-   queue->tq_flags |= TQ_FLAGS_PENDING;
 
return (0);
 }
@@ -309,10 +306,8 @@ taskqueue_unblock(struct taskqueue *queu
 
TQ_LOCK(queue);
queue->tq_flags &= ~TQ_FLAGS_BLOCKED;
-   if (queue->tq_flags & TQ_FLAGS_PENDING) {
-   queue->tq_flags &= ~TQ_FLAGS_PENDING;
+   if (!STAILQ_EMPTY(>tq_queue))
queue->tq_enqueue(queue->tq_context);
-   }
TQ_UNLOCK(queue);
 }
 
___
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"