Re: svn commit: r254627 - in head: bin/chflags bin/ls lib/libc/gen lib/libc/sys sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/fs/msdosfs sys/fs/smbfs sys/sys sys/ufs/ufs
On Fri, 27 Jun 2014, Kenneth D. Merry wrote: On Fri, Jun 27, 2014 at 12:48:29 -0700, Xin LI wrote: Hi, Craig have hit an interesting issue today, where he tried to 'mv' a file from ZFS dataset to a NFS mount, 'mv' bails out because chflags failed. I think it's probably sensible to have mv ignoring UF_ARCHIVE, and set the flag on the target unconditionally? i.e.: Index: mv.c === --- mv.c (revision 267940) +++ mv.c (working copy) @@ -337,8 +337,8 @@ * on a file that we copied, i.e., that we didn't create.) */ errno = 0; - if (fchflags(to_fd, sbp-st_flags)) - if (errno != EOPNOTSUPP || sbp-st_flags != 0) + if (fchflags(to_fd, sbp-st_flags | UF_ARCHIVE)) + if (errno != EOPNOTSUPP || (sbp-st_flags ~UF_ARCHIVE) != 0) warn(%s: set flags (was: 0%07o), to, sbp-st_flags); tval[0].tv_sec = sbp-st_atime; Yes, that sounds like a good way to do it. No, this is very broken. Ignoring the error is bad enough. POSIX requires duplicating all of the attributes and certain error handling when they cannot be duplicated. File flags aren't a POSIX attribute, but not duplicating or handling errors differently for them them breaks the spirit of the POSIX spec. Forcing the archive flag to be set on the copy is worse. It is broken especially broken if the source and target both support the archive flag, since it then fails to preserve the flag when it is clear on the source. The old code was bad too. I think it usually gives the POSIX behaviour, but it only applies to the unusual case where only a few regular files are moved, and its checking if the preservation worked can be done better by stat()ing the result and comparing with the original. The usual case (by number of files moved, if not by mv instances), is for moving whole directory heirarchies. The above code is not used in that case. cp -pR is used. cp -pR is more buggy than the above in general, but for the chflags() its error handling is less fancy and thus stricter than the above, so tends to produce thousands or warnings instead of only 1. More and different details in another reply. I sent the following mail to ken about this (mostly for cp -p instead of mv) in April, but received no reply: old Copying files on freefall now causes annoying warnings. This is because old zfs supports UF_ARCHIVE but nfs doesn't: old old % Script started on Sat Apr 5 05:10:55 2014 old % pts/29:bde@freefall:~/zmsun cp -p $l/msun/Makefile . old % cp: chflags: ./Makefile: Operation not supported old % pts/29:bde@freefall:~/zmsun echo $? old % 1 old % pts/29:bde@freefall:~/zmsun ls -lo $l/msun/Makefile Makefile old % -rw-r--r-- 1 root wheel uarch 8610 Mar 2 11:00 /usr/src/lib/msun/Makefile old % -rw-r--r-- 1 bde devel - 8610 Mar 2 11:00 Makefile old % pts/29:bde@freefall:~/zmsun exit old % old % Script done on Sat Apr 5 05:11:28 2014 old old cp works, but this is hard to determine since the exit status is 1. Oops, old that means that cp doesn't work. It also cannot copy the more important old uid and gid, but it doesn't warn about this or change the exit status to old 1 for this. Not warning is a historical hack to keep cp usable. Not old indicating the error in any other way is not good, but is also historical. old This is only done when chown() returns EPERM. For chflags() on nfs, we're old getting EOPNOTSUPPORT for the whole syscall. So cp -pR is completely broken for use by mv for the uid and gid, but works almost as correctly as possibly for file flags. POSIX has relaxed requirements for cp relative to mv, since cp without -p is not required to preserve any attributes, and cp with -p can't be expected to preserve all the attributes in many cases, unlike the usual case for mv where it is not across a file system. old The support is useless in practice, at least on freefall, because zfs old always sets UF_ARCHIVE and nothing ever clears it. zfs sets it even old for directories and symlinks. old old Also, sys/stat.h still has SF_ARCHIVED: old old % #define UF_ARCHIVE 0x0800 /* file needs to be archived */ old % #define SF_ARCHIVED 0x0001 /* file is archived */ old old It's not clear what SF_ARCHIVED means, especially since no file system old supports it. The only references to it are: old old % ./fs/tmpfs/tmpfs_subr.c: if ((flags ~(SF_APPEND | SF_ARCHIVED | SF_IMMUTABLE | SF_NOUNLINK | old % ./ufs/ufs/ufs_vnops.c:if ((vap-va_flags ~(SF_APPEND | SF_ARCHIVED | SF_IMMUTABLE | old old So applications can set this flag for ffs and tmpfs, but since the fs never old changes it, it is almost useless. Perhaps we left it for compatibility old in ffs. tmpfs doesn't have anything to be compatible with. old old UF_ARCHIVE and UF_NODUMP are fairly bogus for tmpfs too. I think all they old do is prevent the above error when copying files from fs's that support old them. old old Bruce Attributes like file times cannot
svn commit: r268003 - in head/contrib/llvm: lib/Target/PowerPC patches
Author: dim Date: Sat Jun 28 09:53:44 2014 New Revision: 268003 URL: http://svnweb.freebsd.org/changeset/base/268003 Log: Fix breakage after r267981. Pointy hat to:dim MFC after:3 days X-MFC-With: r267981 Modified: head/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp head/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff Modified: head/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp == --- head/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cppSat Jun 28 05:51:45 2014(r268002) +++ head/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cppSat Jun 28 09:53:44 2014(r268003) @@ -1027,7 +1027,7 @@ bool PPCFastISel::SelectFPToI(const Inst return false; // If we don't have FCTIDUZ and we need it, punt to SelectionDAG. - if (DstVT == MVT::i64 !IsSigned !PPCSubTarget-hasFPCVT()) + if (DstVT == MVT::i64 !IsSigned !PPCSubTarget.hasFPCVT()) return false; Value *Src = I-getOperand(0); Modified: head/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff == --- head/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff Sat Jun 28 05:51:45 2014(r268002) +++ head/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff Sat Jun 28 09:53:44 2014(r268003) @@ -32,7 +32,7 @@ Index: lib/Target/PowerPC/PPCFastISel.cp return false; + // If we don't have FCTIDUZ and we need it, punt to SelectionDAG. -+ if (DstVT == MVT::i64 !IsSigned !PPCSubTarget-hasFPCVT()) ++ if (DstVT == MVT::i64 !IsSigned !PPCSubTarget.hasFPCVT()) +return false; + Value *Src = I-getOperand(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
Re: svn commit: r267977 - head/bin/mv
On Sat, 28 Jun 2014, Jilles Tjoelker wrote: On Fri, Jun 27, 2014 at 07:57:54PM +, Xin LI wrote: Author: delphij Log: Always set UF_ARCHIVE on target (because they are by definition new files and should be archived) and ignore error when we can't set it (e.g. NFS). Reviewed by: ken MFC after:2 weeks Modified: head/bin/mv/mv.c Modified: head/bin/mv/mv.c == --- head/bin/mv/mv.cFri Jun 27 19:50:30 2014(r267976) +++ head/bin/mv/mv.cFri Jun 27 19:57:54 2014(r267977) @@ -337,8 +337,8 @@ err:if (unlink(to)) * on a file that we copied, i.e., that we didn't create.) */ errno = 0; - if (fchflags(to_fd, sbp-st_flags)) - if (errno != EOPNOTSUPP || sbp-st_flags != 0) + if (fchflags(to_fd, sbp-st_flags | UF_ARCHIVE)) + if (errno != EOPNOTSUPP || ((sbp-st_flags ~UF_ARCHIVE) != 0)) warn(%s: set flags (was: 0%07o), to, sbp-st_flags); tval[0].tv_sec = sbp-st_atime; The part ignoring failures to set UF_ARCHIVE is OK. No, it is not OK. The error was only a warning, and that is the best possible. However, it seems inconsistent to set UF_ARCHIVE on a cross-filesystem mv of a single file, but not on a cross-filesystem mv of a directory tree It is also inconsistent with within-filesystem mv's in both cases. or a file newly created via shell output redirection. The file system should set it in that case, if the file system actually supports UF_ARCHIVE. If UF_ARCHIVE is supposed to be set automatically, I think this should be done in the kernel, like msdosfs already does. zfs sets it too. That's where the problematic UF_ARCHIVE settings come from. The problem was just less visible for msdsofs since it is less used for critical file systems. It used to be an even larger problem for msdosfs. msdosfs's archive flag was mapped to SF_ARCHIVE instead of to UF_ARCHIVE. So for mv or cp -p from msdsofs to msdosfs (or a similar file system), you could get an EPERM error. The above hack only checks for EOPNOTSUPP, so it made no difference. When the target file system actually supports UF_ARCHIVE, the target file already has UF_ARCHIVE set because the file is new. Then the chflags() is needed mainly to unset UF_ARCHIVE when the source file doesn't have it set. The change does the opposite. The cp -pR case (for mv across file systems and cp itself) never even had the EOPNOTSUPP hack (except possibly in recent versions which I can't check now), so it tends to spew errors. Old versions of cp -p did the following: @ /* @* Changing the ownership probably won't succeed, unless we're root @* or POSIX_CHOWN_RESTRICTED is not set. Set uid/gid before setting @* the mode; current BSD behavior is to remove all setuid bits on @* chown. If chown fails, lose setuid/setgid bits. @*/ @ if (!gotstat || fs-st_uid != ts.st_uid || fs-st_gid != ts.st_gid) This avoids most chown()s by not attempting any. Good. @ if (fdval ? fchown(fd, fs-st_uid, fs-st_gid) : @ (islink ? lchown(to.p_path, fs-st_uid, fs-st_gid) : @ chown(to.p_path, fs-st_uid, fs-st_gid))) { Here it would be better to stat() the file again and mostly not use the syscall result. syscalls that can set multiple attributes should allow setting subsets and require checking to see which ones were set. tcsettattr() is such a syscall. It has the very bad error handling of returning success if at least 1 attribute was set. That is bad because it is fail-unsafe for sloppy callers, and its success is guaranteed since there are always attributes which can be set to an unchanged value. chown() is not such a syscall, but it is safer to check. See the XXX comment before the above code in mv. It is about (mis)handling settable subsets of flags. Currently there is no reasonable way, since chflags() is like chown() and has to accept all of the settings or not change any. @ if (errno != EPERM) { @ warn(chown: %s, to.p_path); @ rval = 1; @ } @ fs-st_mode = ~(S_ISUID | S_ISGID); @ } @ @ if (!gotstat || fs-st_mode != ts.st_mode) @ if (fdval ? fchmod(fd, fs-st_mode) : @ (islink ? lchmod(to.p_path, fs-st_mode) : @ chmod(to.p_path, fs-st_mode))) { @ warn(chmod: %s, to.p_path); @ rval = 1; @ } Similarly for the mode, except not making null changes is closer to being just an optimization. Hmm, This order seems to be backwards. Shouldn't we change the mode before the ownerships go keep more permission for changing the mode? We already change file flags last in case an immutable flag will be
Re: svn commit: r267961 - in head/sys: amd64/acpica amd64/amd64 amd64/pci amd64/vmm arm/arm arm/freescale/imx arm/xscale/ixp425 cam cam/ata cam/ctl cam/scsi cddl/compat/opensolaris/kern cddl/contrib/o
FYI: Possibly the sysctl patches will not get MFCed, and be a FreeBSD-11 and onwards only feature, even though the commit message states MFC after xxx. --HPS ___ 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: r268003 - in head/contrib/llvm: lib/Target/PowerPC patches
In message 201406280953.s5s9ri9e067...@svn.freebsd.org, Dimitry Andric writes : Author: dim Date: Sat Jun 28 09:53:44 2014 New Revision: 268003 URL: http://svnweb.freebsd.org/changeset/base/268003 Log: Fix breakage after r267981. Pointy hat to: dim MFC after: 3 days X-MFC-With: r267981 Modified: head/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp head/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff Modified: head/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp = = --- head/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp Sat Jun 28 05:5 1:45 2014 (r268002) +++ head/contrib/llvm/lib/Target/PowerPC/PPCFastISel.cpp Sat Jun 28 09:5 3:44 2014 (r268003) @@ -1027,7 +1027,7 @@ bool PPCFastISel::SelectFPToI(const Inst return false; // If we don't have FCTIDUZ and we need it, punt to SelectionDAG. - if (DstVT == MVT::i64 !IsSigned !PPCSubTarget-hasFPCVT()) + if (DstVT == MVT::i64 !IsSigned !PPCSubTarget.hasFPCVT()) return false; Value *Src = I-getOperand(0); Modified: head/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctidu z.diff = = --- head/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff Sat Jun 28 05:51:45 2014(r268002) +++ head/contrib/llvm/patches/patch-r267981-llvm-r211435-fix-ppc-fctiduz.diff Sat Jun 28 09:53:44 2014(r268003) @@ -32,7 +32,7 @@ Index: lib/Target/PowerPC/PPCFastISel.cp return false; + // If we don't have FCTIDUZ and we need it, punt to SelectionDAG. -+ if (DstVT == MVT::i64 !IsSigned !PPCSubTarget-hasFPCVT()) ++ if (DstVT == MVT::i64 !IsSigned !PPCSubTarget.hasFPCVT()) +return false; + Value *Src = I-getOperand(0); Thanks. Looks like they changed PPCSubTarget to a pointer in llvm trunk about five weeks ago. :~ -- Cheers, Cy Schubert cy.schub...@komquats.com FreeBSD UNIX: c...@freebsd.org Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. ___ 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: r268004 - head/usr.sbin/rwhod
Author: dwmalone Date: Sat Jun 28 15:53:28 2014 New Revision: 268004 URL: http://svnweb.freebsd.org/changeset/base/268004 Log: Don't accidently skip every second line when calculating the idle time. MFC after:2 weeks Modified: head/usr.sbin/rwhod/rwhod.c Modified: head/usr.sbin/rwhod/rwhod.c == --- head/usr.sbin/rwhod/rwhod.c Sat Jun 28 09:53:44 2014(r268003) +++ head/usr.sbin/rwhod/rwhod.c Sat Jun 28 15:53:28 2014(r268004) @@ -488,7 +488,6 @@ sender_process(void) for (we = mywd.wd_we; we wend; we++) { if (stat(we-we_utmp.out_line, stb) = 0) we-we_idle = htonl(now - stb.st_atime); - we++; } (void) getloadavg(avenrun, sizeof(avenrun) / sizeof(avenrun[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: r268005 - in head/sys: kern ofed/drivers/infiniband/ulp/sdp ofed/drivers/net/mlx4 ofed/include/linux pc98/pc98 sys
Author: hselasky Date: Sat Jun 28 17:36:18 2014 New Revision: 268005 URL: http://svnweb.freebsd.org/changeset/base/268005 Log: Compile fixes: Remove duplicate debug_ktr.mask sysctl definition. Remove now unused variable from kern_ktr.c. This fixes build of ktr which was broken by r267961. Let the default value for vm_kmem_size_scale be zero. It is setup after that the sysctl has been initialized from getenv() in the kmeminit() function to equal the VM_KMEM_SIZE_MAX value, if zero. On Sparc64 the VM_KMEM_SIZE_MAX macro is not a constant. This fixes build of Sparc64 which was broken by r267961. Add a special macro to dynamically create SYSCTL root nodes, because root nodes have a special parent. This fixes build of existing OFED module and CANBUS module for pc98 which was broken by r267961. Add missing sysctl.h includes to get the needed sysctl header file declarations. This is needed after r267961. MFC after:2 weeks Modified: head/sys/kern/kern_ktr.c head/sys/kern/kern_malloc.c head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c head/sys/ofed/drivers/net/mlx4/en_netdev.c head/sys/ofed/include/linux/linux_compat.c head/sys/pc98/pc98/canbus.c head/sys/sys/sysctl.h Modified: head/sys/kern/kern_ktr.c == --- head/sys/kern/kern_ktr.cSat Jun 28 15:53:28 2014(r268004) +++ head/sys/kern/kern_ktr.cSat Jun 28 17:36:18 2014(r268005) @@ -102,13 +102,9 @@ intktr_version = KTR_VERSION; struct ktr_entry ktr_buf_init[KTR_BOOT_ENTRIES]; struct ktr_entry *ktr_buf = ktr_buf_init; cpuset_t ktr_cpumask = CPUSET_T_INITIALIZER(KTR_CPUMASK); -static char ktr_cpumask_str[CPUSETBUFSIZ]; static SYSCTL_NODE(_debug, OID_AUTO, ktr, CTLFLAG_RD, 0, KTR options); -SYSCTL_INT(_debug_ktr, OID_AUTO, mask, CTLFLAG_RDTUN, -ktr_mask, 0, KTR mask); - SYSCTL_INT(_debug_ktr, OID_AUTO, version, CTLFLAG_RD, ktr_version, 0, Version of the KTR interface); @@ -175,7 +171,7 @@ sysctl_debug_ktr_mask(SYSCTL_HANDLER_ARG return (error); } -SYSCTL_PROC(_debug_ktr, OID_AUTO, mask, CTLTYPE_UINT|CTLFLAG_RW, 0, 0, +SYSCTL_PROC(_debug_ktr, OID_AUTO, mask, CTLTYPE_UINT|CTLFLAG_RWTUN, 0, 0, sysctl_debug_ktr_mask, IU, Bitmask of KTR event classes for which logging is enabled); Modified: head/sys/kern/kern_malloc.c == --- head/sys/kern/kern_malloc.c Sat Jun 28 15:53:28 2014(r268004) +++ head/sys/kern/kern_malloc.c Sat Jun 28 17:36:18 2014(r268005) @@ -191,7 +191,7 @@ static u_long vm_kmem_size_max; SYSCTL_ULONG(_vm, OID_AUTO, kmem_size_max, CTLFLAG_RDTUN, vm_kmem_size_max, 0, Maximum size of kernel memory); -static u_int vm_kmem_size_scale = VM_KMEM_SIZE_SCALE; +static u_int vm_kmem_size_scale; SYSCTL_UINT(_vm, OID_AUTO, kmem_size_scale, CTLFLAG_RDTUN, vm_kmem_size_scale, 0, Scale factor for kernel memory size); Modified: head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c == --- head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Sat Jun 28 15:53:28 2014(r268004) +++ head/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c Sat Jun 28 17:36:18 2014(r268005) @@ -69,6 +69,7 @@ __FBSDID($FreeBSD$); #include net/if.h #include net/route.h #include net/vnet.h +#include sys/sysctl.h uma_zone_t sdp_zone; struct rwlock sdp_lock; Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c == --- head/sys/ofed/drivers/net/mlx4/en_netdev.c Sat Jun 28 15:53:28 2014 (r268004) +++ head/sys/ofed/drivers/net/mlx4/en_netdev.c Sat Jun 28 17:36:18 2014 (r268005) @@ -42,6 +42,7 @@ #include net/ethernet.h #include net/if_vlan_var.h #include sys/sockio.h +#include sys/sysctl.h static void mlx4_en_init_locked(struct mlx4_en_priv *priv); static void mlx4_en_sysctl_stat(struct mlx4_en_priv *priv); Modified: head/sys/ofed/include/linux/linux_compat.c == --- head/sys/ofed/include/linux/linux_compat.c Sat Jun 28 15:53:28 2014 (r268004) +++ head/sys/ofed/include/linux/linux_compat.c Sat Jun 28 17:36:18 2014 (r268005) @@ -678,7 +678,7 @@ linux_compat_init(void) struct sysctl_oid *rootoid; int i; - rootoid = SYSCTL_ADD_NODE(NULL, SYSCTL_STATIC_CHILDREN(), + rootoid = SYSCTL_ADD_ROOT_NODE(NULL, OID_AUTO, sys, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, sys); kobject_init(class_root, class_ktype); kobject_set_name(class_root, class); Modified: head/sys/pc98/pc98/canbus.c == --- head/sys/pc98/pc98/canbus.c Sat Jun 28 15:53:28 2014(r268004) +++
svn commit: r268006 - head/sys/modules/dtrace/dtrace
Author: rpaulo Date: Sat Jun 28 18:53:02 2014 New Revision: 268006 URL: http://svnweb.freebsd.org/changeset/base/268006 Log: Move the -I of common/util to the proper place to fix the powerpc build. MFC after:2 weeks Modified: head/sys/modules/dtrace/dtrace/Makefile Modified: head/sys/modules/dtrace/dtrace/Makefile == --- head/sys/modules/dtrace/dtrace/Makefile Sat Jun 28 17:36:18 2014 (r268005) +++ head/sys/modules/dtrace/dtrace/Makefile Sat Jun 28 18:53:02 2014 (r268006) @@ -22,8 +22,7 @@ SRCS= dtrace.c \ SRCS+= dis_tables.c \ instr_size.c CFLAGS+= -I${SYSDIR}/cddl/contrib/opensolaris/uts/intel \ - -I${SYSDIR}/cddl/dev/dtrace/x86 \ - -I${SUNW}/common/util + -I${SYSDIR}/cddl/dev/dtrace/x86 .endif SRCS+= bus_if.h device_if.h vnode_if.h @@ -45,6 +44,7 @@ CFLAGS+= -I${SYSDIR}/cddl/compat/opensol -I${SYSDIR}/cddl/dev/dtrace \ -I${SYSDIR}/cddl/dev/dtrace/${ARCHDIR} \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ + -I${SUNW}/common/util \ -I${SYSDIR} -DDIS_MEM CFLAGS+= -DSMP ___ 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: r268007 - in head/sys: cddl/contrib/opensolaris/uts/common/dtrace modules/dtrace/fasttrap
Author: pfg Date: Sat Jun 28 19:59:12 2014 New Revision: 268007 URL: http://svnweb.freebsd.org/changeset/base/268007 Log: Revertr267869: MFV r260708 4427 pid provider rejects probes with valid UTF-8 names Use of u8_textprep.c broke the build on powerpc. Reported by: bz, rpaulo and tinderbox. Pointyhat:me Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c head/sys/modules/dtrace/fasttrap/Makefile Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c == --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Jun 28 18:53:02 2014(r268006) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/fasttrap.c Sat Jun 28 19:59:12 2014(r268007) @@ -28,9 +28,9 @@ * Use is subject to license terms. */ -/* - * Copyright (c) 2013, Joyent, Inc. All rights reserved. - */ +#if defined(sun) +#pragma ident %Z%%M% %I% %E% SMI +#endif #include sys/atomic.h #include sys/errno.h @@ -63,7 +63,6 @@ #if !defined(sun) #include sys/dtrace_bsd.h #include sys/eventhandler.h -#include sys/u8_textprep.h #include sys/user.h #include vm/vm.h #include vm/pmap.h @@ -2257,7 +2256,8 @@ fasttrap_ioctl(struct cdev *dev, u_long fasttrap_probe_spec_t *probe; uint64_t noffs; size_t size; - int ret, err; + int ret; + char *c; if (copyin(uprobe-ftps_noffs, noffs, sizeof (uprobe-ftps_noffs))) @@ -2286,16 +2286,18 @@ fasttrap_ioctl(struct cdev *dev, u_long * Verify that the function and module strings contain no * funny characters. */ - if (u8_validate(probe-ftps_func, strlen(probe-ftps_func), - NULL, U8_VALIDATE_ENTIRE, err) 0) { - ret = EINVAL; - goto err; + for (c = probe-ftps_func[0]; *c != '\0'; c++) { + if (*c 0x20 || 0x7f = *c) { + ret = EINVAL; + goto err; + } } - if (u8_validate(probe-ftps_mod, strlen(probe-ftps_mod), - NULL, U8_VALIDATE_ENTIRE, err) 0) { - ret = EINVAL; - goto err; + for (c = probe-ftps_mod[0]; *c != '\0'; c++) { + if (*c 0x20 || 0x7f = *c) { + ret = EINVAL; + goto err; + } } #ifdef notyet Modified: head/sys/modules/dtrace/fasttrap/Makefile == --- head/sys/modules/dtrace/fasttrap/Makefile Sat Jun 28 18:53:02 2014 (r268006) +++ head/sys/modules/dtrace/fasttrap/Makefile Sat Jun 28 19:59:12 2014 (r268007) @@ -8,9 +8,6 @@ KMOD= fasttrap SRCS= fasttrap.c fasttrap_isa.c opt_compat.h SRCS+= vnode_if.h -.PATH: ${.CURDIR}/../../../cddl/contrib/opensolaris/common/unicode -SRCS+= u8_textprep.c - CFLAGS+= -I${SYSDIR}/cddl/compat/opensolaris \ -I${SYSDIR}/cddl/contrib/opensolaris/uts/common \ -I${SYSDIR} ___ 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: r268008 - head/sys/fs/nfsclient
Author: rmacklem Date: Sat Jun 28 21:47:15 2014 New Revision: 268008 URL: http://svnweb.freebsd.org/changeset/base/268008 Log: There might be a potential race condition for the NFSv4 client when a newly created file has another open done on it that update the open mode. This patch moves the code that updates the open mode up into the block where the mutex is held to ensure this cannot happen. No bug caused by this potential race has been observed, but this fix is a safety belt to ensure it cannot happen. MFC after:2 weeks Modified: head/sys/fs/nfsclient/nfs_clstate.c Modified: head/sys/fs/nfsclient/nfs_clstate.c == --- head/sys/fs/nfsclient/nfs_clstate.c Sat Jun 28 19:59:12 2014 (r268007) +++ head/sys/fs/nfsclient/nfs_clstate.c Sat Jun 28 21:47:15 2014 (r268008) @@ -281,6 +281,23 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i newonep); /* +* Now, check the mode on the open and return the appropriate +* value. +*/ + if (retp != NULL) { + if (nfhp != NULL dp != NULL nop == NULL) + /* new local open on delegation */ + *retp = NFSCLOPEN_SETCRED; + else + *retp = NFSCLOPEN_OK; + } + if (op != NULL (amode ~(op-nfso_mode))) { + op-nfso_mode |= amode; + if (retp != NULL dp == NULL) + *retp = NFSCLOPEN_DOOPEN; + } + + /* * Serialize modifications to the open owner for multiple threads * within the same process using a read/write sleep lock. */ @@ -295,23 +312,6 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i *owpp = owp; if (opp != NULL) *opp = op; - if (retp != NULL) { - if (nfhp != NULL dp != NULL nop == NULL) - /* new local open on delegation */ - *retp = NFSCLOPEN_SETCRED; - else - *retp = NFSCLOPEN_OK; - } - - /* -* Now, check the mode on the open and return the appropriate -* value. -*/ - if (op != NULL (amode ~(op-nfso_mode))) { - op-nfso_mode |= amode; - if (retp != NULL dp == NULL) - *retp = NFSCLOPEN_DOOPEN; - } 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: r268010 - in stable/10/sys/dev/virtio: . network pci
Author: bryanv Date: Sun Jun 29 00:37:59 2014 New Revision: 268010 URL: http://svnweb.freebsd.org/changeset/base/268010 Log: MFC r267520, r267521, r267522, r267523, r267524: - Remove two write-only local variables - Remove unused element in the vtnet_rxq structure - Remove kernel specific macro out of the VirtIO PCI header file - Move the VIRTIO_RING_F_* defines out of virtqueue.h into virtio_config.h - Make the feature negotiation code easier to follow - Force two byte alignment for all control message headers Modified: stable/10/sys/dev/virtio/network/if_vtnet.c stable/10/sys/dev/virtio/network/if_vtnetvar.h stable/10/sys/dev/virtio/pci/virtio_pci.c stable/10/sys/dev/virtio/pci/virtio_pci.h stable/10/sys/dev/virtio/virtio.h stable/10/sys/dev/virtio/virtio_config.h stable/10/sys/dev/virtio/virtqueue.c stable/10/sys/dev/virtio/virtqueue.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/virtio/network/if_vtnet.c == --- stable/10/sys/dev/virtio/network/if_vtnet.c Sat Jun 28 23:20:24 2014 (r268009) +++ stable/10/sys/dev/virtio/network/if_vtnet.c Sun Jun 29 00:37:59 2014 (r268010) @@ -550,37 +550,38 @@ vtnet_negotiate_features(struct vtnet_so mask |= VTNET_TSO_FEATURES; if (vtnet_tunable_int(sc, lro_disable, vtnet_lro_disable)) mask |= VTNET_LRO_FEATURES; +#ifndef VTNET_LEGACY_TX if (vtnet_tunable_int(sc, mq_disable, vtnet_mq_disable)) mask |= VIRTIO_NET_F_MQ; -#ifdef VTNET_LEGACY_TX +#else mask |= VIRTIO_NET_F_MQ; #endif features = VTNET_FEATURES ~mask; sc-vtnet_features = virtio_negotiate_features(dev, features); - if (virtio_with_feature(dev, VTNET_LRO_FEATURES) == 0) - return; - if (virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF)) - return; - - /* -* LRO without mergeable buffers requires special care. This is not -* ideal because every receive buffer must be large enough to hold -* the maximum TCP packet, the Ethernet header, and the header. This -* requires up to 34 descriptors with MCLBYTES clusters. If we do -* not have indirect descriptors, LRO is disabled since the virtqueue -* will not contain very many receive buffers. -*/ - if (virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC) == 0) { - device_printf(dev, - LRO disabled due to both mergeable buffers and indirect - descriptors not negotiated\n); + if (virtio_with_feature(dev, VTNET_LRO_FEATURES) + virtio_with_feature(dev, VIRTIO_NET_F_MRG_RXBUF) == 0) { + /* +* LRO without mergeable buffers requires special care. This +* is not ideal because every receive buffer must be large +* enough to hold the maximum TCP packet, the Ethernet header, +* and the header. This requires up to 34 descriptors with +* MCLBYTES clusters. If we do not have indirect descriptors, +* LRO is disabled since the virtqueue will not contain very +* many receive buffers. +*/ + if (!virtio_with_feature(dev, VIRTIO_RING_F_INDIRECT_DESC)) { + device_printf(dev, + LRO disabled due to both mergeable buffers and + indirect descriptors not negotiated\n); - features = ~VTNET_LRO_FEATURES; - sc-vtnet_features = virtio_negotiate_features(dev, features); - } else - sc-vtnet_flags |= VTNET_FLAG_LRO_NOMRG; + features = ~VTNET_LRO_FEATURES; + sc-vtnet_features = + virtio_negotiate_features(dev, features); + } else + sc-vtnet_flags |= VTNET_FLAG_LRO_NOMRG; + } } static void @@ -2111,13 +2112,11 @@ fail: static int vtnet_txq_encap(struct vtnet_txq *txq, struct mbuf **m_head) { - struct vtnet_softc *sc; struct vtnet_tx_header *txhdr; struct virtio_net_hdr *hdr; struct mbuf *m; int error; - sc = txq-vtntx_sc; m = *m_head; M_ASSERTPKTHDR(m); @@ -2944,11 +2943,9 @@ vtnet_set_active_vq_pairs(struct vtnet_s static int vtnet_reinit(struct vtnet_softc *sc) { - device_t dev; struct ifnet *ifp; int error; - dev = sc-vtnet_dev; ifp = sc-vtnet_ifp; /* Use the current MAC address. */ @@ -3069,7 +3066,7 @@ vtnet_exec_ctrl_cmd(struct vtnet_softc * static int vtnet_ctrl_mac_cmd(struct vtnet_softc *sc, uint8_t *hwaddr) { - struct virtio_net_ctrl_hdr hdr; + struct virtio_net_ctrl_hdr hdr __aligned(2); struct sglist_seg segs[3];
svn commit: r268011 - stable/10/sys/dev/vmware/vmxnet3
Author: bryanv Date: Sun Jun 29 00:50:56 2014 New Revision: 268011 URL: http://svnweb.freebsd.org/changeset/base/268011 Log: MFC r267661, r267662, r267663: - Remove an unnecessary kick of the host at the end of transmitting - Handle multiple calls to rxq_eof for single packet completion - Increment the pending packets more aggressively for TSO Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c stable/10/sys/dev/vmware/vmxnet3/if_vmxvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmx.c == --- stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Sun Jun 29 00:37:59 2014 (r268010) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmx.c Sun Jun 29 00:50:56 2014 (r268011) @@ -166,7 +166,6 @@ static int vmxnet3_txq_load_mbuf(struct bus_dmamap_t, bus_dma_segment_t [], int *); static voidvmxnet3_txq_unload_mbuf(struct vmxnet3_txqueue *, bus_dmamap_t); static int vmxnet3_txq_encap(struct vmxnet3_txqueue *, struct mbuf **); -static voidvmxnet3_txq_update_pending(struct vmxnet3_txqueue *); #ifdef VMXNET3_LEGACY_TX static voidvmxnet3_start_locked(struct ifnet *); static voidvmxnet3_start(struct ifnet *); @@ -2086,17 +2085,25 @@ vmxnet3_rxq_eof(struct vmxnet3_rxqueue * sc = rxq-vxrxq_sc; ifp = sc-vmx_ifp; rxc = rxq-vxrxq_comp_ring; - m_head = m_tail = NULL; VMXNET3_RXQ_LOCK_ASSERT(rxq); if ((ifp-if_drv_flags IFF_DRV_RUNNING) == 0) return; + m_head = rxq-vxrxq_mhead; + rxq-vxrxq_mhead = NULL; + m_tail = rxq-vxrxq_mtail; + rxq-vxrxq_mtail = NULL; + MPASS(m_head == NULL || m_tail != NULL); + for (;;) { rxcd = rxc-vxcr_u.rxcd[rxc-vxcr_next]; - if (rxcd-gen != rxc-vxcr_gen) + if (rxcd-gen != rxc-vxcr_gen) { + rxq-vxrxq_mhead = m_head; + rxq-vxrxq_mtail = m_tail; break; + } vmxnet3_barrier(sc, VMXNET3_BARRIER_RD); if (++rxc-vxcr_next == rxc-vxcr_ndesc) { @@ -2328,6 +2335,12 @@ vmxnet3_rxstop(struct vmxnet3_softc *sc, struct vmxnet3_rxbuf *rxb; int i, j; + if (rxq-vxrxq_mhead != NULL) { + m_freem(rxq-vxrxq_mhead); + rxq-vxrxq_mhead = NULL; + rxq-vxrxq_mtail = NULL; + } + for (i = 0; i VMXNET3_RXRINGS_PERQ; i++) { rxr = rxq-vxrxq_cmd_ring[i]; @@ -2839,7 +2852,8 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue vmxnet3_barrier(sc, VMXNET3_BARRIER_WR); sop-gen ^= 1; - if (++txq-vxtxq_ts-npending = txq-vxtxq_ts-intr_threshold) { + txq-vxtxq_ts-npending += nsegs; + if (txq-vxtxq_ts-npending = txq-vxtxq_ts-intr_threshold) { txq-vxtxq_ts-npending = 0; vmxnet3_write_bar0(sc, VMXNET3_BAR0_TXH(txq-vxtxq_id), txr-vxtxr_head); @@ -2848,20 +2862,6 @@ vmxnet3_txq_encap(struct vmxnet3_txqueue return (0); } -static void -vmxnet3_txq_update_pending(struct vmxnet3_txqueue *txq) -{ - struct vmxnet3_txring *txr; - - txr = txq-vxtxq_cmd_ring; - - if (txq-vxtxq_ts-npending 0) { - txq-vxtxq_ts-npending = 0; - vmxnet3_write_bar0(txq-vxtxq_sc, - VMXNET3_BAR0_TXH(txq-vxtxq_id), txr-vxtxr_head); - } -} - #ifdef VMXNET3_LEGACY_TX static void @@ -2908,10 +2908,8 @@ vmxnet3_start_locked(struct ifnet *ifp) ETHER_BPF_MTAP(ifp, m_head); } - if (tx 0) { - vmxnet3_txq_update_pending(txq); + if (tx 0) txq-vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; - } } static void @@ -2972,8 +2970,7 @@ vmxnet3_txq_mq_start_locked(struct vmxne break; } - error = vmxnet3_txq_encap(txq, m); - if (error) { + if (vmxnet3_txq_encap(txq, m) != 0) { if (m != NULL) drbr_putback(ifp, br, m); else @@ -2986,10 +2983,8 @@ vmxnet3_txq_mq_start_locked(struct vmxne ETHER_BPF_MTAP(ifp, m); } - if (tx 0) { - vmxnet3_txq_update_pending(txq); + if (tx 0) txq-vxtxq_watchdog = VMXNET3_WATCHDOG_TIMEOUT; - } return (0); } Modified: stable/10/sys/dev/vmware/vmxnet3/if_vmxvar.h == --- stable/10/sys/dev/vmware/vmxnet3/if_vmxvar.hSun Jun 29 00:37:59 2014(r268010) +++ stable/10/sys/dev/vmware/vmxnet3/if_vmxvar.hSun Jun 29 00:50:56 2014(r268011) @@ -168,6 +168,8 @@ struct vmxnet3_rxqueue { struct vmxnet3_softc*vxrxq_sc;
svn commit: r268012 - head/sys/dev/vmware/vmxnet3
Author: bryanv Date: Sun Jun 29 01:04:11 2014 New Revision: 268012 URL: http://svnweb.freebsd.org/changeset/base/268012 Log: Give each interrupt a descriptive name when using MSIX MFC after:3 days Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c == --- head/sys/dev/vmware/vmxnet3/if_vmx.cSun Jun 29 00:50:56 2014 (r268011) +++ head/sys/dev/vmware/vmxnet3/if_vmx.cSun Jun 29 01:04:11 2014 (r268012) @@ -694,6 +694,8 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_txq_intr, txq, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, + tq%d, i); txq-vxtxq_intr_idx = intr-vmxi_rid - 1; } @@ -703,6 +705,8 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_rxq_intr, rxq, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, + rq%d, i); rxq-vxrxq_intr_idx = intr-vmxi_rid - 1; } @@ -710,6 +714,7 @@ vmxnet3_setup_msix_interrupts(struct vmx vmxnet3_event_intr, sc, intr-vmxi_handler); if (error) return (error); + bus_describe_intr(dev, intr-vmxi_irq, intr-vmxi_handler, event); sc-vmx_event_intr_idx = intr-vmxi_rid - 1; 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: r268014 - head/sys/cddl/contrib/opensolaris/common/unicode
Author: pfg Date: Sun Jun 29 02:28:05 2014 New Revision: 268014 URL: http://svnweb.freebsd.org/changeset/base/268014 Log: Reduce some warnings in the Solaris unicode support. Clean some warnings from parenthesis and minor style issues. MFC after:3 days Modified: head/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c Modified: head/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c == --- head/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c Sun Jun 29 01:21:35 2014(r268013) +++ head/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c Sun Jun 29 02:28:05 2014(r268014) @@ -23,7 +23,6 @@ * Use is subject to license terms. */ -#pragma ident %Z%%M% %I% %E% SMI /* @@ -143,10 +142,10 @@ #defineU8_16BIT_TABLE_INDICATOR(0x8000U) /* The following are some convenience macros. */ -#defineU8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \ - (u) = ((uint32_t)(b1) 0x0F) 12 | ((uint32_t)(b2) 0x3F) 6 | \ - (uint32_t)(b3) 0x3F; - +#defineU8_PUT_3BYTES_INTO_UTF32(u, b1, b2, b3) \ + (u) = uint32_t)(b1) 0x0F) 12) | \ + (((uint32_t)(b2) 0x3F) 6) | \ + ((uint32_t)(b3) 0x3F)); #defineU8_SIMPLE_SWAP(a, b, t) \ (t) = (a); \ (a) = (b); \ @@ -216,10 +215,10 @@ const int8_t u8_number_of_bytes[0x100] = /* 80 81 82 83 84 85 86 87 88 89 8A 8B 8C 8D 8E 8F */ I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, -/* 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F */ +/* 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F */ I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, -/* A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF */ +/* A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF */ I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, I_, /* B0 B1 B2 B3 B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF */ ___ 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