svn commit: r248638 - stable/8/sbin/recoverdisk

2013-03-23 Thread Xin LI
Author: delphij
Date: Sat Mar 23 07:36:53 2013
New Revision: 248638
URL: http://svnweb.freebsd.org/changeset/base/248638

Log:
  MFC r248279:
  
  Correct type for DIOCGSTRIPESIZE.  Without this there
  would be a stack overflow which will crash the program
  later.
  
  PR:   bin/176953
  Submitted by: r4721 tormail org
  Approved by:  re (rodrigc)

Modified:
  stable/8/sbin/recoverdisk/recoverdisk.c
Directory Properties:
  stable/8/sbin/recoverdisk/   (props changed)

Modified: stable/8/sbin/recoverdisk/recoverdisk.c
==
--- stable/8/sbin/recoverdisk/recoverdisk.c Sat Mar 23 07:24:06 2013
(r248637)
+++ stable/8/sbin/recoverdisk/recoverdisk.c Sat Mar 23 07:36:53 2013
(r248638)
@@ -156,7 +156,7 @@ main(int argc, char * const argv[])
int error, flags, state;
u_char *buf;
u_int sectorsize;
-   u_int stripesize;
+   off_t stripesize;
time_t t1, t2;
struct stat sb;
u_int n, snapshot = 60;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248639 - head/sbin/fsdb

2013-03-23 Thread Kirk McKusick
Author: mckusick
Date: Sat Mar 23 07:57:30 2013
New Revision: 248639
URL: http://svnweb.freebsd.org/changeset/base/248639

Log:
  Fix the build after addition of cylinder group cacheing (r248625)
  
  Reported by:   Glen Barber (gjb@)
  Pointy hat to: Kirk McKusick (mckusick@)

Modified:
  head/sbin/fsdb/fsdb.c

Modified: head/sbin/fsdb/fsdb.c
==
--- head/sbin/fsdb/fsdb.c   Sat Mar 23 07:36:53 2013(r248638)
+++ head/sbin/fsdb/fsdb.c   Sat Mar 23 07:57:30 2013(r248639)
@@ -441,7 +441,8 @@ CMDFUNCSTART(findblk)
 ino_t inum, inosused;
 uint32_t *wantedblk32;
 uint64_t *wantedblk64;
-struct cg *cgp = &cgrp;
+struct bufarea *cgbp;
+struct cg *cgp;
 int c, i, is_ufs2;
 
 wantedblksize = (argc - 1);
@@ -473,8 +474,8 @@ CMDFUNCSTART(findblk)
 */
inum = c * sblock.fs_ipg;
/* Read cylinder group. */
-   getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
-   memcpy(cgp, cgblk.b_un.b_cg, sblock.fs_cgsize);
+   cgbp = cgget(c);
+   cgp = cgbp->b_un.b_cg;
/*
 * Get a highest used inode number for a given cylinder group.
 * For UFS1 all inodes initialized at the newfs stage.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r248639 - head/sbin/fsdb

2013-03-23 Thread Glen Barber
On Sat, Mar 23, 2013 at 07:57:30AM +, Kirk McKusick wrote:
> Author: mckusick
> Date: Sat Mar 23 07:57:30 2013
> New Revision: 248639
> URL: http://svnweb.freebsd.org/changeset/base/248639
> 
> Log:
>   Fix the build after addition of cylinder group cacheing (r248625)
>   
>   Reported by:   Glen Barber (gjb@)
>   Pointy hat to: Kirk McKusick (mckusick@)
> 
> Modified:
>   head/sbin/fsdb/fsdb.c
> 

This is wrong.

r248625 was reverted with r248634.

head/ is now re-broken.

gjb@nucleus:~/freebsd/newsrc/base/head/sbin/fsdb % make
Warning: Object directory not changed from original
/freebsd/newsrc/base/head/sbin/fsdb
/usr/local/libexec/ccache/world/cc -O2 -pipe
-I/freebsd/newsrc/base/head/sbin/fsdb/../fsck_ffs
-std=gnu99 -fstack-protector -Wsystem-headers -Wall -Wno-format-y2k
-Wno-uninitialized -Wno-poin
ter-sign  -static -o fsdb fsdb.o fsdbutil.o dir.o ea.o fsutil.o inode.o
pass1.o pass1b.o pass2.o
 pass3.o pass4.o pass5.o setup.o utilities.o ffs_subr.o ffs_tables.o
 -ledit -ltermcap
 fsdb.o: In function `findblk':
 fsdb.c:(.text+0x1916): undefined reference to `cgget'
 *** [fsdb] Error code 1
  
  Stop in /freebsd/newsrc/base/head/sbin/fsdb.

Glen



pgpmOdWUPLi1A.pgp
Description: PGP signature


svn commit: r248640 - head/sys/cddl/dev/fbt

2013-03-23 Thread Andriy Gapon
Author: avg
Date: Sat Mar 23 08:48:44 2013
New Revision: 248640
URL: http://svnweb.freebsd.org/changeset/base/248640

Log:
  fbt_typoff_init: fix an off by one in determining required memory size
  
  This issue would be silent most of the time, but if the requested memory
  is a multiple of a page size, then accessing one element beyond the end
  would lead to a kernel page fault.
  Otherwise, the unlucky last type would just be inaccessible.
  
  Reported by:  glebius
  Tested by:glebius
  MFC after:6 days

Modified:
  head/sys/cddl/dev/fbt/fbt.c

Modified: head/sys/cddl/dev/fbt/fbt.c
==
--- head/sys/cddl/dev/fbt/fbt.c Sat Mar 23 07:57:30 2013(r248639)
+++ head/sys/cddl/dev/fbt/fbt.c Sat Mar 23 08:48:44 2013(r248640)
@@ -777,6 +777,8 @@ fbt_typoff_init(linker_ctf_t *lc)
pop[kind]++;
}
 
+   /* account for a sentinel value below */
+   ctf_typemax++;
*lc->typlenp = ctf_typemax;
 
if ((xp = malloc(sizeof(uint32_t) * ctf_typemax, M_LINKER, M_ZERO | 
M_WAITOK)) == NULL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248641 - head/lib/libdwarf

2013-03-23 Thread Andriy Gapon
Author: avg
Date: Sat Mar 23 08:50:56 2013
New Revision: 248641
URL: http://svnweb.freebsd.org/changeset/base/248641

Log:
  libdwarf: anonymous types are expected to have empty type names...
  
  or no type attributes at all.
  This is according to DWARF specification.
  
  MFC after:13 days

Modified:
  head/lib/libdwarf/dwarf_die.c

Modified: head/lib/libdwarf/dwarf_die.c
==
--- head/lib/libdwarf/dwarf_die.c   Sat Mar 23 08:48:44 2013
(r248640)
+++ head/lib/libdwarf/dwarf_die.c   Sat Mar 23 08:50:56 2013
(r248641)
@@ -29,8 +29,6 @@
 #include 
 #include "_libdwarf.h"
 
-static const char *anon_name = "__anon__";
-
 int
 dwarf_die_add(Dwarf_CU cu, int level, uint64_t offset, uint64_t abnum, 
Dwarf_Abbrev a, Dwarf_Die *diep, Dwarf_Error *err)
 {
@@ -57,7 +55,7 @@ dwarf_die_add(Dwarf_CU cu, int level, ui
die->die_abnum  = abnum;
die->die_a  = a;
die->die_cu = cu;
-   die->die_name   = anon_name;
+   die->die_name   = "";
 
/* Initialise the list of attribute values. */
STAILQ_INIT(&die->die_attrval);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248642 - head/sys/cddl/dev/fbt

2013-03-23 Thread Andriy Gapon
Author: avg
Date: Sat Mar 23 08:52:50 2013
New Revision: 248642
URL: http://svnweb.freebsd.org/changeset/base/248642

Log:
  fbt_getargdesc: correctly handle types for return probes
  
  MFC after:6 days

Modified:
  head/sys/cddl/dev/fbt/fbt.c

Modified: head/sys/cddl/dev/fbt/fbt.c
==
--- head/sys/cddl/dev/fbt/fbt.c Sat Mar 23 08:50:56 2013(r248641)
+++ head/sys/cddl/dev/fbt/fbt.c Sat Mar 23 08:52:50 2013(r248642)
@@ -1260,6 +1260,11 @@ fbt_getargdesc(void *arg __unused, dtrac
uint32_t offset;
ushort_t info, kind, n;
 
+   if (fbt->fbtp_roffset != 0 && desc->dtargd_ndx == 0) {
+   (void) strcpy(desc->dtargd_native, "int");
+   return;
+   }
+
desc->dtargd_ndx = DTRACE_ARGNONE;
 
/* Get a pointer to the CTF data and it's length. */
@@ -1310,12 +1315,19 @@ fbt_getargdesc(void *arg __unused, dtrac
return;
}
 
-   /* Check if the requested argument doesn't exist. */
-   if (ndx >= n)
-   return;
+   if (fbt->fbtp_roffset != 0) {
+   /* Only return type is available for args[1] in return probe. */
+   if (ndx > 1)
+   return;
+   ASSERT(ndx == 1);
+   } else {
+   /* Check if the requested argument doesn't exist. */
+   if (ndx >= n)
+   return;
 
-   /* Skip the return type and arguments up to the one requested. */
-   dp += ndx + 1;
+   /* Skip the return type and arguments up to the one requested. 
*/
+   dp += ndx + 1;
+   }
 
if (fbt_type_name(&lc, *dp, desc->dtargd_native, 
sizeof(desc->dtargd_native)) > 0)
desc->dtargd_ndx = ndx;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248643 - head/sbin/fsdb

2013-03-23 Thread Glen Barber
Author: gjb (doc,ports committer)
Date: Sat Mar 23 08:57:14 2013
New Revision: 248643
URL: http://svnweb.freebsd.org/changeset/base/248643

Log:
  Revert r248639 to fix build failure on head/

Modified:
  head/sbin/fsdb/fsdb.c

Modified: head/sbin/fsdb/fsdb.c
==
--- head/sbin/fsdb/fsdb.c   Sat Mar 23 08:52:50 2013(r248642)
+++ head/sbin/fsdb/fsdb.c   Sat Mar 23 08:57:14 2013(r248643)
@@ -441,8 +441,7 @@ CMDFUNCSTART(findblk)
 ino_t inum, inosused;
 uint32_t *wantedblk32;
 uint64_t *wantedblk64;
-struct bufarea *cgbp;
-struct cg *cgp;
+struct cg *cgp = &cgrp;
 int c, i, is_ufs2;
 
 wantedblksize = (argc - 1);
@@ -474,8 +473,8 @@ CMDFUNCSTART(findblk)
 */
inum = c * sblock.fs_ipg;
/* Read cylinder group. */
-   cgbp = cgget(c);
-   cgp = cgbp->b_un.b_cg;
+   getblk(&cgblk, cgtod(&sblock, c), sblock.fs_cgsize);
+   memcpy(cgp, cgblk.b_un.b_cg, sblock.fs_cgsize);
/*
 * Get a highest used inode number for a given cylinder group.
 * For UFS1 all inodes initialized at the newfs stage.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248644 - head/cddl/contrib/opensolaris/lib/libdtrace/common

2013-03-23 Thread Andriy Gapon
Author: avg
Date: Sat Mar 23 08:57:54 2013
New Revision: 248644
URL: http://svnweb.freebsd.org/changeset/base/248644

Log:
  dtrace: ensure that we can always catch a process (e.g. when -c is used)
  
  It is not guaranteed that a program has a symbol table entry for main
  and thus that it would be possible to set a breakpoint on it.
  
  Reviewed by:  rpaulo
  Discussed with:   rpaulo
  MFC after:13 days

Modified:
  head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c

Modified: head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.c
==
--- head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.cSat Mar 
23 08:57:14 2013(r248643)
+++ head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_open.cSat Mar 
23 08:57:54 2013(r248644)
@@ -1115,7 +1115,7 @@ alloc:
 #if defined(sun)
dtp->dt_prcmode = DT_PROC_STOP_PREINIT;
 #else
-   dtp->dt_prcmode = DT_PROC_STOP_MAIN;
+   dtp->dt_prcmode = DT_PROC_STOP_POSTINIT;
 #endif
dtp->dt_linkmode = DT_LINK_KERNEL;
dtp->dt_linktype = DT_LTYP_ELF;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248645 - head/sys/kern

2013-03-23 Thread Andriy Gapon
Author: avg
Date: Sat Mar 23 08:59:34 2013
New Revision: 248645
URL: http://svnweb.freebsd.org/changeset/base/248645

Log:
  post mountroot event after a real/final root is mounted
  
  not every time an intermediate root (including the first devfs) is
  mounted.
  This is also consistent with waking up via root_mount_complete.
  
  Reviewed by:  jhb
  MFC after:13 days

Modified:
  head/sys/kern/vfs_mountroot.c

Modified: head/sys/kern/vfs_mountroot.c
==
--- head/sys/kern/vfs_mountroot.c   Sat Mar 23 08:57:54 2013
(r248644)
+++ head/sys/kern/vfs_mountroot.c   Sat Mar 23 08:59:34 2013
(r248645)
@@ -199,8 +199,6 @@ set_rootvnode(void)
VREF(rootvnode);
 
FILEDESC_XUNLOCK(p->p_fd);
-
-   EVENTHANDLER_INVOKE(mountroot);
 }
 
 static int
@@ -991,6 +989,8 @@ vfs_mountroot(void)
atomic_store_rel_int(&root_mount_complete, 1);
wakeup(&root_mount_complete);
mtx_unlock(&mountlist_mtx);
+
+   EVENTHANDLER_INVOKE(mountroot);
 }
 
 static struct mntarg *
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248646 - svnadmin/conf

2013-03-23 Thread Peter Wemm
Author: peter
Date: Sat Mar 23 09:06:40 2013
New Revision: 248646
URL: http://svnweb.freebsd.org/changeset/base/248646

Log:
  Don't say that stable branches are being exported to cvs that are not..

Modified:
  svnadmin/conf/paths

Modified: svnadmin/conf/paths
==
--- svnadmin/conf/paths Sat Mar 23 08:59:34 2013(r248645)
+++ svnadmin/conf/paths Sat Mar 23 09:06:40 2013(r248646)
@@ -6,7 +6,7 @@
 # Mainline of the tree
 ^head/
 
-# The actively exported -stable branches.
+# The currently existing -stable branches.
 ^stable/2.0.5/
 ^stable/2.1/
 ^stable/2.2/
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248647 - head/usr.bin/systat

2013-03-23 Thread Alexander Motin
Author: mav
Date: Sat Mar 23 13:11:54 2013
New Revision: 248647
URL: http://svnweb.freebsd.org/changeset/base/248647

Log:
  Make `systat -vmstat` to use suffixes to display big floating point numbers
  that are not fitting into the specified field width, same as done for ints.
  In particular that allows to properly display disk tps above 100k, that are
  reachable with modern SSDs.

Modified:
  head/usr.bin/systat/vmstat.c

Modified: head/usr.bin/systat/vmstat.c
==
--- head/usr.bin/systat/vmstat.cSat Mar 23 09:06:40 2013
(r248646)
+++ head/usr.bin/systat/vmstat.cSat Mar 23 13:11:54 2013
(r248647)
@@ -703,6 +703,10 @@ putfloat(double f, int l, int lc, int w,
snr = snprintf(b, sizeof(b), "%*.*f", w, d, f);
if (snr != w)
snr = snprintf(b, sizeof(b), "%*.0f", w, f);
+   if (snr != w)
+   snr = snprintf(b, sizeof(b), "%*.0fk", w - 1, f / 1000);
+   if (snr != w)
+   snr = snprintf(b, sizeof(b), "%*.0fM", w - 1, f / 100);
if (snr != w) {
while (--w >= 0)
addch('*');
@@ -731,6 +735,10 @@ putlongdouble(long double f, int l, int 
snr = snprintf(b, sizeof(b), "%*.*Lf", w, d, f);
if (snr != w)
snr = snprintf(b, sizeof(b), "%*.0Lf", w, f);
+   if (snr != w)
+   snr = snprintf(b, sizeof(b), "%*.0Lfk", w - 1, f / 1000);
+   if (snr != w)
+   snr = snprintf(b, sizeof(b), "%*.0LfM", w - 1, f / 100);
if (snr != w) {
while (--w >= 0)
addch('*');
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248648 - head/crypto/openssh

2013-03-23 Thread Dag-Erling Smørgrav
Author: des
Date: Sat Mar 23 14:52:31 2013
New Revision: 248648
URL: http://svnweb.freebsd.org/changeset/base/248648

Log:
  Revert r247892 now that this has been fixed upstream.

Modified:
  head/crypto/openssh/FREEBSD-upgrade

Modified: head/crypto/openssh/FREEBSD-upgrade
==
--- head/crypto/openssh/FREEBSD-upgrade Sat Mar 23 13:11:54 2013
(r248647)
+++ head/crypto/openssh/FREEBSD-upgrade Sat Mar 23 14:52:31 2013
(r248648)
@@ -43,7 +43,6 @@
 7) Run configure with the appropriate arguments:
 
$ ./configure --prefix=/usr --sysconfdir=/etc/ssh \
-   --disable-lastlog --disable-utmp --disable-wtmp \
--with-pam --with-tcp-wrappers --with-libedit \
--with-ssl-engine
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248649 - in head: share/man/man9 sys/kern sys/sys

2013-03-23 Thread Will Andrews
Author: will
Date: Sat Mar 23 15:11:53 2013
New Revision: 248649
URL: http://svnweb.freebsd.org/changeset/base/248649

Log:
  Extend taskqueue(9) to enable per-taskqueue callbacks.
  
  The scope of these callbacks is primarily to support actions that affect the
  taskqueue's thread environments.  They are entirely optional, and
  consequently are introduced as a new API: taskqueue_set_callback().
  
  This interface allows the caller to specify that a taskqueue requires a
  callback and optional context pointer for a given callback type.
  
  The callback types included in this commit can be used to register a
  constructor and destructor for thread-local storage using osd(9).  This
  allows a particular taskqueue to define that its threads require a specific
  type of TLS, without the need for a specially-orchestrated task-based
  mechanism for startup and shutdown in order to accomplish it.
  
  Two callback types are supported at this point:
  
  - TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts, prior
to processing any tasks.
  - TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it exits,
after it has processed its last task but before the taskqueue is
reclaimed.
  
  While I'm here:
  
  - Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use them
in appropriate locations.
  - Fix taskqueue.9 to mention taskqueue_start_threads(), which is a required
interface for all consumers of taskqueue(9).
  
  Reviewed by:  kib (all), eadler (taskqueue.9), brd (taskqueue.9)
  Approved by:  ken (mentor)
  Sponsored by: Spectra Logic
  MFC after:1 month

Modified:
  head/share/man/man9/taskqueue.9
  head/sys/kern/subr_taskqueue.c
  head/sys/sys/taskqueue.h

Modified: head/share/man/man9/taskqueue.9
==
--- head/share/man/man9/taskqueue.9 Sat Mar 23 14:52:31 2013
(r248648)
+++ head/share/man/man9/taskqueue.9 Sat Mar 23 15:11:53 2013
(r248649)
@@ -53,12 +53,23 @@ struct task {
void*ta_context;/* argument for handler */
 };
 
+enum taskqueue_callback_type {
+   TASKQUEUE_CALLBACK_TYPE_INIT,
+   TASKQUEUE_CALLBACK_TYPE_SHUTDOWN,
+};
+
+typedef void (*taskqueue_callback_fn)(void *context);
+
 struct timeout_task;
 .Ed
 .Ft struct taskqueue *
 .Fn taskqueue_create "const char *name" "int mflags" "taskqueue_enqueue_fn 
enqueue" "void *context"
 .Ft struct taskqueue *
 .Fn taskqueue_create_fast "const char *name" "int mflags" 
"taskqueue_enqueue_fn enqueue" "void *context"
+.Ft int
+.Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int pri" 
"const char *name" "..."
+.Ft void
+.Fn taskqueue_set_callback "struct taskqueue *queue" "enum 
taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void 
*context"
 .Ft void
 .Fn taskqueue_free "struct taskqueue *queue"
 .Ft int
@@ -127,6 +138,23 @@ should be used to free the memory used b
 Any tasks that are on the queue will be executed at this time after
 which the thread servicing the queue will be signaled that it should exit.
 .Pp
+Once a taskqueue has been created, its threads should be started using
+.Fn taskqueue_start_threads .
+Callbacks may optionally be registered using
+.Fn taskqueue_set_callback .
+Currently, callbacks may be registered for the following purposes:
+.Bl -tag -width TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
+.It Dv TASKQUEUE_CALLBACK_TYPE_INIT
+This callback is called by every thread in the taskqueue, before it executes
+any tasks.
+This callback must be set before the taskqueue's threads are started.
+.It Dv TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
+This callback is called by every thread in the taskqueue, after it executes
+its last task.
+This callback will always be called before the taskqueue structure is
+reclaimed.
+.El
+.Pp
 To add a task to the list of tasks queued on a taskqueue, call
 .Fn taskqueue_enqueue
 with pointers to the queue and task.

Modified: head/sys/kern/subr_taskqueue.c
==
--- head/sys/kern/subr_taskqueue.c  Sat Mar 23 14:52:31 2013
(r248648)
+++ head/sys/kern/subr_taskqueue.c  Sat Mar 23 15:11:53 2013
(r248649)
@@ -63,6 +63,8 @@ struct taskqueue {
int tq_spin;
int tq_flags;
int tq_callouts;
+   taskqueue_callback_fn   tq_callbacks[TASKQUEUE_NUM_CALLBACKS];
+   void*tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS];
 };
 
 #defineTQ_FLAGS_ACTIVE (1 << 0)
@@ -78,6 +80,7 @@ struct taskqueue {
else\
mtx_lock(&(tq)->tq_mutex);  \
} while (0)
+#defineTQ_ASSERT_LOCKED(tq)mtx_assert(&(tq)->tq_mutex, MA_OWNED)
 
 #defineTQ_UNLOCK(tq)  

Re: svn commit: r248571 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cm

2013-03-23 Thread Bjoern A. Zeeb

On Thu, 21 Mar 2013, Martin Matuska wrote:


Author: mm
Date: Thu Mar 21 08:38:03 2013
New Revision: 248571
URL: http://svnweb.freebsd.org/changeset/base/248571

Log:
 Merge libzfs_core branch:
   includes MFV 238590, 238592, 247580

...

Added:
 head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
- copied unchanged from r248551, 
projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
 head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h
- copied unchanged from r248551, 
projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h
 head/cddl/contrib/opensolaris/lib/libzfs_core/
- copied from r248551, 
projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs_core/
 head/cddl/lib/libzfs_core/
- copied from r248551, projects/libzfs_core/cddl/lib/libzfs_core/
 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
- copied unchanged from r248551, 
projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
- copied unchanged from r248551, 
projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h
- copied unchanged from r248551, 
projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h
 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h
- copied unchanged from r248551, 
projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h
 head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h
- copied unchanged from r248551, 
projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h



in the theoretical event someone would want to compile zfs into the kernel,
given r233578 added support for that, one would need this:

mm, peter?

Index: sys/conf/files
===
--- sys/conf/files  (revision 248649)
+++ sys/conf/files  (working copy)
@@ -197,11 +197,13 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_s
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c  optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c optional zfs 
compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c   optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c   optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c  optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c  optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c  optional zfs 
compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c  optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c  optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c   optional zfs 
compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c  optional zfs 
compile-with "${ZFS_C}"


--
Bjoern A. Zeeb  Charles Haddon Spurgeon:
"Friendship is one of the sweetest joys of life.  Many might have failed
  beneath the bitterness of their trial  had they not found a friend."
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248650 - stable/9/lib/libc/gen

2013-03-23 Thread Jilles Tjoelker
Author: jilles
Date: Sat Mar 23 15:50:34 2013
New Revision: 248650
URL: http://svnweb.freebsd.org/changeset/base/248650

Log:
  MFC r246641: fts: Use O_DIRECTORY when opening name that might be changed by
  attacker.
  
  There are uncommon cases where fts_safe_changedir() may be called with a
  non-NULL name that is not "..". Do not block or worse if an attacker put (a
  symlink to) a fifo or device where a directory used to be.

Modified:
  stable/9/lib/libc/gen/fts.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/gen/fts.c
==
--- stable/9/lib/libc/gen/fts.c Sat Mar 23 15:11:53 2013(r248649)
+++ stable/9/lib/libc/gen/fts.c Sat Mar 23 15:50:34 2013(r248650)
@@ -1147,7 +1147,8 @@ fts_safe_changedir(sp, p, fd, path)
newfd = fd;
if (ISSET(FTS_NOCHDIR))
return (0);
-   if (fd < 0 && (newfd = _open(path, O_RDONLY | O_CLOEXEC, 0)) < 0)
+   if (fd < 0 && (newfd = _open(path, O_RDONLY | O_DIRECTORY |
+   O_CLOEXEC, 0)) < 0)
return (-1);
if (_fstat(newfd, &sb)) {
ret = -1;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248651 - stable/9/lib/libc/net

2013-03-23 Thread Jilles Tjoelker
Author: jilles
Date: Sat Mar 23 16:02:49 2013
New Revision: 248651
URL: http://svnweb.freebsd.org/changeset/base/248651

Log:
  MFC r248252: libc: Avoid SIGPIPE when nscd closes the connection
  unexpectedly.
  
  It is almost always a bug if nscd closes the connection unexpectedly but
  programs should not be killed with SIGPIPE for it.

Modified:
  stable/9/lib/libc/net/nscachedcli.c
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/net/nscachedcli.c
==
--- stable/9/lib/libc/net/nscachedcli.c Sat Mar 23 15:50:34 2013
(r248650)
+++ stable/9/lib/libc/net/nscachedcli.c Sat Mar 23 16:02:49 2013
(r248651)
@@ -75,9 +75,10 @@ safe_write(struct cached_connection_ *co
nevents = _kevent(connection->write_queue, NULL, 0, &eventlist,
1, &timeout);
if ((nevents == 1) && (eventlist.filter == EVFILT_WRITE)) {
-   s_result = _write(connection->sockfd, data + result,
+   s_result = _sendto(connection->sockfd, data + result,
eventlist.data < data_size - result ?
-   eventlist.data : data_size - result);
+   eventlist.data : data_size - result, MSG_NOSIGNAL,
+   NULL, 0);
if (s_result == -1)
return (-1);
else
@@ -175,8 +176,8 @@ send_credentials(struct cached_connectio
nevents = _kevent(connection->write_queue, NULL, 0, &eventlist, 1,
NULL);
if (nevents == 1 && eventlist.filter == EVFILT_WRITE) {
-   result = (_sendmsg(connection->sockfd, &cred_hdr, 0) == -1) ?
-   -1 : 0;
+   result = (_sendmsg(connection->sockfd, &cred_hdr,
+   MSG_NOSIGNAL) == -1) ?  -1 : 0;
EV_SET(&eventlist, connection->sockfd, EVFILT_WRITE, EV_ADD,
0, 0, NULL);
_kevent(connection->write_queue, &eventlist, 1, NULL, 0, NULL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248652 - stable/9/lib/libc/stdio

2013-03-23 Thread Jilles Tjoelker
Author: jilles
Date: Sat Mar 23 16:06:20 2013
New Revision: 248652
URL: http://svnweb.freebsd.org/changeset/base/248652

Log:
  MFC r246824,r246952: setbuf(3): Bring BUGS section up to date.

Modified:
  stable/9/lib/libc/stdio/setbuf.3
Directory Properties:
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/stdio/setbuf.3
==
--- stable/9/lib/libc/stdio/setbuf.3Sat Mar 23 16:02:49 2013
(r248651)
+++ stable/9/lib/libc/stdio/setbuf.3Sat Mar 23 16:06:20 2013
(r248652)
@@ -32,7 +32,7 @@
 .\" @(#)setbuf.3   8.1 (Berkeley) 6/4/93
 .\" $FreeBSD$
 .\"
-.Dd June 4, 1993
+.Dd February 18, 2013
 .Dt SETBUF 3
 .Os
 .Sh NAME
@@ -196,18 +196,5 @@ functions
 conform to
 .St -isoC .
 .Sh BUGS
-The
-.Fn setbuffer
-and
-.Fn setlinebuf
-functions are not portable to versions of
-.Bx
-before
-.Bx 4.2 .
-On
-.Bx 4.2
-and
-.Bx 4.3
-systems,
 .Fn setbuf
-always uses a suboptimal buffer size and should be avoided.
+usually uses a suboptimal buffer size and should be avoided.
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r248649 - in head: share/man/man9 sys/kern sys/sys

2013-03-23 Thread mdf
On Sat, Mar 23, 2013 at 8:11 AM, Will Andrews  wrote:
> Author: will
> Date: Sat Mar 23 15:11:53 2013
> New Revision: 248649
> URL: http://svnweb.freebsd.org/changeset/base/248649
>
> Log:
>   Extend taskqueue(9) to enable per-taskqueue callbacks.
>
>   The scope of these callbacks is primarily to support actions that affect the
>   taskqueue's thread environments.  They are entirely optional, and
>   consequently are introduced as a new API: taskqueue_set_callback().
>
>   This interface allows the caller to specify that a taskqueue requires a
>   callback and optional context pointer for a given callback type.
>
>   The callback types included in this commit can be used to register a
>   constructor and destructor for thread-local storage using osd(9).  This
>   allows a particular taskqueue to define that its threads require a specific
>   type of TLS, without the need for a specially-orchestrated task-based
>   mechanism for startup and shutdown in order to accomplish it.
>
>   Two callback types are supported at this point:
>
>   - TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts, prior
> to processing any tasks.
>   - TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it exits,
> after it has processed its last task but before the taskqueue is
> reclaimed.
>
>   While I'm here:
>
>   - Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use them
> in appropriate locations.
>   - Fix taskqueue.9 to mention taskqueue_start_threads(), which is a required
> interface for all consumers of taskqueue(9).
>
>   Reviewed by:  kib (all), eadler (taskqueue.9), brd (taskqueue.9)
>   Approved by:  ken (mentor)
>   Sponsored by: Spectra Logic
>   MFC after:1 month
>
> Modified:
>   head/share/man/man9/taskqueue.9
>   head/sys/kern/subr_taskqueue.c
>   head/sys/sys/taskqueue.h
>
> Modified: head/share/man/man9/taskqueue.9
> ==
> --- head/share/man/man9/taskqueue.9 Sat Mar 23 14:52:31 2013
> (r248648)
> +++ head/share/man/man9/taskqueue.9 Sat Mar 23 15:11:53 2013
> (r248649)
> @@ -53,12 +53,23 @@ struct task {
> void*ta_context;/* argument for handler */
>  };
>
> +enum taskqueue_callback_type {
> +   TASKQUEUE_CALLBACK_TYPE_INIT,
> +   TASKQUEUE_CALLBACK_TYPE_SHUTDOWN,
> +};
> +
> +typedef void (*taskqueue_callback_fn)(void *context);
> +
>  struct timeout_task;
>  .Ed
>  .Ft struct taskqueue *
>  .Fn taskqueue_create "const char *name" "int mflags" "taskqueue_enqueue_fn 
> enqueue" "void *context"
>  .Ft struct taskqueue *
>  .Fn taskqueue_create_fast "const char *name" "int mflags" 
> "taskqueue_enqueue_fn enqueue" "void *context"
> +.Ft int
> +.Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int pri" 
> "const char *name" "..."
> +.Ft void
> +.Fn taskqueue_set_callback "struct taskqueue *queue" "enum 
> taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void 
> *context"
>  .Ft void
>  .Fn taskqueue_free "struct taskqueue *queue"
>  .Ft int
> @@ -127,6 +138,23 @@ should be used to free the memory used b
>  Any tasks that are on the queue will be executed at this time after
>  which the thread servicing the queue will be signaled that it should exit.
>  .Pp
> +Once a taskqueue has been created, its threads should be started using
> +.Fn taskqueue_start_threads .
> +Callbacks may optionally be registered using
> +.Fn taskqueue_set_callback .
> +Currently, callbacks may be registered for the following purposes:
> +.Bl -tag -width TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
> +.It Dv TASKQUEUE_CALLBACK_TYPE_INIT
> +This callback is called by every thread in the taskqueue, before it executes
> +any tasks.
> +This callback must be set before the taskqueue's threads are started.
> +.It Dv TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
> +This callback is called by every thread in the taskqueue, after it executes
> +its last task.
> +This callback will always be called before the taskqueue structure is
> +reclaimed.
> +.El
> +.Pp
>  To add a task to the list of tasks queued on a taskqueue, call
>  .Fn taskqueue_enqueue
>  with pointers to the queue and task.
>
> Modified: head/sys/kern/subr_taskqueue.c
> ==
> --- head/sys/kern/subr_taskqueue.c  Sat Mar 23 14:52:31 2013
> (r248648)
> +++ head/sys/kern/subr_taskqueue.c  Sat Mar 23 15:11:53 2013
> (r248649)
> @@ -63,6 +63,8 @@ struct taskqueue {
> int tq_spin;
> int tq_flags;
> int tq_callouts;
> +   taskqueue_callback_fn   tq_callbacks[TASKQUEUE_NUM_CALLBACKS];
> +   void*tq_cb_contexts[TASKQUEUE_NUM_CALLBACKS];
>  };
>
>  #defineTQ_FLAGS_ACTIVE (1 << 0)
> @@ -78,6 +80,7 @@ struct taskqueue {
> else   

svn commit: r248653 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2013-03-23 Thread Will Andrews
Author: will
Date: Sat Mar 23 16:34:56 2013
New Revision: 248653
URL: http://svnweb.freebsd.org/changeset/base/248653

Log:
  ZFS: Fix a panic while unmounting a busy filesystem.
  
  This particular scenario was easily reproduced using a NFS export.  When the
  first 'zfs unmount' occurred, it returned EBUSY via this path, while
  vflush() had flushed references on the filesystem's root vnode, which in
  turn caused its v_interlock to be destroyed.  The next time 'zfs unmount'
  was called, vflush() tried to obtain this lock, which caused this panic.
  
  Since vflush() on FreeBSD is a definitive call, there is no need to check
  vfsp->vfs_count after it completes.  Simply #ifdef sun this check.
  
  Submitted by: avg
  Reviewed by:  avg
  Approved by:  ken (mentor)
  MFC after:1 month

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cSat Mar 
23 16:06:20 2013(r248652)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.cSat Mar 
23 16:34:56 2013(r248653)
@@ -1968,6 +1968,7 @@ zfs_umount(vfs_t *vfsp, int fflag)
return (ret);
}
 
+#ifdef sun
if (!(fflag & MS_FORCE)) {
/*
 * Check the number of active vnodes in the file system.
@@ -1988,6 +1989,7 @@ zfs_umount(vfs_t *vfsp, int fflag)
return (EBUSY);
}
}
+#endif
 
VERIFY(zfsvfs_teardown(zfsvfs, B_TRUE) == 0);
os = zfsvfs->z_os;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r248649 - in head: share/man/man9 sys/kern sys/sys

2013-03-23 Thread Will Andrews
I agree about the name length, it is a bit obnoxious.  However, it is also
descriptive.  TQCB strikes me as perhaps a bit too far in the other
direction.  How about TQ_CALLBACK_?  Is there an existing (pseudo)
convention for callback names?

Thanks,
--Will.


On Sat, Mar 23, 2013 at 10:20 AM,  wrote:

> On Sat, Mar 23, 2013 at 8:11 AM, Will Andrews  wrote:
> > Author: will
> > Date: Sat Mar 23 15:11:53 2013
> > New Revision: 248649
> > URL: http://svnweb.freebsd.org/changeset/base/248649
> >
> > Log:
> >   Extend taskqueue(9) to enable per-taskqueue callbacks.
> >
> >   The scope of these callbacks is primarily to support actions that
> affect the
> >   taskqueue's thread environments.  They are entirely optional, and
> >   consequently are introduced as a new API: taskqueue_set_callback().
> >
> >   This interface allows the caller to specify that a taskqueue requires a
> >   callback and optional context pointer for a given callback type.
> >
> >   The callback types included in this commit can be used to register a
> >   constructor and destructor for thread-local storage using osd(9).  This
> >   allows a particular taskqueue to define that its threads require a
> specific
> >   type of TLS, without the need for a specially-orchestrated task-based
> >   mechanism for startup and shutdown in order to accomplish it.
> >
> >   Two callback types are supported at this point:
> >
> >   - TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts,
> prior
> > to processing any tasks.
> >   - TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it
> exits,
> > after it has processed its last task but before the taskqueue is
> > reclaimed.
> >
> >   While I'm here:
> >
> >   - Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use
> them
> > in appropriate locations.
> >   - Fix taskqueue.9 to mention taskqueue_start_threads(), which is a
> required
> > interface for all consumers of taskqueue(9).
> >
> >   Reviewed by:  kib (all), eadler (taskqueue.9), brd (taskqueue.9)
> >   Approved by:  ken (mentor)
> >   Sponsored by: Spectra Logic
> >   MFC after:1 month
> >
> > Modified:
> >   head/share/man/man9/taskqueue.9
> >   head/sys/kern/subr_taskqueue.c
> >   head/sys/sys/taskqueue.h
> >
> > Modified: head/share/man/man9/taskqueue.9
> >
> ==
> > --- head/share/man/man9/taskqueue.9 Sat Mar 23 14:52:31 2013
>  (r248648)
> > +++ head/share/man/man9/taskqueue.9 Sat Mar 23 15:11:53 2013
>  (r248649)
> > @@ -53,12 +53,23 @@ struct task {
> > void*ta_context;/* argument for handler
> */
> >  };
> >
> > +enum taskqueue_callback_type {
> > +   TASKQUEUE_CALLBACK_TYPE_INIT,
> > +   TASKQUEUE_CALLBACK_TYPE_SHUTDOWN,
> > +};
> > +
> > +typedef void (*taskqueue_callback_fn)(void *context);
> > +
> >  struct timeout_task;
> >  .Ed
> >  .Ft struct taskqueue *
> >  .Fn taskqueue_create "const char *name" "int mflags"
> "taskqueue_enqueue_fn enqueue" "void *context"
> >  .Ft struct taskqueue *
> >  .Fn taskqueue_create_fast "const char *name" "int mflags"
> "taskqueue_enqueue_fn enqueue" "void *context"
> > +.Ft int
> > +.Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int
> pri" "const char *name" "..."
> > +.Ft void
> > +.Fn taskqueue_set_callback "struct taskqueue *queue" "enum
> taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void
> *context"
> >  .Ft void
> >  .Fn taskqueue_free "struct taskqueue *queue"
> >  .Ft int
> > @@ -127,6 +138,23 @@ should be used to free the memory used b
> >  Any tasks that are on the queue will be executed at this time after
> >  which the thread servicing the queue will be signaled that it should
> exit.
> >  .Pp
> > +Once a taskqueue has been created, its threads should be started using
> > +.Fn taskqueue_start_threads .
> > +Callbacks may optionally be registered using
> > +.Fn taskqueue_set_callback .
> > +Currently, callbacks may be registered for the following purposes:
> > +.Bl -tag -width TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
> > +.It Dv TASKQUEUE_CALLBACK_TYPE_INIT
> > +This callback is called by every thread in the taskqueue, before it
> executes
> > +any tasks.
> > +This callback must be set before the taskqueue's threads are started.
> > +.It Dv TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
> > +This callback is called by every thread in the taskqueue, after it
> executes
> > +its last task.
> > +This callback will always be called before the taskqueue structure is
> > +reclaimed.
> > +.El
> > +.Pp
> >  To add a task to the list of tasks queued on a taskqueue, call
> >  .Fn taskqueue_enqueue
> >  with pointers to the queue and task.
> >
> > Modified: head/sys/kern/subr_taskqueue.c
> >
> ==
> > --- head/sys/kern/subr_taskqueue.c  Sat Mar 23 14:52:31 2013
>  (r248648)
> > +++ head/sys/kern/subr_taskqueue.c  S

svn commit: r248654 - head/sys/sys

2013-03-23 Thread Will Andrews
Author: will
Date: Sat Mar 23 16:55:07 2013
New Revision: 248654
URL: http://svnweb.freebsd.org/changeset/base/248654

Log:
  Be more explicit about what each bio_cmd & bio_flags value means.
  
  Reviewed by:  ken (mentor)

Modified:
  head/sys/sys/bio.h

Modified: head/sys/sys/bio.h
==
--- head/sys/sys/bio.h  Sat Mar 23 16:34:56 2013(r248653)
+++ head/sys/sys/bio.h  Sat Mar 23 16:55:07 2013(r248654)
@@ -41,19 +41,23 @@
 #include 
 
 /* bio_cmd */
-#define BIO_READ   0x01
-#define BIO_WRITE  0x02
-#define BIO_DELETE 0x04
-#define BIO_GETATTR0x08
-#define BIO_FLUSH  0x10
+#define BIO_READ   0x01/* Read I/O data */
+#define BIO_WRITE  0x02/* Write I/O data */
+#define BIO_DELETE 0x04/* TRIM or free blocks, i.e. mark as unused */
+#define BIO_GETATTR0x08/* Get GEOM attributes of object */
+#define BIO_FLUSH  0x10/* Commit outstanding I/O now */
 #define BIO_CMD0   0x20/* Available for local hacks */
 #define BIO_CMD1   0x40/* Available for local hacks */
 #define BIO_CMD2   0x80/* Available for local hacks */
 
 /* bio_flags */
-#define BIO_ERROR  0x01
-#define BIO_DONE   0x02
-#define BIO_ONQUEUE0x04
+#define BIO_ERROR  0x01/* An error occurred processing this bio. */
+#define BIO_DONE   0x02/* This bio is finished. */
+#define BIO_ONQUEUE0x04/* This bio is in a queue & not yet taken. */
+/*
+ * This bio must be executed after all previous bios in the queue have been
+ * executed, and before any successive bios can be executed.
+ */
 #define BIO_ORDERED0x08
 #defineBIO_UNMAPPED0x10
 #defineBIO_TRANSIENT_MAPPING   0x20
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248655 - head/sys/arm/arm

2013-03-23 Thread Ian Lepore
Author: ian
Date: Sat Mar 23 17:17:06 2013
New Revision: 248655
URL: http://svnweb.freebsd.org/changeset/base/248655

Log:
  Don't check and warn about pmap mismatch on every call to busdma sync.
  With some recent busdma refactoring, sometimes it happens that a sync
  op gets called when bus_dmamap_load() never got called, which results
  in a spurious warning about a map mismatch when no sync operations will
  actually happen anyway.  Now the check is done only if a sync operation
  is actually performed, and the result of the check is a panic, not just
  a printf.
  
  Reviewed by:  cognet (who prevented me from donning a point hat)

Modified:
  head/sys/arm/arm/busdma_machdep-v6.c

Modified: head/sys/arm/arm/busdma_machdep-v6.c
==
--- head/sys/arm/arm/busdma_machdep-v6.cSat Mar 23 16:55:07 2013
(r248654)
+++ head/sys/arm/arm/busdma_machdep-v6.cSat Mar 23 17:17:06 2013
(r248655)
@@ -1150,19 +1150,16 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
vm_offset_t bbuf;
char _tmp_cl[arm_dcache_align], _tmp_clend[arm_dcache_align];
 #endif
-   /* if buffer was from user space, it it possible that this
-* is not the same vm map. The fix is to map each page in
-* the buffer into the current address space (KVM) and then
-* do the bounce copy or sync list cache operation.
-*
-* The sync list entries are already broken into
-* their respective physical pages.
-*/
-   if (!pmap_dmap_iscurrent(map->pmap))
-   printf("_bus_dmamap_sync: wrong user map: %p %x\n", map->pmap, 
op);
-
+   /*
+* If the buffer was from user space, it is possible that this is not
+* the same vm map, especially on a POST operation.  It's not clear that
+* dma on userland buffers can work at all right now, certainly not if a
+* partial cacheline flush has to be handled.  To be safe, until we're
+* able to test direct userland dma, panic on a map mismatch.
+*/
if ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) {
-
+   if (!pmap_dmap_iscurrent(map->pmap))
+   panic("_bus_dmamap_sync: wrong user map for bounce 
sync.");
/* Handle data bouncing. */
CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x op 0x%x "
"performing bounce", __func__, dmat, dmat->flags, op);
@@ -1188,9 +1185,6 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
}
 
if (op & BUS_DMASYNC_POSTREAD) {
-   if (!pmap_dmap_iscurrent(map->pmap))
-   panic("_bus_dmamap_sync: wrong user map. apply 
fix");
-
cpu_dcache_inv_range((vm_offset_t)bpage->vaddr,
bpage->datacount);
l2cache_inv_range((vm_offset_t)bpage->vaddr,
@@ -1230,6 +1224,8 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
return;
 
if (map->sync_count != 0) {
+   if (!pmap_dmap_iscurrent(map->pmap))
+   panic("_bus_dmamap_sync: wrong user map for sync.");
/* ARM caches are not self-snooping for dma */
 
sl = &map->slist[0];
@@ -1303,8 +1299,6 @@ _bus_dmamap_sync(bus_dma_tag_t dmat, bus
 
 #ifdef FIX_DMAP_BUS_DMASYNC_POSTREAD
case BUS_DMASYNC_POSTREAD:
-   if (!pmap_dmap_iscurrent(map->pmap))
-panic("_bus_dmamap_sync: wrong user map. apply 
fix");
while (sl != end) {
/* write back the unaligned portions */
vm_paddr_t physaddr;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r248649 - in head: share/man/man9 sys/kern sys/sys

2013-03-23 Thread mdf
On Sat, Mar 23, 2013 at 9:45 AM, Will Andrews  wrote:
> I agree about the name length, it is a bit obnoxious.  However, it is also
> descriptive.  TQCB strikes me as perhaps a bit too far in the other
> direction.  How about TQ_CALLBACK_?  Is there an existing (pseudo)
> convention for callback names?

I'm not sure FreeBSD has anything standard, but at $WORK we use CB or
cb frequently as an abbreviation for callback.  TASKQUEUE -> TQ still
removes 7 letters, which is a start. :-)

Thanks,
matthew


> On Sat, Mar 23, 2013 at 10:20 AM,  wrote:
>>
>> On Sat, Mar 23, 2013 at 8:11 AM, Will Andrews  wrote:
>> > Author: will
>> > Date: Sat Mar 23 15:11:53 2013
>> > New Revision: 248649
>> > URL: http://svnweb.freebsd.org/changeset/base/248649
>> >
>> > Log:
>> >   Extend taskqueue(9) to enable per-taskqueue callbacks.
>> >
>> >   The scope of these callbacks is primarily to support actions that
>> > affect the
>> >   taskqueue's thread environments.  They are entirely optional, and
>> >   consequently are introduced as a new API: taskqueue_set_callback().
>> >
>> >   This interface allows the caller to specify that a taskqueue requires
>> > a
>> >   callback and optional context pointer for a given callback type.
>> >
>> >   The callback types included in this commit can be used to register a
>> >   constructor and destructor for thread-local storage using osd(9).
>> > This
>> >   allows a particular taskqueue to define that its threads require a
>> > specific
>> >   type of TLS, without the need for a specially-orchestrated task-based
>> >   mechanism for startup and shutdown in order to accomplish it.
>> >
>> >   Two callback types are supported at this point:
>> >
>> >   - TASKQUEUE_CALLBACK_TYPE_INIT, called by every thread when it starts,
>> > prior
>> > to processing any tasks.
>> >   - TASKQUEUE_CALLBACK_TYPE_SHUTDOWN, called by every thread when it
>> > exits,
>> > after it has processed its last task but before the taskqueue is
>> > reclaimed.
>> >
>> >   While I'm here:
>> >
>> >   - Add two new macros, TQ_ASSERT_LOCKED and TQ_ASSERT_UNLOCKED, and use
>> > them
>> > in appropriate locations.
>> >   - Fix taskqueue.9 to mention taskqueue_start_threads(), which is a
>> > required
>> > interface for all consumers of taskqueue(9).
>> >
>> >   Reviewed by:  kib (all), eadler (taskqueue.9), brd (taskqueue.9)
>> >   Approved by:  ken (mentor)
>> >   Sponsored by: Spectra Logic
>> >   MFC after:1 month
>> >
>> > Modified:
>> >   head/share/man/man9/taskqueue.9
>> >   head/sys/kern/subr_taskqueue.c
>> >   head/sys/sys/taskqueue.h
>> >
>> > Modified: head/share/man/man9/taskqueue.9
>> >
>> > ==
>> > --- head/share/man/man9/taskqueue.9 Sat Mar 23 14:52:31 2013
>> > (r248648)
>> > +++ head/share/man/man9/taskqueue.9 Sat Mar 23 15:11:53 2013
>> > (r248649)
>> > @@ -53,12 +53,23 @@ struct task {
>> > void*ta_context;/* argument for handler
>> > */
>> >  };
>> >
>> > +enum taskqueue_callback_type {
>> > +   TASKQUEUE_CALLBACK_TYPE_INIT,
>> > +   TASKQUEUE_CALLBACK_TYPE_SHUTDOWN,
>> > +};
>> > +
>> > +typedef void (*taskqueue_callback_fn)(void *context);
>> > +
>> >  struct timeout_task;
>> >  .Ed
>> >  .Ft struct taskqueue *
>> >  .Fn taskqueue_create "const char *name" "int mflags"
>> > "taskqueue_enqueue_fn enqueue" "void *context"
>> >  .Ft struct taskqueue *
>> >  .Fn taskqueue_create_fast "const char *name" "int mflags"
>> > "taskqueue_enqueue_fn enqueue" "void *context"
>> > +.Ft int
>> > +.Fn taskqueue_start_threads "struct taskqueue **tqp" "int count" "int
>> > pri" "const char *name" "..."
>> > +.Ft void
>> > +.Fn taskqueue_set_callback "struct taskqueue *queue" "enum
>> > taskqueue_callback_type cb_type" "taskqueue_callback_fn callback" "void
>> > *context"
>> >  .Ft void
>> >  .Fn taskqueue_free "struct taskqueue *queue"
>> >  .Ft int
>> > @@ -127,6 +138,23 @@ should be used to free the memory used b
>> >  Any tasks that are on the queue will be executed at this time after
>> >  which the thread servicing the queue will be signaled that it should
>> > exit.
>> >  .Pp
>> > +Once a taskqueue has been created, its threads should be started using
>> > +.Fn taskqueue_start_threads .
>> > +Callbacks may optionally be registered using
>> > +.Fn taskqueue_set_callback .
>> > +Currently, callbacks may be registered for the following purposes:
>> > +.Bl -tag -width TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
>> > +.It Dv TASKQUEUE_CALLBACK_TYPE_INIT
>> > +This callback is called by every thread in the taskqueue, before it
>> > executes
>> > +any tasks.
>> > +This callback must be set before the taskqueue's threads are started.
>> > +.It Dv TASKQUEUE_CALLBACK_TYPE_SHUTDOWN
>> > +This callback is called by every thread in the taskqueue, after it
>> > executes
>> > +its last task.
>> > +This callback will always be called before the taskqueue structure is
>> > +reclaimed.
>> > +.El
>> 

svn commit: r248656 - head/bin/ed

2013-03-23 Thread John-Mark Gurney
Author: jmg
Date: Sat Mar 23 19:04:57 2013
New Revision: 248656
URL: http://svnweb.freebsd.org/changeset/base/248656

Log:
  Fix compiling ed w/ WITHOUT_ED_CRYPTO...  These variables aren't
  used..
  
  Submitted by:   deeptech71 at gmail dot com

Modified:
  head/bin/ed/cbc.c

Modified: head/bin/ed/cbc.c
==
--- head/bin/ed/cbc.c   Sat Mar 23 17:17:06 2013(r248655)
+++ head/bin/ed/cbc.c   Sat Mar 23 19:04:57 2013(r248656)
@@ -71,7 +71,6 @@ __FBSDID("$FreeBSD$");
 #ifdef DES
 static DES_cblock ivec;/* initialization vector */
 static DES_cblock pvec;/* padding vector */
-#endif
 
 static char bits[] = { /* used to extract bits from a char */
'\200', '\100', '\040', '\020', '\010', '\004', '\002', '\001'
@@ -79,13 +78,12 @@ static char bits[] = {  /* used to extr
 
 static int pflag;  /* 1 to preserve parity bits */
 
-#ifdef DES
 static DES_key_schedule schedule;  /* expanded DES key */
-#endif
 
 static unsigned char des_buf[8];/* shared buffer for get_des_char/put_des_char 
*/
 static int des_ct = 0; /* count for get_des_char/put_des_char */
 static int des_n = 0;  /* index for put_des_char/get_des_char */
+#endif
 
 /* init_des_cipher: initialize DES */
 void
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248657 - head/sys/dev/drm2/ttm

2013-03-23 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sat Mar 23 19:19:19 2013
New Revision: 248657
URL: http://svnweb.freebsd.org/changeset/base/248657

Log:
  drm/ttm: Fix TTM buffer object refcount
  
  This fixes memory leaks in the radeonkms driver.
  
  Reviewed by:  Konstantin Belousov (kib@)
  Tested by:J.R. Oldroyd 

Modified:
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sat Mar 23 19:04:57 2013
(r248656)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sat Mar 23 19:19:19 2013
(r248657)
@@ -122,9 +122,7 @@ retry:
m = NULL;
 
 reserve:
-   mtx_lock(&bo->glob->lru_lock);
-   ret = ttm_bo_reserve_locked(bo, false, false, false, 0);
-   mtx_unlock(&bo->glob->lru_lock);
+   ret = ttm_bo_reserve(bo, false, false, false, 0);
if (unlikely(ret != 0)) {
if (ret == -EBUSY) {
kern_yield(0);
@@ -253,10 +251,8 @@ static int
 ttm_bo_vm_ctor(void *handle, vm_ooffset_t size, vm_prot_t prot,
 vm_ooffset_t foff, struct ucred *cred, u_short *color)
 {
-   struct ttm_buffer_object *bo = handle;
 
*color = 0;
-   (void)ttm_bo_reference(bo);
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248658 - in head/sbin: fsck_ffs fsdb

2013-03-23 Thread Kirk McKusick
Author: mckusick
Date: Sat Mar 23 20:00:02 2013
New Revision: 248658
URL: http://svnweb.freebsd.org/changeset/base/248658

Log:
  Revert 248634 and 248643 (e.g., restoring 248625 and 248639).
  
  Build verified by: Glen Barber (gjb@)

Modified:
  head/sbin/fsck_ffs/fsck.h
  head/sbin/fsck_ffs/fsutil.c
  head/sbin/fsck_ffs/inode.c
  head/sbin/fsck_ffs/pass1.c
  head/sbin/fsck_ffs/pass5.c
  head/sbin/fsck_ffs/setup.c
  head/sbin/fsck_ffs/suj.c
  head/sbin/fsdb/fsdb.c

Modified: head/sbin/fsck_ffs/fsck.h
==
--- head/sbin/fsck_ffs/fsck.h   Sat Mar 23 19:19:19 2013(r248657)
+++ head/sbin/fsck_ffs/fsck.h   Sat Mar 23 20:00:02 2013(r248658)
@@ -198,7 +198,6 @@ struct timespec totalreadtime[BT_NUMBUFT
 struct timespec startprog;
 
 struct bufarea sblk;   /* file system superblock */
-struct bufarea cgblk;  /* cylinder group blocks */
 struct bufarea *pdirbp;/* current directory contents */
 struct bufarea *pbp;   /* current inode block */
 
@@ -216,9 +215,7 @@ struct bufarea *pbp;/* current inode b
 } while (0)
 
 #definesbdirty()   dirty(&sblk)
-#definecgdirty()   dirty(&cgblk)
 #definesblock  (*sblk.b_un.b_fs)
-#definecgrp(*cgblk.b_un.b_cg)
 
 enum fixstate {DONTKNOW, NOFIX, FIX, IGNORE};
 ino_t cursnapshot;
@@ -361,6 +358,37 @@ struct ufs2_dinode ufs2_zino;
 
 #defineEEXIT   8   /* Standard error exit. */
 
+int flushentry(void);
+/*
+ * Wrapper for malloc() that flushes the cylinder group cache to try 
+ * to get space.
+ */
+static inline void*
+Malloc(int size)
+{
+   void *retval;
+
+   while ((retval = malloc(size)) == NULL)
+   if (flushentry() == 0)
+   break;
+   return (retval);
+}
+
+/*
+ * Wrapper for calloc() that flushes the cylinder group cache to try 
+ * to get space.
+ */
+static inline void*
+Calloc(int cnt, int size)
+{
+   void *retval;
+
+   while ((retval = calloc(cnt, size)) == NULL)
+   if (flushentry() == 0)
+   break;
+   return (retval);
+}
+
 struct fstab;
 
 
@@ -378,7 +406,7 @@ voidcacheino(union dinode *dp, ino_t i
 void   catch(int);
 void   catchquit(int);
 intchangeino(ino_t dir, const char *name, ino_t newnum);
-intcheck_cgmagic(int cg, struct cg *cgp);
+intcheck_cgmagic(int cg, struct bufarea *cgbp);
 intchkrange(ufs2_daddr_t blk, int cnt);
 void   ckfini(int markclean);
 intckinode(union dinode *dp, struct inodesc *);
@@ -398,6 +426,7 @@ voidfreeino(ino_t ino);
 void   freeinodebuf(void);
 intftypeok(union dinode *dp);
 void   getblk(struct bufarea *bp, ufs2_daddr_t blk, long size);
+struct bufarea *cgget(int cg);
 struct bufarea *getdatablk(ufs2_daddr_t blkno, long size, int type);
 struct inoinfo *getinoinfo(ino_t inumber);
 union dinode   *getnextinode(ino_t inumber, int rebuildcg);

Modified: head/sbin/fsck_ffs/fsutil.c
==
--- head/sbin/fsck_ffs/fsutil.c Sat Mar 23 19:19:19 2013(r248657)
+++ head/sbin/fsck_ffs/fsutil.c Sat Mar 23 20:00:02 2013(r248658)
@@ -70,6 +70,7 @@ static struct timespec startpass, finish
 struct timeval slowio_starttime;
 int slowio_delay_usec = 1; /* Initial IO delay for background fsck */
 int slowio_pollcnt;
+static struct bufarea cgblk;   /* backup buffer for cylinder group blocks */
 static TAILQ_HEAD(buflist, bufarea) bufhead;   /* head of buffer cache list */
 static int numbufs;/* size of buffer cache */
 static char *buftype[BT_NUMBUFTYPES] = BT_NAMES;
@@ -163,7 +164,7 @@ bufinit(void)
char *bufp;
 
pbp = pdirbp = (struct bufarea *)0;
-   bufp = malloc((unsigned int)sblock.fs_bsize);
+   bufp = Malloc((unsigned int)sblock.fs_bsize);
if (bufp == 0)
errx(EEXIT, "cannot allocate buffer pool");
cgblk.b_un.b_buf = bufp;
@@ -173,8 +174,8 @@ bufinit(void)
if (bufcnt < MINBUFS)
bufcnt = MINBUFS;
for (i = 0; i < bufcnt; i++) {
-   bp = (struct bufarea *)malloc(sizeof(struct bufarea));
-   bufp = malloc((unsigned int)sblock.fs_bsize);
+   bp = (struct bufarea *)Malloc(sizeof(struct bufarea));
+   bufp = Malloc((unsigned int)sblock.fs_bsize);
if (bp == NULL || bufp == NULL) {
if (i >= MINBUFS)
break;
@@ -193,6 +194,57 @@ bufinit(void)
 }
 
 /*
+ * Manage cylinder group buffers.
+ */
+static struct bufarea *cgbufs; /* header for cylinder group cache */
+static int flushtries; /* number of tries to reclaim memory */
+
+struct bufarea *
+cgget(int cg)
+{
+   s

svn commit: r248659 - head/sys/conf

2013-03-23 Thread Martin Matuska
Author: mm
Date: Sat Mar 23 20:01:45 2013
New Revision: 248659
URL: http://svnweb.freebsd.org/changeset/base/248659

Log:
  Fix kernel build with options ZFS after r24571 (libzfs_core).
  
  Submitted by: Bjoern A. Zeeb 

Modified:
  head/sys/conf/files

Modified: head/sys/conf/files
==
--- head/sys/conf/files Sat Mar 23 20:00:02 2013(r248658)
+++ head/sys/conf/files Sat Mar 23 20:01:45 2013(r248659)
@@ -197,10 +197,12 @@ cddl/contrib/opensolaris/uts/common/fs/z
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c  
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c 
optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c   
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c   
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c  
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c  
optional zfs compile-with "${ZFS_C}"
+cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c  
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c  
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c  
optional zfs compile-with "${ZFS_C}"
 cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c   
optional zfs compile-with "${ZFS_C}"
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r248571 - in head: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zhack cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cm

2013-03-23 Thread Martin Matuska
Fixed in r248659.
Thanks.

On 23.3.2013 16:47, Bjoern A. Zeeb wrote:
> On Thu, 21 Mar 2013, Martin Matuska wrote:
>
>> Author: mm
>> Date: Thu Mar 21 08:38:03 2013
>> New Revision: 248571
>> URL: http://svnweb.freebsd.org/changeset/base/248571
>>
>> Log:
>>  Merge libzfs_core branch:
>>includes MFV 238590, 238592, 247580
> ...
>> Added:
>>  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
>> - copied unchanged from r248551,
>> projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.c
>>  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h
>> - copied unchanged from r248551,
>> projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_compat.h
>>  head/cddl/contrib/opensolaris/lib/libzfs_core/
>> - copied from r248551,
>> projects/libzfs_core/cddl/contrib/opensolaris/lib/libzfs_core/
>>  head/cddl/lib/libzfs_core/
>> - copied from r248551, projects/libzfs_core/cddl/lib/libzfs_core/
>>  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
>> - copied unchanged from r248551,
>> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c
>>  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
>> - copied unchanged from r248551,
>> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c
>>  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h
>> - copied unchanged from r248551,
>> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_send.h
>>  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h
>> - copied unchanged from r248551,
>> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_destroy.h
>>  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h
>> - copied unchanged from r248551,
>> projects/libzfs_core/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_userhold.h
>
>
> in the theoretical event someone would want to compile zfs into the
> kernel,
> given r233578 added support for that, one would need this:
>
> mm, peter?
>
> Index: sys/conf/files
> ===
> --- sys/conf/files  (revision 248649)
> +++ sys/conf/files  (working copy)
> @@ -197,11 +197,13 @@ cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_s
>  cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c   
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deadlist.c  
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c 
> optional
> zfs compile-with "${ZFS_C}"
> +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_destroy.c   
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c   
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c  
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c  
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scan.c  
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c  
> optional
> zfs compile-with "${ZFS_C}"
> +cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_userhold.c  
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/gzip.c  
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/lz4.c   
> optional
> zfs compile-with "${ZFS_C}"
>  cddl/contrib/opensolaris/uts/common/fs/zfs/lzjb.c  
> optional
> zfs compile-with "${ZFS_C}"
>
>


-- 
Martin Matuska
FreeBSD committer
http://blog.vx.sk

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


svn commit: r248660 - in vendor-sys/illumos/dist/uts/common/fs/zfs: . sys

2013-03-23 Thread Martin Matuska
Author: mm
Date: Sat Mar 23 20:17:32 2013
New Revision: 248660
URL: http://svnweb.freebsd.org/changeset/base/248660

Log:
  Update vendor-sys/illumos/dist to illumos-gate 13990:b04b9a80047a
  
  Illumos ZFS issues:
3618 ::zio dcmd does not show timestamp data

Modified:
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c
  vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h   Sat Mar 23 
20:01:45 2013(r248659)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/vdev_impl.h   Sat Mar 23 
20:17:32 2013(r248660)
@@ -104,8 +104,7 @@ struct vdev_queue {
avl_tree_t  vq_read_tree;
avl_tree_t  vq_write_tree;
avl_tree_t  vq_pending_tree;
-   uint64_tvq_io_complete_ts;
-   uint64_tvq_io_delta_ts;
+   hrtime_tvq_io_complete_ts;
kmutex_tvq_lock;
 };
 

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h Sat Mar 23 20:01:45 
2013(r248659)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/sys/zio.h Sat Mar 23 20:17:32 
2013(r248660)
@@ -408,7 +408,7 @@ struct zio {
 
uint64_tio_offset;
uint64_tio_deadline;
-   uint64_tio_timestamp;
+   hrtime_tio_timestamp;
avl_node_t  io_offset_node;
avl_node_t  io_deadline_node;
avl_tree_t  *io_vdev_tree;

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.cSat Mar 23 20:01:45 
2013(r248659)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev.cSat Mar 23 20:17:32 
2013(r248660)
@@ -3180,10 +3180,10 @@ vdev_deadman(vdev_t *vd)
 * the spa_deadman_synctime we panic the system.
 */
fio = avl_first(&vq->vq_pending_tree);
-   delta = ddi_get_lbolt64() - fio->io_timestamp;
-   if (delta > NSEC_TO_TICK(spa_deadman_synctime(spa))) {
-   zfs_dbgmsg("SLOW IO: zio timestamp %llu, "
-   "delta %llu, last io %llu",
+   delta = gethrtime() - fio->io_timestamp;
+   if (delta > spa_deadman_synctime(spa)) {
+   zfs_dbgmsg("SLOW IO: zio timestamp %lluns, "
+   "delta %lluns, last io %lluns",
fio->io_timestamp, delta,
vq->vq_io_complete_ts);
fm_panic("I/O to pool '%s' appears to be "

Modified: vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c
==
--- vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c  Sat Mar 23 
20:01:45 2013(r248659)
+++ vendor-sys/illumos/dist/uts/common/fs/zfs/vdev_queue.c  Sat Mar 23 
20:17:32 2013(r248660)
@@ -45,8 +45,11 @@
 int zfs_vdev_max_pending = 10;
 int zfs_vdev_min_pending = 4;
 
-/* deadline = pri + ddi_get_lbolt64() >> time_shift) */
-int zfs_vdev_time_shift = 6;
+/*
+ * The deadlines are grouped into buckets based on zfs_vdev_time_shift:
+ * deadline = pri + gethrtime() >> time_shift)
+ */
+int zfs_vdev_time_shift = 29; /* each bucket is 0.537 seconds */
 
 /* exponential I/O issue ramp-up rate */
 int zfs_vdev_ramp_rate = 2;
@@ -412,7 +415,7 @@ vdev_queue_io(zio_t *zio)
 
mutex_enter(&vq->vq_lock);
 
-   zio->io_timestamp = ddi_get_lbolt64();
+   zio->io_timestamp = gethrtime();
zio->io_deadline = (zio->io_timestamp >> zfs_vdev_time_shift) +
zio->io_priority;
 
@@ -445,8 +448,7 @@ vdev_queue_io_done(zio_t *zio)
 
vdev_queue_pending_remove(vq, zio);
 
-   vq->vq_io_complete_ts = ddi_get_lbolt64();
-   vq->vq_io_delta_ts = vq->vq_io_complete_ts - zio->io_timestamp;
+   vq->vq_io_complete_ts = gethrtime();
 
for (int i = 0; i < zfs_vdev_ramp_rate; i++) {
zio_t *nio = vdev_queue_io_to_issue(vq, zfs_vdev_max_pending);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248661 - head/sys/dev/drm2/ttm

2013-03-23 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sat Mar 23 20:43:26 2013
New Revision: 248661
URL: http://svnweb.freebsd.org/changeset/base/248661

Log:
  drm/ttm: Explain why we don't need to acquire a ref in ttm_bo_vm_ctor()

Modified:
  head/sys/dev/drm2/ttm/ttm_bo_vm.c

Modified: head/sys/dev/drm2/ttm/ttm_bo_vm.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sat Mar 23 20:17:32 2013
(r248660)
+++ head/sys/dev/drm2/ttm/ttm_bo_vm.c   Sat Mar 23 20:43:26 2013
(r248661)
@@ -252,6 +252,11 @@ ttm_bo_vm_ctor(void *handle, vm_ooffset_
 vm_ooffset_t foff, struct ucred *cred, u_short *color)
 {
 
+   /*
+* We don't acquire a reference on bo->kref here, because it was
+* already done in ttm_bo_mmap_single().
+*/
+
*color = 0;
return (0);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248663 - head/sys/dev/drm2/ttm

2013-03-23 Thread Jean-Sebastien Pedron
Author: dumbbell
Date: Sat Mar 23 20:46:47 2013
New Revision: 248663
URL: http://svnweb.freebsd.org/changeset/base/248663

Log:
  drm/ttm: Fix a typo: s/pTTM]/[TTM]/

Modified:
  head/sys/dev/drm2/ttm/ttm_memory.c

Modified: head/sys/dev/drm2/ttm/ttm_memory.c
==
--- head/sys/dev/drm2/ttm/ttm_memory.c  Sat Mar 23 20:43:28 2013
(r248662)
+++ head/sys/dev/drm2/ttm/ttm_memory.c  Sat Mar 23 20:46:47 2013
(r248663)
@@ -51,7 +51,7 @@ MALLOC_DEFINE(M_TTM_ZONE, "ttm_zone", "T
 static void ttm_mem_zone_kobj_release(struct ttm_mem_zone *zone)
 {
 
-   printf("pTTM] Zone %7s: Used memory at exit: %llu kiB\n",
+   printf("[TTM] Zone %7s: Used memory at exit: %llu kiB\n",
zone->name, (unsigned long long)zone->used_mem >> 10);
free(zone, M_TTM_ZONE);
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248664 - head/contrib/libarchive/libarchive

2013-03-23 Thread Martin Matuska
Author: mm
Date: Sat Mar 23 21:34:10 2013
New Revision: 248664
URL: http://svnweb.freebsd.org/changeset/base/248664

Log:
  Merge bugfix from vendor master branch:
  
  Limit write requests to at most INT_MAX.
  This prevents a certain common programming error (passing -1 to write)
  from leading to other problems deeper in the library.
  
  References:
  https://github.com/libarchive/libarchive/commit/22531545514043e0
  
  Reported by:  Xin Li 
  Obtained from:  libarchive (master branch)

Modified:
  head/contrib/libarchive/libarchive/archive_write.c

Modified: head/contrib/libarchive/libarchive/archive_write.c
==
--- head/contrib/libarchive/libarchive/archive_write.c  Sat Mar 23 20:46:47 
2013(r248663)
+++ head/contrib/libarchive/libarchive/archive_write.c  Sat Mar 23 21:34:10 
2013(r248664)
@@ -671,8 +671,13 @@ static ssize_t
 _archive_write_data(struct archive *_a, const void *buff, size_t s)
 {
struct archive_write *a = (struct archive_write *)_a;
+   const size_t max_write = INT_MAX;
+
archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
ARCHIVE_STATE_DATA, "archive_write_data");
+   /* In particular, this catches attempts to pass negative values. */
+   if (s > max_write)
+   s = max_write;
archive_clear_error(&a->archive);
return ((a->format_write_data)(a, buff, s));
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248665 - in stable/9/sys: geom kern sys ufs/ffs

2013-03-23 Thread Kirk McKusick
Author: mckusick
Date: Sat Mar 23 21:56:19 2013
New Revision: 248665
URL: http://svnweb.freebsd.org/changeset/base/248665

Log:
  MFC of 246876 and 246877
  
  MFC: 246876:
  
  Add barrier write capability to the VFS buffer interface. A barrier
  write is a disk write request that tells the disk that the buffer
  being written must be committed to the media along with any writes
  that preceeded it before any future blocks may be written to the drive.
  
  Barrier writes are provided by adding the functions bbarrierwrite
  (bwrite with barrier) and babarrierwrite (bawrite with barrier).
  
  Following a bbarrierwrite the client knows that the requested buffer
  is on the media. It does not ensure that buffers written before that
  buffer are on the media. It only ensure that buffers written before
  that buffer will get to the media before any buffers written after
  that buffer. A flush command must be sent to the disk to ensure that
  all earlier written buffers are on the media.
  
  Reviewed by: kib
  Tested by:   Peter Holm
  
  MFC 246877:
  
  The UFS2 filesystem allocates new blocks of inodes as they are needed.
  When a cylinder group runs short of inodes, a new block for inodes is
  allocated, zero'ed, and written to the disk. The zero'ed inodes must
  be on the disk before the cylinder group can be updated to claim them.
  If the cylinder group claiming the new inodes were written before the
  zero'ed block of inodes, the system could crash with the filesystem in
  an unrecoverable state.
  
  Rather than adding a soft updates dependency to ensure that the new
  inode block is written before it is claimed by the cylinder group
  map, we just do a barrier write of the zero'ed inode block to ensure
  that it will get written before the updated cylinder group map can
  be written. This change should only slow down bulk loading of newly
  created filesystems since that is the primary time that new inode
  blocks need to be created.
  
  Reported by: Robert Watson
  Reviewed by: kib
  Tested by:   Peter Holm

Modified:
  stable/9/sys/geom/geom_vfs.c
  stable/9/sys/kern/vfs_bio.c
  stable/9/sys/kern/vfs_cluster.c
  stable/9/sys/sys/buf.h
  stable/9/sys/ufs/ffs/ffs_alloc.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)
  stable/9/sys/dev/   (props changed)
  stable/9/sys/dev/e1000/   (props changed)
  stable/9/sys/dev/isp/   (props changed)
  stable/9/sys/dev/ixgbe/   (props changed)
  stable/9/sys/dev/puc/   (props changed)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/modules/   (props changed)
  stable/9/sys/net/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/geom/geom_vfs.c
==
--- stable/9/sys/geom/geom_vfs.cSat Mar 23 21:34:10 2013
(r248664)
+++ stable/9/sys/geom/geom_vfs.cSat Mar 23 21:56:19 2013
(r248665)
@@ -168,6 +168,10 @@ g_vfs_strategy(struct bufobj *bo, struct
bip->bio_done = g_vfs_done;
bip->bio_caller2 = bp;
bip->bio_length = bp->b_bcount;
+   if (bp->b_flags & B_BARRIER) {
+   bip->bio_flags |= BIO_ORDERED;
+   bp->b_flags &= ~B_BARRIER;
+   }
g_io_request(bip, cp);
 }
 

Modified: stable/9/sys/kern/vfs_bio.c
==
--- stable/9/sys/kern/vfs_bio.c Sat Mar 23 21:34:10 2013(r248664)
+++ stable/9/sys/kern/vfs_bio.c Sat Mar 23 21:56:19 2013(r248665)
@@ -206,6 +206,9 @@ SYSCTL_INT(_vfs, OID_AUTO, flushbufqtarg
 static long notbufdflashes;
 SYSCTL_LONG(_vfs, OID_AUTO, notbufdflashes, CTLFLAG_RD, ¬bufdflashes, 0,
 "Number of dirty buffer flushes done by the bufdaemon helpers");
+static long barrierwrites;
+SYSCTL_LONG(_vfs, OID_AUTO, barrierwrites, CTLFLAG_RW, &barrierwrites, 0,
+"Number of barrier writes");
 
 /*
  * Wakeup point for bufdaemon, as well as indicator of whether it is already
@@ -914,6 +917,9 @@ bufwrite(struct buf *bp)
return (0);
}
 
+   if (bp->b_flags & B_BARRIER)
+   barrierwrites++;
+
oldflags = bp->b_flags;
 
BUF_ASSERT_HELD(bp);
@@ -1033,6 +1039,8 @@ bdwrite(struct buf *bp)
 
CTR3(KTR_BUF, "bdwrite(%p) vp %p flags %X", bp, bp-

svn commit: r248666 - head/sys/dev/drm2/ttm

2013-03-23 Thread Konstantin Belousov
Author: kib
Date: Sat Mar 23 22:23:15 2013
New Revision: 248666
URL: http://svnweb.freebsd.org/changeset/base/248666

Log:
  Do not call malloc(M_WAITOK) while bodev->fence_lock mutex is
  held. The ttm_buffer_object_transfer() does not need the mutex locked
  at all, except for the call to the driver sync_obj_ref() method.
  
  Reported and tested by:   dumbbell
  MFC after:   2 weeks

Modified:
  head/sys/dev/drm2/ttm/ttm_bo_util.c

Modified: head/sys/dev/drm2/ttm/ttm_bo_util.c
==
--- head/sys/dev/drm2/ttm/ttm_bo_util.c Sat Mar 23 21:56:19 2013
(r248665)
+++ head/sys/dev/drm2/ttm/ttm_bo_util.c Sat Mar 23 22:23:15 2013
(r248666)
@@ -391,12 +391,11 @@ static void ttm_transfered_destroy(struc
  * !0: Failure.
  */
 
-static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
- struct ttm_buffer_object **new_obj)
+static int
+ttm_buffer_object_transfer(struct ttm_buffer_object *bo,
+void *sync_obj, struct ttm_buffer_object **new_obj)
 {
struct ttm_buffer_object *fbo;
-   struct ttm_bo_device *bdev = bo->bdev;
-   struct ttm_bo_driver *driver = bdev->driver;
 
fbo = malloc(sizeof(*fbo), M_TTM_TRANSF_OBJ, M_ZERO | M_WAITOK);
*fbo = *bo;
@@ -413,7 +412,7 @@ static int ttm_buffer_object_transfer(st
fbo->vm_node = NULL;
atomic_set(&fbo->cpu_writers, 0);
 
-   fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj);
+   fbo->sync_obj = sync_obj;
refcount_init(&fbo->list_kref, 1);
refcount_init(&fbo->kref, 1);
fbo->destroy = &ttm_transfered_destroy;
@@ -594,6 +593,7 @@ int ttm_bo_move_accel_cleanup(struct ttm
int ret;
struct ttm_buffer_object *ghost_obj;
void *tmp_obj = NULL;
+   void *sync_obj_ref;
 
mtx_lock(&bdev->fence_lock);
if (bo->sync_obj) {
@@ -627,9 +627,10 @@ int ttm_bo_move_accel_cleanup(struct ttm
 
set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags);
 
-   /* ttm_buffer_object_transfer accesses bo->sync_obj */
-   ret = ttm_buffer_object_transfer(bo, &ghost_obj);
+   sync_obj_ref = bo->bdev->driver->sync_obj_ref(bo->sync_obj);
mtx_unlock(&bdev->fence_lock);
+   /* ttm_buffer_object_transfer accesses bo->sync_obj */
+   ret = ttm_buffer_object_transfer(bo, sync_obj_ref, &ghost_obj);
if (tmp_obj)
driver->sync_obj_unref(&tmp_obj);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248667 - stable/9/sys/ufs/ffs

2013-03-23 Thread Konstantin Belousov
Author: kib
Date: Sat Mar 23 22:41:48 2013
New Revision: 248667
URL: http://svnweb.freebsd.org/changeset/base/248667

Log:
  MFC r247387:
  Inode block must not be read or written while cg block buffer is owned.

Modified:
  stable/9/sys/ufs/ffs/ffs_alloc.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ufs/ffs/ffs_alloc.c
==
--- stable/9/sys/ufs/ffs/ffs_alloc.cSat Mar 23 22:23:15 2013
(r248666)
+++ stable/9/sys/ufs/ffs/ffs_alloc.cSat Mar 23 22:41:48 2013
(r248667)
@@ -1724,6 +1724,17 @@ fail:
return (0);
 }
 
+static inline struct buf *
+getinobuf(struct inode *ip, u_int cg, u_int32_t cginoblk, int gbflags)
+{
+   struct fs *fs;
+
+   fs = ip->i_fs;
+   return (getblk(ip->i_devvp, fsbtodb(fs, ino_to_fsba(fs,
+   cg * fs->fs_ipg + cginoblk)), (int)fs->fs_bsize, 0, 0,
+   gbflags));
+}
+
 /*
  * Determine whether an inode can be allocated.
  *
@@ -1748,9 +1759,11 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu
u_int8_t *inosused;
struct ufs2_dinode *dp2;
int error, start, len, loc, map, i;
+   u_int32_t old_initediblk;
 
fs = ip->i_fs;
ump = ip->i_ump;
+check_nifree:
if (fs->fs_cs(fs, cg).cs_nifree == 0)
return (0);
UFS_UNLOCK(ump);
@@ -1762,13 +1775,13 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu
return (0);
}
cgp = (struct cg *)bp->b_data;
+restart:
if (!cg_chkmagic(cgp) || cgp->cg_cs.cs_nifree == 0) {
brelse(bp);
UFS_LOCK(ump);
return (0);
}
bp->b_xflags |= BX_BKGRDWRITE;
-   cgp->cg_old_time = cgp->cg_time = time_second;
inosused = cg_inosused(cgp);
if (ipref) {
ipref %= fs->fs_ipg;
@@ -1796,7 +1809,6 @@ ffs_nodealloccg(ip, cg, ipref, mode, unu
panic("ffs_nodealloccg: block not in map");
}
ipref = i * NBBY + ffs(map) - 1;
-   cgp->cg_irotor = ipref;
 gotit:
/*
 * Check to see if we need to initialize more inodes.
@@ -1804,9 +1816,37 @@ gotit:
if (fs->fs_magic == FS_UFS2_MAGIC &&
ipref + INOPB(fs) > cgp->cg_initediblk &&
cgp->cg_initediblk < cgp->cg_niblk) {
-   ibp = getblk(ip->i_devvp, fsbtodb(fs,
-   ino_to_fsba(fs, cg * fs->fs_ipg + cgp->cg_initediblk)),
-   (int)fs->fs_bsize, 0, 0, 0);
+   old_initediblk = cgp->cg_initediblk;
+
+   /*
+* Free the cylinder group lock before writing the
+* initialized inode block.  Entering the
+* babarrierwrite() with the cylinder group lock
+* causes lock order violation between the lock and
+* snaplk.
+*
+* Another thread can decide to initialize the same
+* inode block, but whichever thread first gets the
+* cylinder group lock after writing the newly
+* allocated inode block will update it and the other
+* will realize that it has lost and leave the
+* cylinder group unchanged.
+*/
+   ibp = getinobuf(ip, cg, old_initediblk, GB_LOCK_NOWAIT);
+   brelse(bp);
+   if (ibp == NULL) {
+   /*
+* The inode block buffer is already owned by
+* another thread, which must initialize it.
+* Wait on the buffer to allow another thread
+* to finish the updates, with dropped cg
+* buffer lock, then retry.
+*/
+   ibp = getinobuf(ip, cg, old_initediblk, 0);
+   brelse(ibp);
+   UFS_LOCK(ump);
+   goto check_nifree;
+   }
bzero(ibp->b_data, (int)fs->fs_bsize);
dp2 = (struct ufs2_dinode *)(ibp->b_data);
for (i = 0; i < INOPB(fs); i++) {
@@ -1823,8 +1863,29 @@ gotit:
 * loading of newly created filesystems.
 */
babarrierwrite(ibp);
-   cgp->cg_initediblk += INOPB(fs);
+
+   /*
+* After the inode block is written, try to update the
+* cg initediblk pointer.  If another thread beat us
+* to it, then leave it unchanged as the other thread
+* has already set it correctly.
+*/
+   error = bread(ip->i_devvp, fsbtodb(fs, cgtod(fs, cg)),
+   (int)fs->fs_cgsize, NOCRED, &bp);
+   UFS_LOCK(ump);
+   ACTIVECLEAR(fs, cg);
+   UFS_UNLOCK(ump);
+   if (error != 0) {
+   brelse(bp);
+   

svn commit: r248668 - head/tools/tools/ath/athstats

2013-03-23 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 23 23:20:38 2013
New Revision: 248668
URL: http://svnweb.freebsd.org/changeset/base/248668

Log:
  Expose the beacon miss counter.

Modified:
  head/tools/tools/ath/athstats/athstats.c

Modified: head/tools/tools/ath/athstats/athstats.c
==
--- head/tools/tools/ath/athstats/athstats.cSat Mar 23 22:41:48 2013
(r248667)
+++ head/tools/tools/ath/athstats/athstats.cSat Mar 23 23:20:38 2013
(r248668)
@@ -418,12 +418,14 @@ static const struct fmt athstats[] = {
{ 4,"asignal",  "asig", "signal of last ack (dBm)" },
 #defineS_RX_SIGNAL AFTER(S_TX_SIGNAL)
{ 4,"signal",   "sig",  "avg recv signal (dBm)" },
+#defineS_BMISSCOUNTAFTER(S_RX_SIGNAL)
+   { 8,"bmisscount",   "bmisscnt", "beacon miss count" },
 
 };
 #defineS_PHY_MIN   S_RX_PHY_UNDERRUN
 #defineS_PHY_MAX   S_RX_PHY_CCK_RESTART
 #defineS_LAST  S_ANT_TX0
-#defineS_MAX   S_ANT_RX7+1
+#defineS_MAX   S_BMISSCOUNT+1
 
 /*
  * XXX fold this into the external HAL definitions! -adrian
@@ -752,6 +754,7 @@ ath_get_curstat(struct statfoo *sf, int 
case S_FF_RX:   STAT(ff_rx);
case S_FF_FLUSH:STAT(ff_flush);
case S_TX_QFULL:STAT(tx_qfull);
+   case S_BMISSCOUNT:  STAT(be_missed);
case S_RX_NOISE:
snprintf(b, bs, "%d", wf->cur.ath.ast_rx_noise);
return 1;
@@ -993,6 +996,7 @@ ath_get_totstat(struct statfoo *sf, int 
case S_FF_RX:   STAT(ff_rx);
case S_FF_FLUSH:STAT(ff_flush);
case S_TX_QFULL:STAT(tx_qfull);
+   case S_BMISSCOUNT:  STAT(be_missed);
case S_RX_NOISE:
snprintf(b, bs, "%d", wf->total.ath.ast_rx_noise);
return 1;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248669 - head/tools/tools/ath/athstats

2013-03-23 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 23 23:27:16 2013
New Revision: 248669
URL: http://svnweb.freebsd.org/changeset/base/248669

Log:
  More indentation fixes.

Modified:
  head/tools/tools/ath/athstats/athstats.c

Modified: head/tools/tools/ath/athstats/athstats.c
==
--- head/tools/tools/ath/athstats/athstats.cSat Mar 23 23:20:38 2013
(r248668)
+++ head/tools/tools/ath/athstats/athstats.cSat Mar 23 23:27:16 2013
(r248669)
@@ -86,7 +86,7 @@ static const struct fmt athstats[] = {
 #defineS_TX_LINEAR AFTER(S_MIB)
{ 5,"txlinear", "txlinear", "tx linearized to cluster" },
 #defineS_BSTUCKAFTER(S_TX_LINEAR)
-   { 5,"bstuck",   "bstuck",   "stuck beacon conditions" },
+   { 6,"bstuck",   "bstuck",   "stuck beacon conditions" },
 #defineS_INTRCOAL  AFTER(S_BSTUCK)
{ 5,"intrcoal", "intrcoal", "interrupts coalesced" },
 #defineS_RATE  AFTER(S_INTRCOAL)
@@ -292,15 +292,15 @@ static const struct fmt athstats[] = {
{ 7,"txaggrfailall","TXAFALL",  "A-MPDU TX frame 
failures" },
 #ifndef __linux__
 #defineS_CABQ_XMIT AFTER(S_TX_AGGR_FAILALL)
-   { 5,"cabxmit",  "cabxmit",  "cabq frames transmitted" },
+   { 7,"cabxmit",  "cabxmit",  "cabq frames transmitted" },
 #defineS_CABQ_BUSY AFTER(S_CABQ_XMIT)
-   { 5,"cabqbusy", "cabqbusy", "cabq xmit overflowed beacon 
interval" },
+   { 8,"cabqbusy", "cabqbusy", "cabq xmit overflowed beacon 
interval" },
 #defineS_TX_NODATA AFTER(S_CABQ_BUSY)
-   { 5,"txnodata", "txnodata", "tx discarded empty frame" },
+   { 8,"txnodata", "txnodata", "tx discarded empty frame" },
 #defineS_TX_BUSDMA AFTER(S_TX_NODATA)
-   { 5,"txbusdma", "txbusdma", "tx failed for dma resrcs" },
+   { 8,"txbusdma", "txbusdma", "tx failed for dma resrcs" },
 #defineS_RX_BUSDMA AFTER(S_TX_BUSDMA)
-   { 5,"rxbusdma", "rxbusdma", "rx setup failed for dma 
resrcs" },
+   { 8,"rxbusdma", "rxbusdma", "rx setup failed for dma 
resrcs" },
 #defineS_FF_TXOK   AFTER(S_RX_BUSDMA)
 #else
 #defineS_FF_TXOK   AFTER(S_TX_AGGR_FAILALL)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248670 - head/sys/dev/ath/ath_hal/ar5416

2013-03-23 Thread Adrian Chadd
Author: adrian
Date: Sat Mar 23 23:51:11 2013
New Revision: 248670
URL: http://svnweb.freebsd.org/changeset/base/248670

Log:
  CABQ calculation changes to try and fix some weird corner cases leading
  to stuck beacons.
  
  * Set the cabq readytime (ie, how long to burst for) to 50% of the total
beacon interval time
  * fix the cabq adjustment calculation based on how the beacon offset is
calculated (the SWBA/DBA time offset.)
  
  This is all still a bit magic voodoo but it does seem to have further
  quietened issues with missed/stuck beacons under my local testing.
  In any case, it better matches what the reference HAL implements.
  
  Obtained from:Qualcomm Atheros

Modified:
  head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c

Modified: head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c
==
--- head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c   Sat Mar 23 23:27:16 
2013(r248669)
+++ head/sys/dev/ath/ath_hal/ar5416/ar5416_xmit.c   Sat Mar 23 23:51:11 
2013(r248670)
@@ -1191,10 +1191,10 @@ ar5416ResetTxQueue(struct ath_hal *ah, u
 * XXX which I gather is because of such a long
 * XXX cabq time.)
 */
-   value = (ahp->ah_beaconInterval * 70 / 100)
-   - (ah->ah_config.ah_sw_beacon_response_time
-   + ah->ah_config.ah_dma_beacon_response_time)
-   - ah->ah_config.ah_additional_swba_backoff;
+   value = (ahp->ah_beaconInterval * 50 / 100)
+   - ah->ah_config.ah_additional_swba_backoff
+   - ah->ah_config.ah_sw_beacon_response_time
+   + ah->ah_config.ah_dma_beacon_response_time;
/*
 * XXX Ensure it isn't too low - nothing lower
 * XXX than 10 TU
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248671 - head/sys/dev/ath

2013-03-23 Thread Adrian Chadd
Author: adrian
Date: Sun Mar 24 00:03:12 2013
New Revision: 248671
URL: http://svnweb.freebsd.org/changeset/base/248671

Log:
  Overhaul the TXQ locking (again!) as part of some beacon/cabq timing
  related issues.
  
  Moving the TX locking under one lock made things easier to progress on
  but it had one important side-effect - it increased the latency when
  handling CABQ setup when sending beacons.
  
  This commit introduces a bunch of new changes and a few unrelated changs
  that are just easier to lump in here.
  
  The aim is to have the CABQ locking separate from other locking.
  The CABQ transmit path in the beacon process thus doesn't have to grab
  the general TX lock, reducing lock contention/latency and making it
  more likely that we'll make the beacon TX timing.
  
  The second half of this commit is the CABQ related setup changes needed
  for sane looking EDMA CABQ support.  Right now the EDMA TX code naively
  assumes that only one frame (MPDU or A-MPDU) is being pushed into each
  FIFO slot.  For the CABQ this isn't true - a whole list of frames is
  being pushed in - and thus CABQ handling breaks very quickly.
  
  The aim here is to setup the CABQ list and then push _that list_ to
  the hardware for transmission.  I can then extend the EDMA TX code
  to stamp that list as being "one" FIFO entry (likely by tagging the
  last buffer in that list as "FIFO END") so the EDMA TX completion code
  correctly tracks things.
  
  Major:
  
  * Migrate the per-TXQ add/removal locking back to per-TXQ, rather than
a single lock.
  
  * Leave the software queue side of things under the ATH_TX_LOCK lock,
(continuing) to serialise things as they are.
  
  * Add a new function which is called whenever there's a beacon miss,
to print out some debugging.  This is primarily designed to help
me figure out if the beacon miss events are due to a noisy environment,
issues with the PHY/MAC, or other.
  
  * Move the CABQ setup/enable to occur _after_ all the VAPs have been
looked at.  This means that for multiple VAPS in bursted mode, the
CABQ gets primed once all VAPs are checked, rather than being primed
on the first VAP and then having frames appended after this.
  
  Minor:
  
  * Add a (disabled) twiddle to let me enable/disable cabq traffic.
It's primarily there to let me easily debug what's going on with beacon
and CABQ setup/traffic; there's some DMA engine hangs which I'm finally
trying to trace down.
  
  * Clear bf_next when flushing frames; it should quieten some warnings
that show up when a node goes away.
  
  Tested:
  
  * AR9280, STA/hostap, up to 4 vaps (staggered)
  * AR5416, STA/hostap, up to 4 vaps (staggered)
  
  TODO:
  
  * (Lots) more AR9380 and later testing, as I may have missed something here.
  * Leverage this to fix CABQ hanling for AR9380 and later chips.
  * Force bursted beaconing on the chips that default to staggered beacons and
ensure the CABQ stuff is all sane (eg, the MORE bits that aren't being
correctly set when chaining descriptors.)

Modified:
  head/sys/dev/ath/if_ath.c
  head/sys/dev/ath/if_ath_beacon.c
  head/sys/dev/ath/if_ath_beacon.h
  head/sys/dev/ath/if_ath_misc.h
  head/sys/dev/ath/if_ath_sysctl.c
  head/sys/dev/ath/if_ath_tdma.c
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx_edma.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c   Sat Mar 23 23:51:11 2013(r248670)
+++ head/sys/dev/ath/if_ath.c   Sun Mar 24 00:03:12 2013(r248671)
@@ -694,6 +694,9 @@ ath_attach(u_int16_t devid, struct ath_s
 */
sc->sc_txq_mcastq_maxdepth = ath_txbuf;
 
+   /* Enable CABQ by default */
+   sc->sc_cabq_enable = 1;
+
/*
 * Allow the TX and RX chainmasks to be overridden by
 * environment variables and/or device.hints.
@@ -1899,7 +1902,7 @@ ath_bmiss_vap(struct ieee80211vap *vap)
ATH_VAP(vap)->av_bmiss(vap);
 }
 
-static int
+int
 ath_hal_gethangstate(struct ath_hal *ah, uint32_t mask, uint32_t *hangs)
 {
uint32_t rsize;
@@ -2364,14 +2367,17 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T
 
/* Restart TX completion and pending TX */
if (reset_type == ATH_RESET_NOLOSS) {
-   ATH_TX_LOCK(sc);
for (i = 0; i < HAL_NUM_TX_QUEUES; i++) {
if (ATH_TXQ_SETUP(sc, i)) {
+   ATH_TXQ_LOCK(&sc->sc_txq[i]);
ath_txq_restart_dma(sc, &sc->sc_txq[i]);
+   ATH_TXQ_UNLOCK(&sc->sc_txq[i]);
+
+   ATH_TX_LOCK(sc);
ath_txq_sched(sc, &sc->sc_txq[i]);
+   ATH_TX_UNLOCK(sc);
}
}
-   ATH_TX_UNLOCK(sc);
}
 
/*
@@ -2922,6 +2928,9 @@ voi

svn commit: r248672 - head/lib/libc/stdtime

2013-03-23 Thread Dimitry Andric
Author: dim
Date: Sun Mar 24 01:35:37 2013
New Revision: 248672
URL: http://svnweb.freebsd.org/changeset/base/248672

Log:
  Compile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it relies
  on signed integer overflow wrapping.  Otherwise mktime(3) and timegm(3)
  can hang, in case the timestamp passed in struct tm is not representable
  in a time_t.  Specifically, any timestamp after 2038-01-19 03:14:07, in
  combination with a 32-bit time_t.
  
  Note that it would be better to change the code to not rely on undefined
  behaviour, but it is contributed code, and it is not entirely trivial to
  fix the issue properly.
  
  MFC after:3 days

Modified:
  head/lib/libc/stdtime/Makefile.inc

Modified: head/lib/libc/stdtime/Makefile.inc
==
--- head/lib/libc/stdtime/Makefile.inc  Sun Mar 24 00:03:12 2013
(r248671)
+++ head/lib/libc/stdtime/Makefile.inc  Sun Mar 24 01:35:37 2013
(r248672)
@@ -11,6 +11,9 @@ SYM_MAPS+= ${.CURDIR}/stdtime/Symbol.map
 
 CFLAGS+= -I${.CURDIR}/../../contrib/tzcode/stdtime -I${.CURDIR}/stdtime
 
+CFLAGS.localtime.c= -fwrapv
+CFLAGS+= ${CFLAGS.${.IMPSRC:T}}
+
 MAN+=  ctime.3 strftime.3 strptime.3 time2posix.3
 MAN+=  tzfile.5
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248673 - head/sbin/fsck_ffs

2013-03-23 Thread Sean Bruno
Author: sbruno
Date: Sun Mar 24 02:04:19 2013
New Revision: 248673
URL: http://svnweb.freebsd.org/changeset/base/248673

Log:
  Minor formatting fix for printf() to fix clang builds.
  
  Submitted by: db
  Reviewed by:  gjb

Modified:
  head/sbin/fsck_ffs/fsutil.c

Modified: head/sbin/fsck_ffs/fsutil.c
==
--- head/sbin/fsck_ffs/fsutil.c Sun Mar 24 01:35:37 2013(r248672)
+++ head/sbin/fsck_ffs/fsutil.c Sun Mar 24 02:04:19 2013(r248673)
@@ -507,7 +507,7 @@ static void printIOstats(void)
 
clock_gettime(CLOCK_REALTIME_PRECISE, &finishpass);
timespecsub(&finishpass, &startpass);
-   printf("Running time: %d.%03ld msec\n",
+   printf("Running time: %ld.%03ld msec\n",
finishpass.tv_sec, finishpass.tv_nsec / 100);
printf("buffer reads by type:\n");
for (totalmsec = 0, i = 0; i < BT_NUMBUFTYPES; i++)
@@ -519,7 +519,7 @@ static void printIOstats(void)
if (readcnt[i] == 0)
continue;
msec = readtime[i].tv_sec * 1000 + readtime[i].tv_nsec / 
100;
-   printf("%21s:%8ld %2ld.%ld%% %4d.%03ld sec %2jd.%jd%%\n",
+   printf("%21s:%8ld %2ld.%ld%% %4ld.%03ld sec %2lld.%lld%%\n",
buftype[i], readcnt[i], readcnt[i] * 100 / diskreads,
(readcnt[i] * 1000 / diskreads) % 10,
readtime[i].tv_sec, readtime[i].tv_nsec / 100,
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r248672 - head/lib/libc/stdtime

2013-03-23 Thread Dimitry Andric
On Mar 24, 2013, at 02:35, Dimitry Andric  wrote:
> Author: dim
> Date: Sun Mar 24 01:35:37 2013
> New Revision: 248672
> URL: http://svnweb.freebsd.org/changeset/base/248672
> 
> Log:
>  Compile contrib/tzcode/stdtime/localtime.c with -fwrapv, since it relies
>  on signed integer overflow wrapping.  Otherwise mktime(3) and timegm(3)
>  can hang, in case the timestamp passed in struct tm is not representable
>  in a time_t.  Specifically, any timestamp after 2038-01-19 03:14:07, in
>  combination with a 32-bit time_t.

I first noticed this when Squid on a i386 machine started to hang every
now and then, and started consuming 100% CPU in such cases.  After
rebuilding Squid with debug info, I found it hung in timegm(3), because
some web servers apparently like to pass Last-Modified dates of "Fri, 31
Dec  23:59:59 GMT", most likely to prevent caching.

Note this is not an issue on amd64, since time_t is 64-bit there, so
even a struct tm with tm_year=INT_MAX would work with mktime(3) and
timegm().

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


svn commit: r248674 - head/sys/geom

2013-03-23 Thread Alexander Motin
Author: mav
Date: Sun Mar 24 03:15:20 2013
New Revision: 248674
URL: http://svnweb.freebsd.org/changeset/base/248674

Log:
  Make g_wither_washer() to not loop by itself, but only when there was some
  more topology change done that may require its attention.  Add few missing
  g_do_wither() calls in respective places to signal it.
  
  This fixes potential infinite loop here when some provider is withered, but
  still opened or connected for some reason and so can not be destroyed.  For
  example, see r227009 and r227510.

Modified:
  head/sys/geom/geom_event.c
  head/sys/geom/geom_int.h
  head/sys/geom/geom_subr.c

Modified: head/sys/geom/geom_event.c
==
--- head/sys/geom/geom_event.c  Sun Mar 24 02:04:19 2013(r248673)
+++ head/sys/geom/geom_event.c  Sun Mar 24 03:15:20 2013(r248674)
@@ -273,21 +273,16 @@ one_event(void)
 void
 g_run_events()
 {
-   int i;
 
for (;;) {
g_topology_lock();
while (one_event())
;
mtx_assert(&g_eventlock, MA_OWNED);
-   i = g_wither_work;
-   if (i) {
+   if (g_wither_work) {
+   g_wither_work = 0;
mtx_unlock(&g_eventlock);
-   while (i) {
-   i = g_wither_washer();
-   g_wither_work = i & 1;
-   i &= 2;
-   }
+   g_wither_washer();
g_topology_unlock();
} else {
g_topology_unlock();

Modified: head/sys/geom/geom_int.h
==
--- head/sys/geom/geom_int.hSun Mar 24 02:04:19 2013(r248673)
+++ head/sys/geom/geom_int.hSun Mar 24 03:15:20 2013(r248674)
@@ -65,7 +65,7 @@ void g_do_wither(void);
 /* geom_subr.c */
 extern struct class_list_head g_classes;
 extern char *g_wait_event, *g_wait_sim, *g_wait_up, *g_wait_down;
-int g_wither_washer(void);
+void g_wither_washer(void);
 
 /* geom_io.c */
 void g_io_init(void);

Modified: head/sys/geom/geom_subr.c
==
--- head/sys/geom/geom_subr.c   Sun Mar 24 02:04:19 2013(r248673)
+++ head/sys/geom/geom_subr.c   Sun Mar 24 03:15:20 2013(r248674)
@@ -437,20 +437,16 @@ g_wither_geom_close(struct g_geom *gp, i
 
 /*
  * This function is called (repeatedly) until we cant wash away more
- * withered bits at present.  Return value contains two bits.  Bit 0
- * set means "withering stuff we can't wash now", bit 1 means "call
- * me again, there may be stuff I didn't get the first time around.
+ * withered bits at present.
  */
-int
+void
 g_wither_washer()
 {
struct g_class *mp;
struct g_geom *gp, *gp2;
struct g_provider *pp, *pp2;
struct g_consumer *cp, *cp2;
-   int result;
 
-   result = 0;
g_topology_assert();
LIST_FOREACH(mp, &g_classes, class) {
LIST_FOREACH_SAFE(gp, &mp->geom, geom, gp2) {
@@ -459,35 +455,25 @@ g_wither_washer()
continue;
if (LIST_EMPTY(&pp->consumers))
g_destroy_provider(pp);
-   else
-   result |= 1;
}
if (!(gp->flags & G_GEOM_WITHER))
continue;
LIST_FOREACH_SAFE(pp, &gp->provider, provider, pp2) {
if (LIST_EMPTY(&pp->consumers))
g_destroy_provider(pp);
-   else
-   result |= 1;
}
LIST_FOREACH_SAFE(cp, &gp->consumer, consumer, cp2) {
-   if (cp->acr || cp->acw || cp->ace) {
-   result |= 1;
+   if (cp->acr || cp->acw || cp->ace)
continue;
-   }
if (cp->provider != NULL)
g_detach(cp);
g_destroy_consumer(cp);
-   result |= 2;
}
if (LIST_EMPTY(&gp->provider) &&
LIST_EMPTY(&gp->consumer))
g_destroy_geom(gp);
-   else
-   result |= 1;
}
}
-   return (result);
 }
 
 struct g_consumer *
@@ -847,9 +833,9 @@ g_detach(struct g_consumer *cp)
pp = cp->provider;
LIST_REMOVE(cp, consumers);

svn commit: r248675 - head/sys/dev/ath

2013-03-23 Thread Adrian Chadd
Author: adrian
Date: Sun Mar 24 04:09:29 2013
New Revision: 248675
URL: http://svnweb.freebsd.org/changeset/base/248675

Log:
  Fix the locking changes due to the TXQ change drive-by.
  
  Tested:
  
  * AR9580, STA mode

Modified:
  head/sys/dev/ath/if_ath_tx_edma.c

Modified: head/sys/dev/ath/if_ath_tx_edma.c
==
--- head/sys/dev/ath/if_ath_tx_edma.c   Sun Mar 24 03:15:20 2013
(r248674)
+++ head/sys/dev/ath/if_ath_tx_edma.c   Sun Mar 24 04:09:29 2013
(r248675)
@@ -203,7 +203,7 @@ ath_edma_xmit_handoff_hw(struct ath_soft
 {
struct ath_hal *ah = sc->sc_ah;
 
-   ATH_TXQ_LOCK_ASSERT(txq);
+   ATH_TXQ_LOCK(txq);
 
KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0,
("%s: busy status 0x%x", __func__, bf->bf_flags));
@@ -234,6 +234,7 @@ ath_edma_xmit_handoff_hw(struct ath_soft
txq->axq_fifo_depth++;
ath_hal_txstart(ah, txq->axq_qnum);
}
+   ATH_TXQ_UNLOCK(txq);
 }
 
 /*
@@ -252,6 +253,7 @@ ath_edma_xmit_handoff_mcast(struct ath_s
KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0,
("%s: busy status 0x%x", __func__, bf->bf_flags));
 
+   ATH_TXQ_LOCK(txq);
/*
 * XXX this is mostly duplicated in ath_tx_handoff_mcast().
 */
@@ -278,6 +280,7 @@ ath_edma_xmit_handoff_mcast(struct ath_s
 
ATH_TXQ_INSERT_TAIL(txq, bf, bf_list);
ath_hal_gettxdesclinkptr(sc->sc_ah, bf->bf_lastds, &txq->axq_link);
+   ATH_TXQ_UNLOCK(txq);
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248676 - head/sys/dev/ath

2013-03-23 Thread Adrian Chadd
Author: adrian
Date: Sun Mar 24 04:09:54 2013
New Revision: 248676
URL: http://svnweb.freebsd.org/changeset/base/248676

Log:
  Move the TXQ lock earlier in this routine - so to correctly protect the
  link pointer check.

Modified:
  head/sys/dev/ath/if_ath_tx.c

Modified: head/sys/dev/ath/if_ath_tx.c
==
--- head/sys/dev/ath/if_ath_tx.cSun Mar 24 04:09:29 2013
(r248675)
+++ head/sys/dev/ath/if_ath_tx.cSun Mar 24 04:09:54 2013
(r248676)
@@ -702,6 +702,8 @@ ath_tx_handoff_mcast(struct ath_softc *s
 
KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0,
 ("%s: busy status 0x%x", __func__, bf->bf_flags));
+
+   ATH_TXQ_LOCK(txq);
if (txq->axq_link != NULL) {
struct ath_buf *last = ATH_TXQ_LAST(txq, axq_q_s);
struct ieee80211_frame *wh;
@@ -715,7 +717,6 @@ ath_tx_handoff_mcast(struct ath_softc *s
/* link descriptor */
*txq->axq_link = bf->bf_daddr;
}
-   ATH_TXQ_LOCK(txq);
ATH_TXQ_INSERT_TAIL(txq, bf, bf_list);
ath_hal_gettxdesclinkptr(sc->sc_ah, bf->bf_lastds, &txq->axq_link);
ATH_TXQ_UNLOCK(txq);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r248677 - head/sys/dev/ath/ath_hal/ah_regdomain

2013-03-23 Thread Adrian Chadd
Author: adrian
Date: Sun Mar 24 04:42:56 2013
New Revision: 248677
URL: http://svnweb.freebsd.org/changeset/base/248677

Log:
  Add new regulatory domain.
  
  Obtained from:Qualcomm Atheros

Modified:
  head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h
  head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regmap.h

Modified: head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h
==
--- head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h   Sun Mar 24 
04:09:54 2013(r248676)
+++ head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_domains.h   Sun Mar 24 
04:42:56 2013(r248677)
@@ -741,6 +741,31 @@ static REG_DOMAIN regDomains[] = {
  WG1_2467_2467),
 .chan11g_turbo = BM1(T3_2437_2437)},
 
+   {.regDmnEnum= WORC_WORLD,
+.conformanceTestLimit  = NO_CTL,
+.dfsMask   = DFS_FCC3 | DFS_ETSI,
+.pscan = PSCAN_WWR,
+.flags = ADHOC_PER_11D,
+.chan11a   = BM4(W1_5260_5320,
+ W1_5180_5240,
+ W1_5745_5825,
+ W1_5500_5700),
+.chan11b   = BM7(W1_2412_2412,
+ W1_2437_2442,
+ W1_2462_2462,
+ W1_2472_2472,
+ W1_2417_2432,
+ W1_2447_2457,
+ W1_2467_2467),
+.chan11g   = BM7(WG1_2412_2412,
+ WG1_2437_2442,
+ WG1_2462_2462,
+ WG1_2472_2472,
+ WG1_2417_2432,
+ WG1_2447_2457,
+ WG1_2467_2467),
+.chan11g_turbo = BM1(T3_2437_2437)},
+
{.regDmnEnum= NULL1,
 .conformanceTestLimit  = NO_CTL,
}

Modified: head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regmap.h
==
--- head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regmap.hSun Mar 24 
04:09:54 2013(r248676)
+++ head/sys/dev/ath/ath_hal/ah_regdomain/ah_rd_regmap.hSun Mar 24 
04:42:56 2013(r248677)
@@ -129,6 +129,7 @@ static REG_DMN_PAIR_MAPPING regDomainPai
{WOR9_WORLD,WOR9_WORLD, WOR9_WORLD, DISALLOW_ADHOC_11A | 
DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
{WORA_WORLD,WORA_WORLD, WORA_WORLD, DISALLOW_ADHOC_11A | 
DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
{WORB_WORLD,WORB_WORLD, WORB_WORLD, DISALLOW_ADHOC_11A | 
DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER, CTRY_DEFAULT },
+   {WORC_WORLD,WORC_WORLD, WORC_WORLD, NO_REQ, NO_REQ, 
PSCAN_DEFER, CTRY_DEFAULT },
 };
 
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"