From owner-svn-src-stable-7@FreeBSD.ORG Wed Nov 16 05:05:14 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 018451065675; Wed, 16 Nov 2011 05:05:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CA5A18FC17; Wed, 16 Nov 2011 05:05:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAG55Dhg032346; Wed, 16 Nov 2011 05:05:13 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAG55D5R032343; Wed, 16 Nov 2011 05:05:13 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201111160505.pAG55D5R032343@svn.freebsd.org> From: Rick Macklem Date: Wed, 16 Nov 2011 05:05:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227549 - stable/7/sys/nfsclient X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 05:05:14 -0000 Author: rmacklem Date: Wed Nov 16 05:05:13 2011 New Revision: 227549 URL: http://svn.freebsd.org/changeset/base/227549 Log: MFC: r224604 Fix a LOR in the NFS client which could cause a deadlock. This was reported to the mailing list freebsd-net@freebsd.org on July 21, 2011 under the subject "LOR with nfsclient sillyrename". The LOR occurred when nfs_inactive() called vrele(sp->s_dvp) while holding the vnode lock on the file in s_dvp. This patch modifies the client so that it performs the vrele(sp->s_dvp) as a separate task to avoid the LOR. This fix was discussed with jhb@ and kib@, who both proposed variations of it. Modified: stable/7/sys/nfsclient/nfs_node.c stable/7/sys/nfsclient/nfsnode.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/nfsclient/nfs_node.c ============================================================================== --- stable/7/sys/nfsclient/nfs_node.c Wed Nov 16 02:52:24 2011 (r227548) +++ stable/7/sys/nfsclient/nfs_node.c Wed Nov 16 05:05:13 2011 (r227549) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -59,6 +60,8 @@ __FBSDID("$FreeBSD$"); static uma_zone_t nfsnode_zone; +static void nfs_freesillyrename(void *arg, __unused int pending); + #define TRUE 1 #define FALSE 0 @@ -191,6 +194,20 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh return (0); } +/* + * Do the vrele(sp->s_dvp) as a separate task in order to avoid a + * deadlock because of a LOR when vrele() locks the directory vnode. + */ +static void +nfs_freesillyrename(void *arg, __unused int pending) +{ + struct sillyrename *sp; + + sp = arg; + vrele(sp->s_dvp); + free(sp, M_NFSREQ); +} + int nfs_inactive(struct vop_inactive_args *ap) { @@ -213,8 +230,8 @@ nfs_inactive(struct vop_inactive_args *a */ (sp->s_removeit)(sp); crfree(sp->s_cred); - vrele(sp->s_dvp); - FREE((caddr_t)sp, M_NFSREQ); + TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); + taskqueue_enqueue(taskqueue_thread, &sp->s_task); } np->n_flag &= NMODIFIED; return (0); Modified: stable/7/sys/nfsclient/nfsnode.h ============================================================================== --- stable/7/sys/nfsclient/nfsnode.h Wed Nov 16 02:52:24 2011 (r227548) +++ stable/7/sys/nfsclient/nfsnode.h Wed Nov 16 05:05:13 2011 (r227549) @@ -36,6 +36,7 @@ #ifndef _NFSCLIENT_NFSNODE_H_ #define _NFSCLIENT_NFSNODE_H_ +#include #if !defined(_NFSCLIENT_NFS_H_) && !defined(_KERNEL) #include #endif @@ -45,6 +46,7 @@ * can be removed by nfs_inactive() */ struct sillyrename { + struct task s_task; struct ucred *s_cred; struct vnode *s_dvp; int (*s_removeit)(struct sillyrename *sp); From owner-svn-src-stable-7@FreeBSD.ORG Wed Nov 16 14:37:48 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 68E47106566B; Wed, 16 Nov 2011 14:37:48 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 57ACE8FC14; Wed, 16 Nov 2011 14:37:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGEbmsV052842; Wed, 16 Nov 2011 14:37:48 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGEbmOp052840; Wed, 16 Nov 2011 14:37:48 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201111161437.pAGEbmOp052840@svn.freebsd.org> From: Fabien Thomas Date: Wed, 16 Nov 2011 14:37:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227552 - stable/7/contrib/gcc/config/arm X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 14:37:48 -0000 Author: fabient Date: Wed Nov 16 14:37:47 2011 New Revision: 227552 URL: http://svn.freebsd.org/changeset/base/227552 Log: MFC r227391: Import gcc fix for -fstack-protector that produces segfaulting binaries on arm/armel. Related gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35965 Author kindly accepted that all of his patches can be use as GPLv2. PR: 161128 Modified: stable/7/contrib/gcc/config/arm/arm.c Directory Properties: stable/7/contrib/gcc/ (props changed) Modified: stable/7/contrib/gcc/config/arm/arm.c ============================================================================== --- stable/7/contrib/gcc/config/arm/arm.c Wed Nov 16 14:33:30 2011 (r227551) +++ stable/7/contrib/gcc/config/arm/arm.c Wed Nov 16 14:37:47 2011 (r227552) @@ -3217,7 +3217,8 @@ legitimize_pic_address (rtx orig, enum m gcc_assert (!no_new_pseudos); if (arm_pic_register != INVALID_REGNUM) { - cfun->machine->pic_reg = gen_rtx_REG (Pmode, arm_pic_register); + if (!cfun->machine->pic_reg) + cfun->machine->pic_reg = gen_rtx_REG (Pmode, arm_pic_register); /* Play games to avoid marking the function as needing pic if we are being called as part of the cost-estimation @@ -3229,7 +3230,8 @@ legitimize_pic_address (rtx orig, enum m { rtx seq; - cfun->machine->pic_reg = gen_reg_rtx (Pmode); + if (!cfun->machine->pic_reg) + cfun->machine->pic_reg = gen_reg_rtx (Pmode); /* Play games to avoid marking the function as needing pic if we are being called as part of the cost-estimation From owner-svn-src-stable-7@FreeBSD.ORG Wed Nov 16 16:15:32 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 707A4106566C; Wed, 16 Nov 2011 16:15:32 +0000 (UTC) (envelope-from fabient@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5D8038FC08; Wed, 16 Nov 2011 16:15:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAGGFWAf056544; Wed, 16 Nov 2011 16:15:32 GMT (envelope-from fabient@svn.freebsd.org) Received: (from fabient@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAGGFWhG056533; Wed, 16 Nov 2011 16:15:32 GMT (envelope-from fabient@svn.freebsd.org) Message-Id: <201111161615.pAGGFWhG056533@svn.freebsd.org> From: Fabien Thomas Date: Wed, 16 Nov 2011 16:15:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227563 - in stable/7: lib/libpmc sys/dev/hwpmc sys/sys usr.sbin/pmcstat X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Nov 2011 16:15:32 -0000 Author: fabient Date: Wed Nov 16 16:15:31 2011 New Revision: 227563 URL: http://svn.freebsd.org/changeset/base/227563 Log: MFC r226514,r226526,r226986: Add a flush of the current PMC log buffer before displaying the next top. As the underlying block is 4KB if the PMC throughput is low the measurement will be reported on the next tick. pmcstat(8) use the modified flush API to reclaim current buffer before displaying next top. Modified: stable/7/lib/libpmc/libpmc.c stable/7/lib/libpmc/pmc.3 stable/7/lib/libpmc/pmc.h stable/7/lib/libpmc/pmc_configure_logfile.3 stable/7/sys/dev/hwpmc/hwpmc_logging.c stable/7/sys/dev/hwpmc/hwpmc_mod.c stable/7/sys/sys/pmc.h stable/7/sys/sys/pmclog.h stable/7/usr.sbin/pmcstat/pmcstat.c stable/7/usr.sbin/pmcstat/pmcstat_log.c Directory Properties: stable/7/lib/libpmc/ (props changed) stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/usr.sbin/pmcstat/ (props changed) Modified: stable/7/lib/libpmc/libpmc.c ============================================================================== --- stable/7/lib/libpmc/libpmc.c Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/lib/libpmc/libpmc.c Wed Nov 16 16:15:31 2011 (r227563) @@ -2498,6 +2498,12 @@ pmc_flush_logfile(void) } int +pmc_close_logfile(void) +{ + return (PMC_CALL(CLOSELOG,0)); +} + +int pmc_get_driver_stats(struct pmc_driverstats *ds) { struct pmc_op_getdriverstats gms; Modified: stable/7/lib/libpmc/pmc.3 ============================================================================== --- stable/7/lib/libpmc/pmc.3 Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/lib/libpmc/pmc.3 Wed Nov 16 16:15:31 2011 (r227563) @@ -322,6 +322,10 @@ to write logged events to. Flush all pending log data in .Xr hwpmc 4 Ns Ap s buffers. +.It Fn pmc_close_logfile +Flush all pending log data and close +.Xr hwpmc 4 Ns Ap s +side of the stream. .It Fn pmc_writelog Append arbitrary user data to the current log file. .El Modified: stable/7/lib/libpmc/pmc.h ============================================================================== --- stable/7/lib/libpmc/pmc.h Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/lib/libpmc/pmc.h Wed Nov 16 16:15:31 2011 (r227563) @@ -76,6 +76,7 @@ int pmc_attach(pmc_id_t _pmcid, pid_t _p int pmc_capabilities(pmc_id_t _pmc, uint32_t *_caps); int pmc_configure_logfile(int _fd); int pmc_flush_logfile(void); +int pmc_close_logfile(void); int pmc_detach(pmc_id_t _pmcid, pid_t _pid); int pmc_disable(int _cpu, int _pmc); int pmc_enable(int _cpu, int _pmc); Modified: stable/7/lib/libpmc/pmc_configure_logfile.3 ============================================================================== --- stable/7/lib/libpmc/pmc_configure_logfile.3 Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/lib/libpmc/pmc_configure_logfile.3 Wed Nov 16 16:15:31 2011 (r227563) @@ -29,7 +29,8 @@ .Sh NAME .Nm pmc_configure_logfile , .Nm pmc_flush_logfile , -.Nm pmc_writelog +.Nm pmc_writelog , +.Nm pmc_close_logfile .Nd log file management .Sh LIBRARY .Lb libpmc @@ -41,6 +42,8 @@ .Fn pmc_flush_logfile void .Ft int .Fn pmc_writelog "uint32_t userdata" +.Ft int +.Fn pmc_close_logfile void .Sh DESCRIPTION The functions manage logging of .Xr hwpmc 4 @@ -72,6 +75,12 @@ Function will append a log entry containing the value of argument .Fa userdata to the log file. +.Pp +Function +.Fn pmc_close_logfile +will flush all pending log data and close +.Xr hwpmc 4 Ns Ap s +side of the stream. .Sh RETURN VALUES .Rv -std .Sh ERRORS Modified: stable/7/sys/dev/hwpmc/hwpmc_logging.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/sys/dev/hwpmc/hwpmc_logging.c Wed Nov 16 16:15:31 2011 (r227563) @@ -237,7 +237,7 @@ pmclog_get_buffer(struct pmc_owner *po) static void pmclog_loop(void *arg) { - int error, last_buffer; + int error; struct pmc_owner *po; struct pmclog_buffer *lb; struct proc *p; @@ -252,7 +252,6 @@ pmclog_loop(void *arg) p = po->po_owner; td = curthread; mycred = td->td_ucred; - last_buffer = 0; PROC_LOCK(p); ownercred = crhold(p->p_ucred); @@ -285,14 +284,22 @@ pmclog_loop(void *arg) if ((lb = TAILQ_FIRST(&po->po_logbuffers)) == NULL) { mtx_unlock_spin(&po->po_mtx); + if (po->po_flags & PMC_PO_SHUTDOWN) { + mtx_unlock(&pmc_kthread_mtx); + /* + * Close the file to get PMCLOG_EOF + * error in pmclog(3). + */ + fo_close(po->po_file, curthread); + mtx_lock(&pmc_kthread_mtx); + } + (void) msleep(po, &pmc_kthread_mtx, PWAIT, "pmcloop", 0); continue; } TAILQ_REMOVE(&po->po_logbuffers, lb, plb_next); - if (po->po_flags & PMC_PO_SHUTDOWN) - last_buffer = TAILQ_EMPTY(&po->po_logbuffers); mtx_unlock_spin(&po->po_mtx); } @@ -335,14 +342,6 @@ pmclog_loop(void *arg) break; } - if (last_buffer) { - /* - * Close the file to get PMCLOG_EOF error - * in pmclog(3). - */ - fo_close(po->po_file, curthread); - } - mtx_lock(&pmc_kthread_mtx); /* put the used buffer back into the global pool */ @@ -692,6 +691,7 @@ int pmclog_flush(struct pmc_owner *po) { int error; + struct pmclog_buffer *lb; PMCDBG(LOG,FLS,1, "po=%p", po); @@ -714,11 +714,38 @@ pmclog_flush(struct pmc_owner *po) } /* - * Schedule the current buffer if any. + * Schedule the current buffer if any and not empty. + */ + mtx_lock_spin(&po->po_mtx); + lb = po->po_curbuf; + if (lb && lb->plb_ptr != lb->plb_base) { + pmclog_schedule_io(po); + } else + error = ENOBUFS; + mtx_unlock_spin(&po->po_mtx); + + error: + mtx_unlock(&pmc_kthread_mtx); + + return (error); +} + +int +pmclog_close(struct pmc_owner *po) +{ + + PMCDBG(LOG,CLO,1, "po=%p", po); + + mtx_lock(&pmc_kthread_mtx); + + /* + * Schedule the current buffer. */ mtx_lock_spin(&po->po_mtx); if (po->po_curbuf) pmclog_schedule_io(po); + else + wakeup_one(po); mtx_unlock_spin(&po->po_mtx); /* @@ -727,13 +754,11 @@ pmclog_flush(struct pmc_owner *po) */ po->po_flags |= PMC_PO_SHUTDOWN; - error: mtx_unlock(&pmc_kthread_mtx); - return (error); + return (0); } - void pmclog_process_callchain(struct pmc *pm, struct pmc_sample *ps) { Modified: stable/7/sys/dev/hwpmc/hwpmc_mod.c ============================================================================== --- stable/7/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/sys/dev/hwpmc/hwpmc_mod.c Wed Nov 16 16:15:31 2011 (r227563) @@ -2894,7 +2894,7 @@ pmc_syscall_handler(struct thread *td, v error = pmclog_configure_log(md, po, cl.pm_logfd); } else if (po->po_flags & PMC_PO_OWNS_LOGFILE) { pmclog_process_closelog(po); - error = pmclog_flush(po); + error = pmclog_close(po); if (error == 0) { LIST_FOREACH(pm, &po->po_pmcs, pm_next) if (pm->pm_flags & PMC_F_NEEDS_LOGFILE && @@ -2910,7 +2910,6 @@ pmc_syscall_handler(struct thread *td, v } break; - /* * Flush a log file. */ @@ -2931,6 +2930,25 @@ pmc_syscall_handler(struct thread *td, v break; /* + * Close a log file. + */ + + case PMC_OP_CLOSELOG: + { + struct pmc_owner *po; + + sx_assert(&pmc_sx, SX_XLOCKED); + + if ((po = pmc_find_owner_descriptor(td->td_proc)) == NULL) { + error = EINVAL; + break; + } + + error = pmclog_close(po); + } + break; + + /* * Retrieve hardware configuration. */ Modified: stable/7/sys/sys/pmc.h ============================================================================== --- stable/7/sys/sys/pmc.h Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/sys/sys/pmc.h Wed Nov 16 16:15:31 2011 (r227563) @@ -298,7 +298,8 @@ enum pmc_event { __PMC_OP(PMCSETCOUNT, "Set initial count/sampling rate") \ __PMC_OP(PMCSTART, "Start a PMC") \ __PMC_OP(PMCSTOP, "Start a PMC") \ - __PMC_OP(WRITELOG, "Write a cookie to the log file") + __PMC_OP(WRITELOG, "Write a cookie to the log file") \ + __PMC_OP(CLOSELOG, "Close log file") enum pmc_ops { @@ -1040,6 +1041,7 @@ extern struct pmc_debugflags pmc_debugfl #define PMC_DEBUG_MIN_SIO 9 /* schedule i/o */ #define PMC_DEBUG_MIN_FLS 10 /* flush */ #define PMC_DEBUG_MIN_SAM 11 /* sample */ +#define PMC_DEBUG_MIN_CLO 12 /* close */ #else #define PMCDBG(M,N,L,F,...) /* nothing */ Modified: stable/7/sys/sys/pmclog.h ============================================================================== --- stable/7/sys/sys/pmclog.h Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/sys/sys/pmclog.h Wed Nov 16 16:15:31 2011 (r227563) @@ -243,6 +243,7 @@ int pmclog_configure_log(struct pmc_mdep int _logfd); int pmclog_deconfigure_log(struct pmc_owner *_po); int pmclog_flush(struct pmc_owner *_po); +int pmclog_close(struct pmc_owner *_po); void pmclog_initialize(void); void pmclog_process_callchain(struct pmc *_pm, struct pmc_sample *_ps); void pmclog_process_closelog(struct pmc_owner *po); Modified: stable/7/usr.sbin/pmcstat/pmcstat.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat.c Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/usr.sbin/pmcstat/pmcstat.c Wed Nov 16 16:15:31 2011 (r227563) @@ -555,7 +555,7 @@ main(int argc, char **argv) int option, npmc, ncpu, haltedcpus; int c, check_driver_stats, current_cpu, current_sampling_count; int do_callchain, do_descendants, do_logproccsw, do_logprocexit; - int do_print; + int do_print, do_read; size_t dummy; int graphdepth; int pipefd[2], rfd; @@ -797,7 +797,9 @@ main(int argc, char **argv) break; case 'o': /* outputfile */ - if (args.pa_printfile != NULL) + if (args.pa_printfile != NULL && + args.pa_printfile != stdout && + args.pa_printfile != stderr) (void) fclose(args.pa_printfile); if ((args.pa_printfile = fopen(optarg, "w")) == NULL) errx(EX_OSERR, "ERROR: cannot open \"%s\" for " @@ -1329,7 +1331,7 @@ main(int argc, char **argv) * are killed by a SIGINT. */ runstate = PMCSTAT_RUNNING; - do_print = 0; + do_print = do_read = 0; do { if ((c = kevent(pmcstat_kq, NULL, 0, &kev, 1, NULL)) <= 0) { if (errno != EINTR) @@ -1352,8 +1354,10 @@ main(int argc, char **argv) (args.pa_flags & FLAG_DO_TOP)) { if (pmcstat_keypress_log()) runstate = pmcstat_close_log(); - } else + } else { + do_read = 0; runstate = pmcstat_process_log(); + } break; case EVFILT_SIGNAL: @@ -1378,9 +1382,6 @@ main(int argc, char **argv) /* Kill the child process if we started it */ if (args.pa_flags & FLAG_HAS_COMMANDLINE) pmcstat_kill_process(); - /* Close the pipe to self, if present. */ - if (args.pa_flags & FLAG_HAS_PIPE) - (void) close(pipefd[READPIPEFD]); runstate = pmcstat_close_log(); } else if (kev.ident == SIGWINCH) { if (ioctl(fileno(args.pa_printfile), @@ -1395,12 +1396,15 @@ main(int argc, char **argv) break; case EVFILT_TIMER: /* print out counting PMCs */ + if ((args.pa_flags & FLAG_DO_TOP) && + pmc_flush_logfile() == 0) + do_read = 1; do_print = 1; break; } - if (do_print) { + if (do_print && !do_read) { if ((args.pa_required & FLAG_HAS_OUTPUT_LOGFILE) == 0) { pmcstat_print_pmcs(); if (runstate == PMCSTAT_FINISHED && /* final newline */ @@ -1421,7 +1425,7 @@ main(int argc, char **argv) /* flush any pending log entries */ if (args.pa_flags & (FLAG_HAS_OUTPUT_LOGFILE | FLAG_HAS_PIPE)) - pmc_flush_logfile(); + pmc_close_logfile(); pmcstat_cleanup(); Modified: stable/7/usr.sbin/pmcstat/pmcstat_log.c ============================================================================== --- stable/7/usr.sbin/pmcstat/pmcstat_log.c Wed Nov 16 15:39:27 2011 (r227562) +++ stable/7/usr.sbin/pmcstat/pmcstat_log.c Wed Nov 16 16:15:31 2011 (r227563) @@ -1703,7 +1703,7 @@ pmcstat_close_log(void) * so keep the status to EXITING. */ if (args.pa_logfd != -1) { - if (pmc_flush_logfile() < 0) + if (pmc_close_logfile() < 0) err(EX_OSERR, "ERROR: logging failed"); } From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 17 01:10:16 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBDB110657BD; Thu, 17 Nov 2011 01:10:16 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B9EEF8FC08; Thu, 17 Nov 2011 01:10:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAH1AGp7075063; Thu, 17 Nov 2011 01:10:16 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAH1AGCP075058; Thu, 17 Nov 2011 01:10:16 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111170110.pAH1AGCP075058@svn.freebsd.org> From: Doug Barton Date: Thu, 17 Nov 2011 01:10:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227603 - in stable/7/contrib/bind9: . bin/named lib/dns X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 01:10:16 -0000 Author: dougb Date: Thu Nov 17 01:10:16 2011 New Revision: 227603 URL: http://svn.freebsd.org/changeset/base/227603 Log: Upgrade to BIND 9.4-ESV-R5-P1 to address the following DDOS bug: Recursive name servers are failing with an assertion: INSIST(! dns_rdataset_isassociated(sigrdataset)) At this time it is not thought that authoritative-only servers are affected, but information about this bug is evolving rapidly. Because it may be possible to trigger this bug even on networks that do not allow untrusted users to access the recursive name servers (perhaps via specially crafted e-mail messages, and/or malicious web sites) it is recommended that ALL operators of recursive name servers upgrade immediately. For more information see: https://www.isc.org/software/bind/advisories/cve-2011-tbd which will be updated as more information becomes available. https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-4313 Modified: stable/7/contrib/bind9/CHANGES stable/7/contrib/bind9/bin/named/query.c stable/7/contrib/bind9/lib/dns/rbtdb.c stable/7/contrib/bind9/version Directory Properties: stable/7/contrib/bind9/ (props changed) Modified: stable/7/contrib/bind9/CHANGES ============================================================================== --- stable/7/contrib/bind9/CHANGES Thu Nov 17 01:05:57 2011 (r227602) +++ stable/7/contrib/bind9/CHANGES Thu Nov 17 01:10:16 2011 (r227603) @@ -1,3 +1,9 @@ + --- 9.4-ESV-R5-P1 released --- + +3218. [security] Cache lookup could return RRSIG data associated with + nonexistent records, leading to an assertion + failure. [RT #26590] + --- 9.4-ESV-R5 released --- 3135. [port] FreeBSD: workaround broken IPV6_USE_MIN_MTU processing. Modified: stable/7/contrib/bind9/bin/named/query.c ============================================================================== --- stable/7/contrib/bind9/bin/named/query.c Thu Nov 17 01:05:57 2011 (r227602) +++ stable/7/contrib/bind9/bin/named/query.c Thu Nov 17 01:10:16 2011 (r227603) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: query.c,v 1.257.18.56 2010-11-17 10:21:01 marka Exp $ */ +/* $Id: query.c,v 1.257.18.56.12.1 2011-11-16 09:33:40 each Exp $ */ /*! \file */ @@ -1251,11 +1251,9 @@ query_addadditional(void *arg, dns_name_ goto addname; if (result == DNS_R_NCACHENXRRSET) { dns_rdataset_disassociate(rdataset); - /* - * Negative cache entries don't have sigrdatasets. - */ - INSIST(sigrdataset == NULL || - ! dns_rdataset_isassociated(sigrdataset)); + if (sigrdataset != NULL && + dns_rdataset_isassociated(sigrdataset)) + dns_rdataset_disassociate(sigrdataset); } if (result == ISC_R_SUCCESS) { mname = NULL; @@ -1296,8 +1294,9 @@ query_addadditional(void *arg, dns_name_ goto addname; if (result == DNS_R_NCACHENXRRSET) { dns_rdataset_disassociate(rdataset); - INSIST(sigrdataset == NULL || - ! dns_rdataset_isassociated(sigrdataset)); + if (sigrdataset != NULL && + dns_rdataset_isassociated(sigrdataset)) + dns_rdataset_disassociate(sigrdataset); } if (result == ISC_R_SUCCESS) { mname = NULL; @@ -1746,10 +1745,8 @@ query_addadditional2(void *arg, dns_name goto setcache; if (result == DNS_R_NCACHENXRRSET) { dns_rdataset_disassociate(rdataset); - /* - * Negative cache entries don't have sigrdatasets. - */ - INSIST(! dns_rdataset_isassociated(sigrdataset)); + if (dns_rdataset_isassociated(sigrdataset)) + dns_rdataset_disassociate(sigrdataset); } if (result == ISC_R_SUCCESS) { /* Remember the result as a cache */ Modified: stable/7/contrib/bind9/lib/dns/rbtdb.c ============================================================================== --- stable/7/contrib/bind9/lib/dns/rbtdb.c Thu Nov 17 01:05:57 2011 (r227602) +++ stable/7/contrib/bind9/lib/dns/rbtdb.c Thu Nov 17 01:10:16 2011 (r227603) @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rbtdb.c,v 1.196.18.67 2011-06-09 00:42:47 each Exp $ */ +/* $Id: rbtdb.c,v 1.196.18.67.2.1 2011-11-16 09:33:41 each Exp $ */ /*! \file */ @@ -3672,7 +3672,7 @@ cache_find(dns_db_t *db, dns_name_t *nam result == DNS_R_NCACHENXRRSET) { bind_rdataset(search.rbtdb, node, found, search.now, rdataset); - if (foundsig != NULL) + if (!NEGATIVE(found) && foundsig != NULL) bind_rdataset(search.rbtdb, node, foundsig, search.now, sigrdataset); } @@ -4258,7 +4258,7 @@ cache_findrdataset(dns_db_t *db, dns_dbn } if (found != NULL) { bind_rdataset(rbtdb, rbtnode, found, now, rdataset); - if (foundsig != NULL) + if (!NEGATIVE(found) && foundsig != NULL) bind_rdataset(rbtdb, rbtnode, foundsig, now, sigrdataset); } Modified: stable/7/contrib/bind9/version ============================================================================== --- stable/7/contrib/bind9/version Thu Nov 17 01:05:57 2011 (r227602) +++ stable/7/contrib/bind9/version Thu Nov 17 01:10:16 2011 (r227603) @@ -1,4 +1,4 @@ -# $Id: version,v 1.29.134.35 2011-07-21 02:11:00 marka Exp $ +# $Id: version,v 1.29.134.35.2.1 2011-11-16 09:33:40 each Exp $ # # This file must follow /bin/sh rules. It is imported directly via # configure. @@ -7,4 +7,4 @@ MAJORVER=9 MINORVER=4 PATCHVER= RELEASETYPE=-ESV -RELEASEVER=-R5 +RELEASEVER=-R5-P1 From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 17 04:16:58 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 55EF9106566B; Thu, 17 Nov 2011 04:16:58 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 389928FC0A; Thu, 17 Nov 2011 04:16:57 +0000 (UTC) Received: by elvis.mu.org (Postfix, from userid 1192) id DCDE11A3CA0; Wed, 16 Nov 2011 20:01:09 -0800 (PST) Date: Wed, 16 Nov 2011 20:01:09 -0800 From: Alfred Perlstein To: Rick Macklem Message-ID: <20111117040109.GU1455@elvis.mu.org> References: <201111160505.pAG55D5R032343@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201111160505.pAG55D5R032343@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org Subject: Re: svn commit: r227549 - stable/7/sys/nfsclient X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 04:16:58 -0000 Rick, I have a question, what will happen if the nfs_freesillyrename() call happens when the mount is down? Will it block the taskqueue_thread? If so, it might make more sense to make a taskqueue per mount point. If not, excuse me. :-) -Alfred * Rick Macklem [111115 21:05] wrote: > Author: rmacklem > Date: Wed Nov 16 05:05:13 2011 > New Revision: 227549 > URL: http://svn.freebsd.org/changeset/base/227549 > > Log: > MFC: r224604 > Fix a LOR in the NFS client which could cause a deadlock. > This was reported to the mailing list freebsd-net@freebsd.org > on July 21, 2011 under the subject "LOR with nfsclient sillyrename". > The LOR occurred when nfs_inactive() called vrele(sp->s_dvp) > while holding the vnode lock on the file in s_dvp. This patch > modifies the client so that it performs the vrele(sp->s_dvp) > as a separate task to avoid the LOR. This fix was discussed > with jhb@ and kib@, who both proposed variations of it. > > Modified: > stable/7/sys/nfsclient/nfs_node.c > stable/7/sys/nfsclient/nfsnode.h > Directory Properties: > stable/7/sys/ (props changed) > stable/7/sys/cddl/contrib/opensolaris/ (props changed) > stable/7/sys/contrib/dev/acpica/ (props changed) > stable/7/sys/contrib/pf/ (props changed) > > Modified: stable/7/sys/nfsclient/nfs_node.c > ============================================================================== > --- stable/7/sys/nfsclient/nfs_node.c Wed Nov 16 02:52:24 2011 (r227548) > +++ stable/7/sys/nfsclient/nfs_node.c Wed Nov 16 05:05:13 2011 (r227549) > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > +#include > #include > > #include > @@ -59,6 +60,8 @@ __FBSDID("$FreeBSD$"); > > static uma_zone_t nfsnode_zone; > > +static void nfs_freesillyrename(void *arg, __unused int pending); > + > #define TRUE 1 > #define FALSE 0 > > @@ -191,6 +194,20 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh > return (0); > } > > +/* > + * Do the vrele(sp->s_dvp) as a separate task in order to avoid a > + * deadlock because of a LOR when vrele() locks the directory vnode. > + */ > +static void > +nfs_freesillyrename(void *arg, __unused int pending) > +{ > + struct sillyrename *sp; > + > + sp = arg; > + vrele(sp->s_dvp); > + free(sp, M_NFSREQ); > +} > + > int > nfs_inactive(struct vop_inactive_args *ap) > { > @@ -213,8 +230,8 @@ nfs_inactive(struct vop_inactive_args *a > */ > (sp->s_removeit)(sp); > crfree(sp->s_cred); > - vrele(sp->s_dvp); > - FREE((caddr_t)sp, M_NFSREQ); > + TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); > + taskqueue_enqueue(taskqueue_thread, &sp->s_task); > } > np->n_flag &= NMODIFIED; > return (0); > > Modified: stable/7/sys/nfsclient/nfsnode.h > ============================================================================== > --- stable/7/sys/nfsclient/nfsnode.h Wed Nov 16 02:52:24 2011 (r227548) > +++ stable/7/sys/nfsclient/nfsnode.h Wed Nov 16 05:05:13 2011 (r227549) > @@ -36,6 +36,7 @@ > #ifndef _NFSCLIENT_NFSNODE_H_ > #define _NFSCLIENT_NFSNODE_H_ > > +#include > #if !defined(_NFSCLIENT_NFS_H_) && !defined(_KERNEL) > #include > #endif > @@ -45,6 +46,7 @@ > * can be removed by nfs_inactive() > */ > struct sillyrename { > + struct task s_task; > struct ucred *s_cred; > struct vnode *s_dvp; > int (*s_removeit)(struct sillyrename *sp); -- - Alfred Perlstein .- VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10 .- FreeBSD committer From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 17 05:45:38 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4708E1065672; Thu, 17 Nov 2011 05:45:38 +0000 (UTC) (envelope-from rmacklem@uoguelph.ca) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id ADE6E8FC0C; Thu, 17 Nov 2011 05:45:37 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4EAAiYxE6DaFvO/2dsb2JhbABChQGmCoFyAQEFIwRHCxsUBAICDRkCWQYTiAqgeZF6gTCCKYUogRYEiBSMIJIa X-IronPort-AV: E=Sophos;i="4.69,524,1315195200"; d="scan'208";a="145808292" Received: from erie.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.206]) by esa-jnhn-pri.mail.uoguelph.ca with ESMTP; 17 Nov 2011 00:16:34 -0500 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id 0ADE5B3F25; Thu, 17 Nov 2011 00:16:34 -0500 (EST) Date: Thu, 17 Nov 2011 00:16:34 -0500 (EST) From: Rick Macklem To: Alfred Perlstein Message-ID: <462306074.1954190.1321506994004.JavaMail.root@erie.cs.uoguelph.ca> In-Reply-To: <20111117040109.GU1455@elvis.mu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.201] X-Mailer: Zimbra 6.0.10_GA_2692 (ZimbraWebClient - FF3.0 (Win)/6.0.10_GA_2692) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org, Rick Macklem Subject: Re: svn commit: r227549 - stable/7/sys/nfsclient X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 05:45:38 -0000 Alfred Perlstein wrote: > Rick, I have a question, what will happen if the nfs_freesillyrename() > call happens when the mount is down? Will it block the > taskqueue_thread? > > If so, it might make more sense to make a taskqueue per mount point. > > If not, excuse me. :-) > Well, all nfs_freesillyrename() does is a vrele() on the parent directory when the file node's use count has gone to 0. I can't think why that would do any RPC, so I don't see a problem? If you do see a problem with vrele() on the directory, please let me know. The problem this fixes is a LOR that would occur when the vrele() on the directory was done by the thread doing VOP_INACTIVE(), since it already has the file vnode lock and the vrele() was locking the parent directory. This could cause a fairly rare deadlock. rick > -Alfred > > * Rick Macklem [111115 21:05] wrote: > > Author: rmacklem > > Date: Wed Nov 16 05:05:13 2011 > > New Revision: 227549 > > URL: http://svn.freebsd.org/changeset/base/227549 > > > > Log: > > MFC: r224604 > > Fix a LOR in the NFS client which could cause a deadlock. > > This was reported to the mailing list freebsd-net@freebsd.org > > on July 21, 2011 under the subject "LOR with nfsclient > > sillyrename". > > The LOR occurred when nfs_inactive() called vrele(sp->s_dvp) > > while holding the vnode lock on the file in s_dvp. This patch > > modifies the client so that it performs the vrele(sp->s_dvp) > > as a separate task to avoid the LOR. This fix was discussed > > with jhb@ and kib@, who both proposed variations of it. > > > > Modified: > > stable/7/sys/nfsclient/nfs_node.c > > stable/7/sys/nfsclient/nfsnode.h > > Directory Properties: > > stable/7/sys/ (props changed) > > stable/7/sys/cddl/contrib/opensolaris/ (props changed) > > stable/7/sys/contrib/dev/acpica/ (props changed) > > stable/7/sys/contrib/pf/ (props changed) > > > > Modified: stable/7/sys/nfsclient/nfs_node.c > > ============================================================================== > > --- stable/7/sys/nfsclient/nfs_node.c Wed Nov 16 02:52:24 2011 > > (r227548) > > +++ stable/7/sys/nfsclient/nfs_node.c Wed Nov 16 05:05:13 2011 > > (r227549) > > @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); > > #include > > #include > > #include > > +#include > > #include > > > > #include > > @@ -59,6 +60,8 @@ __FBSDID("$FreeBSD$"); > > > > static uma_zone_t nfsnode_zone; > > > > +static void nfs_freesillyrename(void *arg, __unused int pending); > > + > > #define TRUE 1 > > #define FALSE 0 > > > > @@ -191,6 +194,20 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh > > return (0); > > } > > > > +/* > > + * Do the vrele(sp->s_dvp) as a separate task in order to avoid a > > + * deadlock because of a LOR when vrele() locks the directory > > vnode. > > + */ > > +static void > > +nfs_freesillyrename(void *arg, __unused int pending) > > +{ > > + struct sillyrename *sp; > > + > > + sp = arg; > > + vrele(sp->s_dvp); > > + free(sp, M_NFSREQ); > > +} > > + > > int > > nfs_inactive(struct vop_inactive_args *ap) > > { > > @@ -213,8 +230,8 @@ nfs_inactive(struct vop_inactive_args *a > > */ > > (sp->s_removeit)(sp); > > crfree(sp->s_cred); > > - vrele(sp->s_dvp); > > - FREE((caddr_t)sp, M_NFSREQ); > > + TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); > > + taskqueue_enqueue(taskqueue_thread, &sp->s_task); > > } > > np->n_flag &= NMODIFIED; > > return (0); > > > > Modified: stable/7/sys/nfsclient/nfsnode.h > > ============================================================================== > > --- stable/7/sys/nfsclient/nfsnode.h Wed Nov 16 02:52:24 2011 > > (r227548) > > +++ stable/7/sys/nfsclient/nfsnode.h Wed Nov 16 05:05:13 2011 > > (r227549) > > @@ -36,6 +36,7 @@ > > #ifndef _NFSCLIENT_NFSNODE_H_ > > #define _NFSCLIENT_NFSNODE_H_ > > > > +#include > > #if !defined(_NFSCLIENT_NFS_H_) && !defined(_KERNEL) > > #include > > #endif > > @@ -45,6 +46,7 @@ > > * can be removed by nfs_inactive() > > */ > > struct sillyrename { > > + struct task s_task; > > struct ucred *s_cred; > > struct vnode *s_dvp; > > int (*s_removeit)(struct sillyrename *sp); > > -- > - Alfred Perlstein > .- VMOA #5191, 03 vmax, 92 gs500, 85 ch250, 07 zx10 > .- FreeBSD committer From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 17 11:16:57 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D6B551065672; Thu, 17 Nov 2011 11:16:57 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C5B428FC14; Thu, 17 Nov 2011 11:16:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAHBGv1M001853; Thu, 17 Nov 2011 11:16:57 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAHBGvag001851; Thu, 17 Nov 2011 11:16:57 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201111171116.pAHBGvag001851@svn.freebsd.org> From: Xin LI Date: Thu, 17 Nov 2011 11:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227611 - in stable: 7/sys/dev/mfi 8/sys/dev/mfi X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 11:16:58 -0000 Author: delphij Date: Thu Nov 17 11:16:56 2011 New Revision: 227611 URL: http://svn.freebsd.org/changeset/base/227611 Log: MFC r227409: Do a dummy read to flush the interrupt ACK that we just performed, ensuring that everything is really, truly consistent. This fixes certain cases where one will see various: mfi0: COMMAND 0xffffffXXXXXXXXXX TIMEOUT AFTER XX SECONDS Requested by: Vincent Hoffman Modified: stable/7/sys/dev/mfi/mfi.c Directory Properties: stable/7/sys/ (props changed) Changes in other areas also in this revision: Modified: stable/8/sys/dev/mfi/mfi.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/7/sys/dev/mfi/mfi.c ============================================================================== --- stable/7/sys/dev/mfi/mfi.c Thu Nov 17 10:46:51 2011 (r227610) +++ stable/7/sys/dev/mfi/mfi.c Thu Nov 17 11:16:56 2011 (r227611) @@ -928,6 +928,12 @@ mfi_intr(void *arg) if (sc->mfi_check_clear_intr(sc)) return; + /* + * Do a dummy read to flush the interrupt ACK that we just performed, + * ensuring that everything is really, truly consistent. + */ + (void)sc->mfi_read_fw_status(sc); + pi = sc->mfi_comms->hw_pi; ci = sc->mfi_comms->hw_ci; mtx_lock(&sc->mfi_io_lock); From owner-svn-src-stable-7@FreeBSD.ORG Thu Nov 17 18:36:43 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 881721065677; Thu, 17 Nov 2011 18:36:43 +0000 (UTC) (envelope-from bright@elvis.mu.org) Received: from elvis.mu.org (elvis.mu.org [192.203.228.196]) by mx1.freebsd.org (Postfix) with ESMTP id 72BC88FC0A; Thu, 17 Nov 2011 18:36:43 +0000 (UTC) Received: by elvis.mu.org (Postfix, from userid 1192) id 153061A3C5C; Thu, 17 Nov 2011 10:36:43 -0800 (PST) Date: Thu, 17 Nov 2011 10:36:42 -0800 From: Alfred Perlstein To: Rick Macklem Message-ID: <20111117183642.GY1455@elvis.mu.org> References: <20111117040109.GU1455@elvis.mu.org> <462306074.1954190.1321506994004.JavaMail.root@erie.cs.uoguelph.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <462306074.1954190.1321506994004.JavaMail.root@erie.cs.uoguelph.ca> User-Agent: Mutt/1.4.2.3i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-7@freebsd.org, Rick Macklem Subject: Re: svn commit: r227549 - stable/7/sys/nfsclient X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Nov 2011 18:36:43 -0000 * Rick Macklem [111116 21:16] wrote: > Alfred Perlstein wrote: > > Rick, I have a question, what will happen if the nfs_freesillyrename() > > call happens when the mount is down? Will it block the > > taskqueue_thread? > > > > If so, it might make more sense to make a taskqueue per mount point. > > > > If not, excuse me. :-) > > > Well, all nfs_freesillyrename() does is a vrele() on the parent > directory when the file node's use count has gone to 0. > I can't think why that would do any RPC, so I don't see a problem? > If you do see a problem with vrele() on the directory, please let me > know. > > The problem this fixes is a LOR that would occur when the vrele() on > the directory was done by the thread doing VOP_INACTIVE(), since it > already has the file vnode lock and the vrele() was locking the parent > directory. This could cause a fairly rare deadlock. Yes, I understand the VFS deadlock. I see, I didn't realize the call was against the directory, thank you for explaining. -Alfred From owner-svn-src-stable-7@FreeBSD.ORG Fri Nov 18 21:09:03 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CCD811065670; Fri, 18 Nov 2011 21:09:03 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B19DF8FC14; Fri, 18 Nov 2011 21:09:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAIL93Bq098705; Fri, 18 Nov 2011 21:09:03 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAIL93LM098703; Fri, 18 Nov 2011 21:09:03 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111182109.pAIL93LM098703@svn.freebsd.org> From: Doug Barton Date: Fri, 18 Nov 2011 21:09:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227680 - stable/7/sys/conf X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 21:09:04 -0000 Author: dougb Date: Fri Nov 18 21:09:03 2011 New Revision: 227680 URL: http://svn.freebsd.org/changeset/base/227680 Log: MFC r213077: Simplify how we find the kernel source. MFC r222218: expr -> sh arithmetic expansion MFC r226863: Fix svnversion for svn 1.7.x by not looking for .svn in ${SYSDIR} (since it no longer exists). Instead, run svnversion if we can find the binary and test that the output looks like a version string. Modified: stable/7/sys/conf/newvers.sh Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/conf/newvers.sh ============================================================================== --- stable/7/sys/conf/newvers.sh Fri Nov 18 21:04:59 2011 (r227679) +++ stable/7/sys/conf/newvers.sh Fri Nov 18 21:09:03 2011 (r227680) @@ -38,16 +38,16 @@ if [ "X${BRANCH_OVERRIDE}" != "X" ]; the fi RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" +SYSDIR=$(dirname $0)/.. if [ "X${PARAMFILE}" != "X" ]; then RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ ${PARAMFILE}) else RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ - $(dirname $0)/../sys/param.h) + ${SYSDIR}/sys/param.h) fi - b=share/examples/etc/bsd-style-copyright year=`date '+%Y'` # look for copyright template @@ -87,51 +87,47 @@ touch version v=`cat version` u=${USER:-root} d=`pwd` h=${HOSTNAME:-`hostname`} t=`date` i=`${MAKE:-make} -V KERN_IDENT` -case "$d" in -*/sys/*) - SRCDIR=${d##*obj} - if [ -n "$MACHINE" ]; then - SRCDIR=${SRCDIR##/$MACHINE} +for dir in /bin /usr/bin /usr/local/bin; do + if [ -x "${dir}/svnversion" ] ; then + svnversion=${dir}/svnversion + break + fi + if [ -d "${SYSDIR}/../.git" -a -x "${dir}/git" ] ; then + git_cmd="${dir}/git --git-dir=${SYSDIR}/../.git" + break fi - SRCDIR=${SRCDIR%%/sys/*} +done - for dir in /bin /usr/bin /usr/local/bin; do - if [ -d "${SRCDIR}/sys/.svn" -a -x "${dir}/svnversion" ] ; then - svnversion=${dir}/svnversion - break - fi - if [ -d "${SRCDIR}/.git" -a -x "${dir}/git" ] ; then - git_cmd="${dir}/git --git-dir=${SRCDIR}/.git" - break - fi - done +if [ -n "$svnversion" ] ; then + echo "$svnversion" + svn=`cd ${SYSDIR} && $svnversion` + case "$svn" in + [0-9]*) svn=" r${svn}" ;; + *) unset svn ;; + esac +fi - if [ -n "$svnversion" ] ; then - svn=" r`cd ${SRCDIR}/sys && $svnversion`" - fi - if [ -n "$git_cmd" ] ; then - git=`$git_cmd rev-parse --verify --short HEAD 2>/dev/null` - svn=`$git_cmd svn find-rev $git 2>/dev/null` - if [ -n "$svn" ] ; then +if [ -n "$git_cmd" ] ; then + git=`$git_cmd rev-parse --verify --short HEAD 2>/dev/null` + svn=`$git_cmd svn find-rev $git 2>/dev/null` + if [ -n "$svn" ] ; then + svn=" r${svn}" + git="=${git}" + else + svn=`$git_cmd log | fgrep 'git-svn-id:' | head -1 | \ + sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'` + if [ -n $svn ] ; then svn=" r${svn}" - git="=${git}" + git="+${git}" else - svn=`$git_cmd log | fgrep 'git-svn-id:' | head -1 | \ - sed -n 's/^.*@\([0-9][0-9]*\).*$/\1/p'` - if [ -n $svn ] ; then - svn=" r${svn}" - git="+${git}" - else - git=" ${git}" - fi - fi - if $git_cmd --work-tree=${SRCDIR} diff-index \ - --name-only HEAD | read dummy; then - git="${git}-dirty" + git=" ${git}" fi fi - ;; -esac + if $git_cmd --work-tree=${SYSDIR}/.. diff-index \ + --name-only HEAD | read dummy; then + git="${git}-dirty" + fi +fi cat << EOF > vers.c $COPYRIGHT @@ -147,4 +143,4 @@ int osreldate = ${RELDATE}; char kern_ident[] = "${i}"; EOF -echo `expr ${v} + 1` > version +echo $((v + 1)) > version From owner-svn-src-stable-7@FreeBSD.ORG Fri Nov 18 21:13:43 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A2031106564A; Fri, 18 Nov 2011 21:13:43 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 90ECC8FC0C; Fri, 18 Nov 2011 21:13:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAILDhCo099127; Fri, 18 Nov 2011 21:13:43 GMT (envelope-from dougb@svn.freebsd.org) Received: (from dougb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAILDhLl099125; Fri, 18 Nov 2011 21:13:43 GMT (envelope-from dougb@svn.freebsd.org) Message-Id: <201111182113.pAILDhLl099125@svn.freebsd.org> From: Doug Barton Date: Fri, 18 Nov 2011 21:13:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227684 - stable/7/lib/libc/sys X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Nov 2011 21:13:43 -0000 Author: dougb Date: Fri Nov 18 21:13:43 2011 New Revision: 227684 URL: http://svn.freebsd.org/changeset/base/227684 Log: MFC r227416: Document that flock can return ENOLCK Modified: stable/7/lib/libc/sys/flock.2 Directory Properties: stable/7/lib/libc/ (props changed) stable/7/lib/libc/stdtime/ (props changed) Modified: stable/7/lib/libc/sys/flock.2 ============================================================================== --- stable/7/lib/libc/sys/flock.2 Fri Nov 18 21:12:58 2011 (r227683) +++ stable/7/lib/libc/sys/flock.2 Fri Nov 18 21:13:43 2011 (r227684) @@ -28,7 +28,7 @@ .\" @(#)flock.2 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd January 22, 2008 +.Dd November 9, 2011 .Dt FLOCK 2 .Os .Sh NAME @@ -154,6 +154,8 @@ refers to an object other than a file. The argument .Fa fd refers to an object that does not support file locking. +.It Bq Er ENOLCK +A lock was requested, but no locks are available. .El .Sh SEE ALSO .Xr close 2 , From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 19 13:30:15 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 81F3710657CD; Sat, 19 Nov 2011 13:30:15 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15FE88FC19; Sat, 19 Nov 2011 13:30:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAJDUCqO045080; Sat, 19 Nov 2011 13:30:12 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAJDUCQr045078; Sat, 19 Nov 2011 13:30:12 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111191330.pAJDUCQr045078@svn.freebsd.org> From: Marius Strobl Date: Sat, 19 Nov 2011 13:30:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227717 - stable/7/sys/sparc64/include X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Nov 2011 13:30:15 -0000 Author: marius Date: Sat Nov 19 13:30:12 2011 New Revision: 227717 URL: http://svn.freebsd.org/changeset/base/227717 Log: MFC: r227539 Define curthread as an inline function that loads the thread pointer directly from g7, the pcpu pointer. This guarantees correct behavior when the thread migrates to a different CPU. Commit message stolen from r205431. Additional testing by Peter Jeremy. Modified: stable/7/sys/sparc64/include/pcpu.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/include/pcpu.h ============================================================================== --- stable/7/sys/sparc64/include/pcpu.h Sat Nov 19 13:29:55 2011 (r227716) +++ stable/7/sys/sparc64/include/pcpu.h Sat Nov 19 13:30:12 2011 (r227717) @@ -71,6 +71,16 @@ register struct pcpu *pcpup __asm__(__XS #define PCPU_GET(member) (pcpup->pc_ ## member) +static __inline __pure2 struct thread * +__curthread(void) +{ + struct thread *td; + + __asm("ldx [%" __XSTRING(PCPU_REG) "], %0" : "=r" (td)); + return (td); +} +#define curthread (__curthread()) + /* * XXX The implementation of this operation should be made atomic * with respect to preemption. From owner-svn-src-stable-7@FreeBSD.ORG Sat Nov 19 13:33:31 2011 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 45B9F1065674; Sat, 19 Nov 2011 13:33:31 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 33D048FC18; Sat, 19 Nov 2011 13:33:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id pAJDXVIY045385; Sat, 19 Nov 2011 13:33:31 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id pAJDXVBk045383; Sat, 19 Nov 2011 13:33:31 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201111191333.pAJDXVBk045383@svn.freebsd.org> From: Marius Strobl Date: Sat, 19 Nov 2011 13:33:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r227721 - stable/7/sys/sparc64/sbus X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Nov 2011 13:33:31 -0000 Author: marius Date: Sat Nov 19 13:33:30 2011 New Revision: 227721 URL: http://svn.freebsd.org/changeset/base/227721 Log: MFC: r227578 Fix compilation with DEBUG defined. Modified: stable/7/sys/sparc64/sbus/lsi64854.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/sparc64/sbus/lsi64854.c ============================================================================== --- stable/7/sys/sparc64/sbus/lsi64854.c Sat Nov 19 13:33:24 2011 (r227720) +++ stable/7/sys/sparc64/sbus/lsi64854.c Sat Nov 19 13:33:30 2011 (r227721) @@ -568,7 +568,7 @@ lsi64854_scsi_intr(void *arg) DPRINTF(LDB_SCSI, ("%s: tcl=%d, tcm=%d, tch=%d; trans=%d, resid=%d\n", __func__, NCR_READ_REG(nsc, NCR_TCL), NCR_READ_REG(nsc, NCR_TCM), - (nsc->sc_sc_features & NCR_F_LARGEXFER) != 0 ? + (nsc->sc_features & NCR_F_LARGEXFER) != 0 ? NCR_READ_REG(nsc, NCR_TCH) : 0, trans, resid)); if (dmasize != 0) {