svn commit: r351969 - in head/sys: kern riscv/conf

2019-09-06 Thread Philip Paeps
Author: philip
Date: Sat Sep  7 05:13:31 2019
New Revision: 351969
URL: https://svnweb.freebsd.org/changeset/base/351969

Log:
  riscv: restore default HZ=1000, keep QEMU at HZ=100
  
  This reverts r351918 and r351919.
  
  Discussed with:   br, ian, imp

Modified:
  head/sys/kern/subr_param.c
  head/sys/riscv/conf/QEMU

Modified: head/sys/kern/subr_param.c
==
--- head/sys/kern/subr_param.c  Sat Sep  7 04:09:43 2019(r351968)
+++ head/sys/kern/subr_param.c  Sat Sep  7 05:13:31 2019(r351969)
@@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #ifndef HZ
-#  if defined(__mips__) || defined(__arm__) || defined(__riscv)
+#  if defined(__mips__) || defined(__arm__)
 #defineHZ 100
 #  else
 #defineHZ 1000

Modified: head/sys/riscv/conf/QEMU
==
--- head/sys/riscv/conf/QEMUSat Sep  7 04:09:43 2019(r351968)
+++ head/sys/riscv/conf/QEMUSat Sep  7 05:13:31 2019(r351969)
@@ -6,4 +6,5 @@ include "GENERIC"
 
 ident QEMU
 
+optionsHZ=100
 optionsROOTDEVNAME=\"ufs:/dev/vtbd0\"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351918 - head/sys/kern

2019-09-06 Thread Philip Paeps

On 2019-09-07 12:06:32 (+0800), Warner Losh wrote:
On Fri, Sep 6, 2019 at 9:54 PM Philip Paeps  
wrote:

On 2019-09-06 22:18:36 (+0800), Ian Lepore wrote:

On Fri, 2019-09-06 at 12:15 +0800, Philip Paeps wrote:

On 2019-09-06 11:15:12 (+0800), Ian Lepore wrote:

On Fri, 2019-09-06 at 01:19 +, Philip Paeps wrote:

Log:
  riscv: default to HZ=100


This seems like a bad idea.  I've run a 90mhz armv4 chip with 
HZ=1000 and didn't notice any performance hit from doing so.  
Almost all arm kernel config files set HZ as an option, so that 
define doesn't do much for arm these days.  It probably does still 
set HZ for various mips platforms.


I would think 1000 is appropriate for anything modern running at 
200mhz or more.


Setting it to 100 has the bad side effect of making things like 
msleep(), tsleep(), and pause() (which show up in plenty of 
drivers) all have a minimum timeout of 10ms, which is a long long 
time on modern hardware.


What benefit do you think you'll get from the lower number?


On systems running at 10s of MHz (or slower, ick), with HZ=1000 you 
spend an awful lot of time servicing the timer interrupt and not 
very much time doing anything else.


My rationale was that most RISC-V systems (including emulation and 
FPGA prototypes) I've encountered are running slower than the 
tipping point where HZ=1000 makes sense.  With the default of 
HZ=100, faster exceptions can still set HZ=1000 in their individual 
configs.


When the RISC-V world evolves to having more actual silicon and 
fewer slow prototypes, I definitely agree this default should be 
flipped again for HZ=1000 by default and HZ=100 in the config files 
for the exceptions.


Wait a second... are you saying that the riscv implementation 
doesn't support event timers and uses an old-style periodic tick 
based on HZ?


Depending on the hardware, there may not be an event timer (yet)...

As I wrote: I would be more than happy to revert this change when 
more silicon becomes available.  Presently, there is exactly one 
silicon RISC-V implementation commercially available (HiFive FU540) 
and even that one is kind of difficult to source.  Most people 
running RISC-V are doing so in emulation or on FPGAs.


Given how long these things take to boot to userland (where you 
really notice how slow things are), HZ=100 feels like a more sensible 
default than HZ=1000.


I think it show more that the defaults are bad for MIPS and ARM. All 
the MIPS files, except BERI/CHERI are 1000Hz. Well, Octeon is also 
100Hz, due to the defaults, but it will be fine at 1000Hz, so maybe we 
need to attend to this as well. Arm !=v5 is also 1000Hz, so it should 
be changed...


I don't feel terribly strongly about this though.  I've just been 
bitten several times in the last week on a <15MHz FPGA forgetting to 
set HZ=100 in config and figured I'd save others the trouble. ;-)


15MHz FPGA? FreeBSD 1.0 barely ran on 25MHz i386 machines of the 
time  How common are these beasts and how well does FreeBSD do on 
them. I assume these are early prototypes?


These are early prototypes indeed.

FreeBSD runs remarkably well on them.  Slowly of course.  Booting takes 
several minutes and running anything non-trivial can be frustrating.


I have no strong opinion on riscv, but do think mips and arm should 
change.


I will revert r351918 and r351919 since there is clearly no consensus.

Let's take this discussion to arch@?

Philip

--
Philip Paeps
Senior Reality Engineer
Alternative Enterprises
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r351918 - head/sys/kern

2019-09-06 Thread Warner Losh
On Fri, Sep 6, 2019 at 9:54 PM Philip Paeps  wrote:

> On 2019-09-06 22:18:36 (+0800), Ian Lepore wrote:
> > On Fri, 2019-09-06 at 12:15 +0800, Philip Paeps wrote:
> >> On 2019-09-06 11:15:12 (+0800), Ian Lepore wrote:
> >>> On Fri, 2019-09-06 at 01:19 +, Philip Paeps wrote:
>  Log:
>    riscv: default to HZ=100
> >>>
> >>> This seems like a bad idea.  I've run a 90mhz armv4 chip with
> >>> HZ=1000 and didn't notice any performance hit from doing so.  Almost
> >>> all arm kernel config files set HZ as an option, so that define
> >>> doesn't do much for arm these days.  It probably does still set HZ
> >>> for various mips platforms.
> >>>
> >>> I would think 1000 is appropriate for anything modern running at
> >>> 200mhz or more.
> >>>
> >>> Setting it to 100 has the bad side effect of making things like
> >>> msleep(), tsleep(), and pause() (which show up in plenty of drivers)
> >>> all have a minimum timeout of 10ms, which is a long long time on
> >>> modern hardware.
> >>>
> >>> What benefit do you think you'll get from the lower number?
> >>
> >> On systems running at 10s of MHz (or slower, ick), with HZ=1000 you
> >> spend an awful lot of time servicing the timer interrupt and not very
> >> much time doing anything else.
> >>
> >> My rationale was that most RISC-V systems (including emulation and
> >> FPGA prototypes) I've encountered are running slower than the tipping
> >> point where HZ=1000 makes sense.  With the default of HZ=100, faster
> >> exceptions can still set HZ=1000 in their individual configs.
> >>
> >> When the RISC-V world evolves to having more actual silicon and fewer
> >> slow prototypes, I definitely agree this default should be flipped
> >> again for HZ=1000 by default and HZ=100 in the config files for the
> >> exceptions.
> >
> > Wait a second... are you saying that the riscv implementation doesn't
> > support event timers and uses an old-style periodic tick based on HZ?
>
> Depending on the hardware, there may not be an event timer (yet)...
>
> As I wrote: I would be more than happy to revert this change when more
> silicon becomes available.  Presently, there is exactly one silicon
> RISC-V implementation commercially available (HiFive FU540) and even
> that one is kind of difficult to source.  Most people running RISC-V are
> doing so in emulation or on FPGAs.
>
> Given how long these things take to boot to userland (where you really
> notice how slow things are), HZ=100 feels like a more sensible default
> than HZ=1000.
>

I think it show more that the defaults are bad for MIPS and ARM. All the
MIPS files, except BERI/CHERI are 1000Hz. Well, Octeon is also 100Hz, due
to the defaults, but it will be fine at 1000Hz, so maybe we need to attend
to this as well. Arm !=v5 is also 1000Hz, so it should be changed...


> I don't feel terribly strongly about this though.  I've just been bitten
> several times in the last week on a <15MHz FPGA forgetting to set HZ=100
> in config and figured I'd save others the trouble. ;-)
>

15MHz FPGA? FreeBSD 1.0 barely ran on 25MHz i386 machines of the time
How common are these beasts and how well does FreeBSD do on them. I assume
these are early prototypes?

I have no strong opinion on riscv, but do think mips and arm should change.

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


Re: svn commit: r351918 - head/sys/kern

2019-09-06 Thread Philip Paeps

On 2019-09-06 22:18:36 (+0800), Ian Lepore wrote:

On Fri, 2019-09-06 at 12:15 +0800, Philip Paeps wrote:

On 2019-09-06 11:15:12 (+0800), Ian Lepore wrote:

On Fri, 2019-09-06 at 01:19 +, Philip Paeps wrote:

Log:
  riscv: default to HZ=100


This seems like a bad idea.  I've run a 90mhz armv4 chip with 
HZ=1000 and didn't notice any performance hit from doing so.  Almost 
all arm kernel config files set HZ as an option, so that define 
doesn't do much for arm these days.  It probably does still set HZ 
for various mips platforms.


I would think 1000 is appropriate for anything modern running at 
200mhz or more.


Setting it to 100 has the bad side effect of making things like 
msleep(), tsleep(), and pause() (which show up in plenty of drivers) 
all have a minimum timeout of 10ms, which is a long long time on 
modern hardware.


What benefit do you think you'll get from the lower number?


On systems running at 10s of MHz (or slower, ick), with HZ=1000 you 
spend an awful lot of time servicing the timer interrupt and not very 
much time doing anything else.


My rationale was that most RISC-V systems (including emulation and 
FPGA prototypes) I've encountered are running slower than the tipping 
point where HZ=1000 makes sense.  With the default of HZ=100, faster 
exceptions can still set HZ=1000 in their individual configs.


When the RISC-V world evolves to having more actual silicon and fewer 
slow prototypes, I definitely agree this default should be flipped 
again for HZ=1000 by default and HZ=100 in the config files for the 
exceptions.


Wait a second... are you saying that the riscv implementation doesn't 
support event timers and uses an old-style periodic tick based on HZ?


Depending on the hardware, there may not be an event timer (yet)...

As I wrote: I would be more than happy to revert this change when more 
silicon becomes available.  Presently, there is exactly one silicon 
RISC-V implementation commercially available (HiFive FU540) and even 
that one is kind of difficult to source.  Most people running RISC-V are 
doing so in emulation or on FPGAs.


Given how long these things take to boot to userland (where you really 
notice how slow things are), HZ=100 feels like a more sensible default 
than HZ=1000.


I don't feel terribly strongly about this though.  I've just been bitten 
several times in the last week on a <15MHz FPGA forgetting to set HZ=100 
in config and figured I'd save others the trouble. ;-)


Philip

--
Philip Paeps
Senior Reality Engineer
Alternative Enterprises
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351967 - head/sys/dev/usb

2019-09-06 Thread Warner Losh
Author: imp
Date: Sat Sep  7 03:51:26 2019
New Revision: 351967
URL: https://svnweb.freebsd.org/changeset/base/351967

Log:
  Some newer HID devices have descriptors that are larger than 1k. Bump
  this to 2k to prevent them from being truncated and ignored. It
  appears to be a sanity check only, but bumping it to 2k allows both of
  my iic hid devices to be parsed and the second one to work...

Modified:
  head/sys/dev/usb/usb_hid.c

Modified: head/sys/dev/usb/usb_hid.c
==
--- head/sys/dev/usb/usb_hid.c  Fri Sep  6 21:53:04 2019(r351966)
+++ head/sys/dev/usb/usb_hid.c  Sat Sep  7 03:51:26 2019(r351967)
@@ -74,7 +74,7 @@ static uint8_t hid_get_byte(struct hid_data *s, const 
 #defineMAXUSAGE 64
 #defineMAXPUSH 4
 #defineMAXID 16
-#defineMAXLOCCNT 1024
+#defineMAXLOCCNT 2048
 
 struct hid_pos_data {
int32_t rid;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351966 - stable/12/usr.bin/w

2019-09-06 Thread Mike Karels
Author: karels
Date: Fri Sep  6 21:53:04 2019
New Revision: 351966
URL: https://svnweb.freebsd.org/changeset/base/351966

Log:
  MFC r351379 r351385 r351592:
  
  Change w(1) to compute FROM (host) field size dynamically
  
  It's nice to be able to display a full IPv6 host address if
  needed, but it's also nice to display more than 3 characters of a command
  line. Compute the needed size for the FROM column in an earlier pass,
  and determine the maximum, then print what fits for the command.
  
  Fix address annotation in xml output from w
  
  The libxo xml feature of adding an annotation with the "original"
  address from the utmpx file if it is different than the final "from"
  field was broken by r351379. This was pointed out by the gcc error
  that save_p might be used uninitialized. Save the original address
  as needed in each entry, don't just use the last one from the previous
  loop.
  
  Reviewed by:marcel@
  Differential Revision:  https://reviews.freebsd.org/D21211
  Differential Revision:  https://reviews.freebsd.org/D21390

Modified:
  stable/12/usr.bin/w/w.c

Modified: stable/12/usr.bin/w/w.c
==
--- stable/12/usr.bin/w/w.c Fri Sep  6 20:38:25 2019(r351965)
+++ stable/12/usr.bin/w/w.c Fri Sep  6 21:53:04 2019(r351966)
@@ -96,7 +96,8 @@ static struct winsize ws;
 static kvm_t   *kd;
 static time_t  now;/* the current time of day */
 static int ttywidth;   /* width of tty */
-static int argwidth;   /* width of tty */
+static int fromwidth = 0;  /* max width of "from" field */
+static int argwidth;   /* width of arguments */
 static int header = 1; /* true if -h flag: don't print heading */
 static int nflag;  /* true if -n flag: don't convert addrs */
 static int dflag;  /* true if -d flag: output debug info */
@@ -116,13 +117,15 @@ static struct entry {
struct  kinfo_proc *kp; /* `most interesting' proc */
char*args;  /* arg list of interesting process */
struct  kinfo_proc *dkp;/* debug option proc list */
+   char*from;  /* "from": name or addr */
+   char*save_from; /* original "from": name or addr */
 } *ep, *ehead = NULL, **nextp = 
 
 #definedebugproc(p) *(&((struct kinfo_proc *)p)->ki_udata)
 
 #defineW_DISPUSERSIZE  10
 #defineW_DISPLINESIZE  8
-#defineW_DISPHOSTSIZE  40
+#defineW_MAXHOSTSIZE   40
 
 static void pr_header(time_t *, int);
 static struct stat *ttystat(char *);
@@ -209,6 +212,13 @@ main(int argc, char *argv[])
 
setutxent();
for (nusers = 0; (utmp = getutxent()) != NULL;) {
+   struct addrinfo hints, *res;
+   struct sockaddr_storage ss;
+   struct sockaddr *sa = (struct sockaddr *)
+   struct sockaddr_in *lsin = (struct sockaddr_in *)
+   struct sockaddr_in6 *lsin6 = (struct sockaddr_in6 *)
+   int isaddr;
+
if (utmp->ut_type != USER_PROCESS)
continue;
if (!(stp = ttystat(utmp->ut_line)))
@@ -250,9 +260,78 @@ main(int argc, char *argv[])
}
if ((ep->idle = now - touched) < 0)
ep->idle = 0;
+
+   save_p = p = *ep->utmp.ut_host ? ep->utmp.ut_host : "-";
+   if ((x_suffix = strrchr(p, ':')) != NULL) {
+   if ((dot = strchr(x_suffix, '.')) != NULL &&
+   strchr(dot+1, '.') == NULL)
+   *x_suffix++ = '\0';
+   else
+   x_suffix = NULL;
+   }
+
+   isaddr = 0;
+   memset(, '\0', sizeof(ss));
+   if (inet_pton(AF_INET6, p, >sin6_addr) == 1) {
+   lsin6->sin6_len = sizeof(*lsin6);
+   lsin6->sin6_family = AF_INET6;
+   isaddr = 1;
+   } else if (inet_pton(AF_INET, p, >sin_addr) == 1) {
+   lsin->sin_len = sizeof(*lsin);
+   lsin->sin_family = AF_INET;
+   isaddr = 1;
+   }
+   if (nflag == 0) {
+   /* Attempt to change an IP address into a name */
+   if (isaddr && realhostname_sa(fn, sizeof(fn), sa,
+   sa->sa_len) == HOSTNAME_FOUND)
+   p = fn;
+   } else if (!isaddr && nflag > 1) {
+   /*
+* If a host has only one A/ RR, change a
+* name into an IP address
+*/
+   memset(, 0, sizeof(hints));
+   hints.ai_flags = AI_PASSIVE;
+   hints.ai_family = 

svn commit: r351964 - stable/12/sbin/ping6

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 20:16:08 2019
New Revision: 351964
URL: https://svnweb.freebsd.org/changeset/base/351964

Log:
  MFC r350858-r350859, r350987, r351170
  
  r350858:
  ping6: Add missing static keyword for a global variable
  
  This fixes -Wmissing-variable-declarations error when compiled with
  WARNS=6.
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21214
  
  r350859:
  ping6: Remove unnecessary level of indirection from dnsdecode() parameter
  
  The `sp' pointer doesn't need to be modified in the caller of
  dnsdecode().
  
  This fixes -Wcast-qual error (`must have all intermediate pointers
  const qualified to be safe') when compiled with WARNS=6.
  
  Submitted by: Ján Sučan 
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21215
  
  r350987:
  ping6: Fix data type of a variable for a packet sequence number
  
  Submitted by:   Ján Sučan 
  Sponsored by:   Google, inc. (Google Summer of Code 2019)
  Differential Revision:  https://reviews.freebsd.org/D21218
  
  r351170:
  ping6: Fix dnsdecode() bug introduced by r350859
  
  Revision 350859 removed level of indirection that was needed for setting the
  caller's `cp' pointer. dnsdecode() uses return value to indicate error or
  success. It returns pointer to a buffer holding a decompressed DNS name or
  NULL. The caller uses that value only to find out the result, not for 
accessing
  the buffer.
  
  We use the return value to propagate the new value of `cp' pointer to
  the caller instead of using an output argument.
  
  Submitted by: Ján Sučan 
  MFC-With: 350859
  Sponsored by: Google, Inc (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21266

Modified:
  stable/12/sbin/ping6/ping6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ping6/ping6.c
==
--- stable/12/sbin/ping6/ping6.cFri Sep  6 19:50:45 2019
(r351963)
+++ stable/12/sbin/ping6/ping6.cFri Sep  6 20:16:08 2019
(r351964)
@@ -198,7 +198,7 @@ struct tv32 {
 #define F_DONTFRAG 0x100
 #define F_NOUSERDATA   (F_NODEADDR | F_FQDN | F_FQDNOLD | F_SUPTYPES)
 #defineF_WAITTIME  0x200
-u_int options;
+static u_int options;
 
 #define IN6LEN sizeof(struct in6_addr)
 #define SA6LEN sizeof(struct sockaddr_in6)
@@ -279,7 +279,7 @@ static void  pr_suptypes(struct icmp6_nodeinfo *, size
 static void pr_nodeaddr(struct icmp6_nodeinfo *, int);
 static int  myechoreply(const struct icmp6_hdr *);
 static int  mynireply(const struct icmp6_nodeinfo *);
-static char *dnsdecode(const u_char **, const u_char *, const u_char *,
+static const char *dnsdecode(const u_char *, const u_char *, const u_char *,
 char *, size_t);
 static void pr_pack(u_char *, int, struct msghdr *);
 static void pr_exthdrs(struct msghdr *);
@@ -1304,7 +1304,7 @@ pinger(void)
struct iovec iov[2];
int i, cc;
struct icmp6_nodeinfo *nip;
-   int seq;
+   uint16_t seq;
 
if (npackets && ntransmitted >= npackets)
return(-1); /* no more transmission */
@@ -1430,10 +1430,26 @@ mynireply(const struct icmp6_nodeinfo *nip)
return 0;
 }
 
-static char *
-dnsdecode(const u_char **sp, const u_char *ep, const u_char *base, char *buf,
+/*
+ * Decode a name from a DNS message.
+ *
+ * Format of the message is described in RFC 1035 subsection 4.1.4.
+ *
+ * Arguments:
+ *   sp - Pointer to a DNS pointer octet or to the first octet of a label
+ *in the message.
+ *   ep - Pointer to the end of the message (one step past the last octet).
+ *   base   - Pointer to the beginning of the message.
+ *   buf- Buffer into which the decoded name will be saved.
+ *   bufsiz - Size of the buffer 'buf'.
+ *
+ * Return value:
+ *   Pointer to an octet immediately following the ending zero octet
+ *   of the decoded label, or NULL if an error occured.
+ */
+static const char *
+dnsdecode(const u_char *sp, const u_char *ep, const u_char *base, char *buf,
size_t bufsiz)
-   /*base for compressed name*/
 {
int i;
const u_char *cp;
@@ -1441,14 +1457,14 @@ dnsdecode(const u_char **sp, const u_char *ep, const u
const u_char *comp;
int l;
 
-   cp = *sp;
+   cp = sp;
*buf = '\0';
 
if (cp >= ep)
return NULL;
while (cp < ep) {
i = *cp;
-   if (i == 0 || cp != *sp) {
+   if (i == 0 || cp != sp) {
if (strlcat((char *)buf, ".", bufsiz) >= bufsiz)
return NULL;/*result overrun*/
}
@@ -1462,7 +1478,7 @@ dnsdecode(const u_char **sp, const u_char 

svn commit: r351963 - head/tests/sys/fs/fusefs

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 19:50:45 2019
New Revision: 351963
URL: https://svnweb.freebsd.org/changeset/base/351963

Log:
  fusefs: coverity cleanup in the tests
  
  Address the following defects reported by Coverity:
  
  * Structurally dead code (CID 1404366): set m_quit before FAIL, not after
  
  * Unchecked return value of sysctlbyname (CID 1404321)
  
  * Unchecked return value of stat(2) (CID 1404471)
  
  * Unchecked return value of open(2) (CID 1404402, 1404529)
  
  * Unchecked return value of dup(2) (CID 1404478)
  
  * Buffer overflows. These are all false positives caused by the fact that
Coverity thinks I'm using a buffer to store strings, when in fact I'm
really just using it to store a byte array that happens to be initialized
with a string. I'm changing the type from char to uint8_t in the hopes
that it will placate Coverity. (CID 1404338, 1404350, 1404367, 1404376,
1404379, 1404381, 1404388, 1404403, 1404425, 1404433, 1404434, 1404474,
1404480, 1404484, 1404503, 1404505)
  
  * False positive file descriptor leak. I'm going to try to fix this with
Coverity modeling, but I'll also change an EXPECT to ASSERT so we don't
perform meaningless assertions after the failure. (CID 1404320, 1404324,
1404440, 1404445).
  
  * Unannotated file descriptor leak. This will be followed up by a Coverity
modeling change. (CID 1404326, 1404334, 1404336, 1404357, 1404361,
1404372, 1404391, 1404395, 1404409, 1404430, 1404448, 1404451, 1404455,
1404457, 1404458, 1404460)
  
  * Uninitialized variables in C++ constructors (CID 1404327, 1404346). In the
case of m_maxphys, this actually led to part of the FUSE_INIT's response
being set to stack garbage during the WriteCluster::clustering test.
  
  * Uninitialized sun_len field in struct sockaddr_un (CID 1404330, 1404371,
1404429).
  
  Reported by:  Coverity
  Reviewed by:  emaste
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21457

Modified:
  head/tests/sys/fs/fusefs/allow_other.cc
  head/tests/sys/fs/fusefs/bmap.cc
  head/tests/sys/fs/fusefs/default_permissions.cc
  head/tests/sys/fs/fusefs/dev_fuse_poll.cc
  head/tests/sys/fs/fusefs/fifo.cc
  head/tests/sys/fs/fusefs/interrupt.cc
  head/tests/sys/fs/fusefs/io.cc
  head/tests/sys/fs/fusefs/mknod.cc
  head/tests/sys/fs/fusefs/mockfs.cc
  head/tests/sys/fs/fusefs/notify.cc
  head/tests/sys/fs/fusefs/open.cc
  head/tests/sys/fs/fusefs/opendir.cc
  head/tests/sys/fs/fusefs/read.cc
  head/tests/sys/fs/fusefs/release.cc
  head/tests/sys/fs/fusefs/setattr.cc
  head/tests/sys/fs/fusefs/utils.cc
  head/tests/sys/fs/fusefs/utils.hh
  head/tests/sys/fs/fusefs/write.cc

Modified: head/tests/sys/fs/fusefs/allow_other.cc
==
--- head/tests/sys/fs/fusefs/allow_other.cc Fri Sep  6 19:46:27 2019
(r351962)
+++ head/tests/sys/fs/fusefs/allow_other.cc Fri Sep  6 19:50:45 2019
(r351963)
@@ -255,6 +255,8 @@ TEST_F(NoAllowOther, disallowed_beneath_root)
}
);
ASSERT_EQ(0, WEXITSTATUS(status));
+
+   leak(dfd);
 }
 
 /* 

Modified: head/tests/sys/fs/fusefs/bmap.cc
==
--- head/tests/sys/fs/fusefs/bmap.ccFri Sep  6 19:46:27 2019
(r351962)
+++ head/tests/sys/fs/fusefs/bmap.ccFri Sep  6 19:50:45 2019
(r351963)
@@ -158,4 +158,6 @@ TEST_F(Bmap, default_)
EXPECT_EQ(arg.bn, lbn * m_maxbcachebuf / DEV_BSIZE);
EXPECT_EQ(arg.runp, 0);
EXPECT_EQ(arg.runb, m_maxphys / m_maxbcachebuf - 1);
+
+   leak(fd);
 }

Modified: head/tests/sys/fs/fusefs/default_permissions.cc
==
--- head/tests/sys/fs/fusefs/default_permissions.cc Fri Sep  6 19:46:27 
2019(r351962)
+++ head/tests/sys/fs/fusefs/default_permissions.cc Fri Sep  6 19:50:45 
2019(r351963)
@@ -503,7 +503,7 @@ TEST_F(Create, eacces)
EXPECT_LOOKUP(FUSE_ROOT_ID, RELPATH)
.WillOnce(Invoke(ReturnErrno(ENOENT)));
 
-   EXPECT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, 0644));
+   ASSERT_EQ(-1, open(FULLPATH, O_CREAT | O_EXCL, 0644));
EXPECT_EQ(EACCES, errno);
 }
 

Modified: head/tests/sys/fs/fusefs/dev_fuse_poll.cc
==
--- head/tests/sys/fs/fusefs/dev_fuse_poll.cc   Fri Sep  6 19:46:27 2019
(r351962)
+++ head/tests/sys/fs/fusefs/dev_fuse_poll.cc   Fri Sep  6 19:50:45 2019
(r351963)
@@ -107,13 +107,12 @@ static void* statter(void* arg) {
struct stat sb;
 
name = (const char*)arg;
-   stat(name, );
-   return 0;
+   return ((void*)(intptr_t)stat(name, ));
 }
 
 /*
  * A kevent's data field should contain the number of operations available to
- * be 

svn commit: r351962 - stable/12/sbin/ping6

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 19:46:27 2019
New Revision: 351962
URL: https://svnweb.freebsd.org/changeset/base/351962

Log:
  MFC r350556:
  
  Capsicumize ping6
  
  Add capsicum support to ping6, mostly copying the strategy used for ping.
  
  Submitted by: Ján Sučan 
  Reviewed by:  markj
  Sponsored by: Google, inc. (Google Summer of Code 2019)
  Differential Revision:https://reviews.freebsd.org/D21050

Modified:
  stable/12/sbin/ping6/Makefile
  stable/12/sbin/ping6/ping6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ping6/Makefile
==
--- stable/12/sbin/ping6/Makefile   Fri Sep  6 19:40:11 2019
(r351961)
+++ stable/12/sbin/ping6/Makefile   Fri Sep  6 19:46:27 2019
(r351962)
@@ -1,5 +1,7 @@
 # $FreeBSD$
 
+.include 
+
 PACKAGE=runtime
 PROG=  ping6
 MAN=   ping6.8
@@ -11,5 +13,13 @@ BINOWN=  root
 BINMODE=4555
 
 LIBADD=ipsec m md
+
+.if ${MK_DYNAMICROOT} == "no"
+.warning ${PROG} built without libcasper support
+.elif ${MK_CASPER} != "no" && !defined(RESCUE)
+LIBADD+=   casper
+LIBADD+=   cap_dns
+CFLAGS+=-DWITH_CASPER
+.endif
 
 .include 

Modified: stable/12/sbin/ping6/ping6.c
==
--- stable/12/sbin/ping6/ping6.cFri Sep  6 19:40:11 2019
(r351961)
+++ stable/12/sbin/ping6/ping6.cFri Sep  6 19:46:27 2019
(r351962)
@@ -104,6 +104,7 @@ __FBSDID("$FreeBSD$");
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -118,6 +119,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
+#include 
+#include 
+#include 
+
 #include 
 #include 
 #include 
@@ -214,7 +219,8 @@ static struct sockaddr_in6 dst; /* who to ping6 */
 static struct sockaddr_in6 src;/* src addr of this packet */
 static socklen_t srclen;
 static size_t datalen = DEFDATALEN;
-static int s;  /* socket file descriptor */
+static int ssend;  /* send socket file descriptor */
+static int srecv;  /* receive socket file descriptor */
 static u_char outpack[MAXPACKETLEN];
 static char BSPACE = '\b'; /* characters written for flood */
 static char BBELL = '\a';  /* characters written for AUDIBLE */
@@ -224,6 +230,7 @@ static int ident;   /* process id to identify our 
packe
 static u_int8_t nonce[8];  /* nonce field for node information */
 static int hoplimit = -1;  /* hoplimit */
 static u_char *packet = NULL;
+static cap_channel_t *capdns;
 
 /* counters */
 static long nmissedmax;/* max value of ntransmitted - 
nreceived - 1 */
@@ -256,6 +263,7 @@ static volatile sig_atomic_t seeninfo;
 #endif
 
 int main(int, char *[]);
+static cap_channel_t *capdns_setup(void);
 static void fill(char *, char *);
 static int  get_hoplim(struct msghdr *);
 static int  get_pathmtu(struct msghdr *);
@@ -318,6 +326,9 @@ main(int argc, char *argv[])
 #ifdef IPV6_USE_MIN_MTU
int mflag = 0;
 #endif
+   cap_rights_t rights_srecv;
+   cap_rights_t rights_ssend;
+   cap_rights_t rights_stdin;
 
/* just to be sure */
memset(, 0, sizeof(smsghdr));
@@ -325,6 +336,7 @@ main(int argc, char *argv[])
 
alarmtimeout = preload = 0;
datap = [ICMP6ECHOLEN + ICMP6ECHOTMLEN];
+   capdns = capdns_setup();
 #ifndef IPSEC
 #define ADDOPTS
 #else
@@ -503,7 +515,7 @@ main(int argc, char *argv[])
hints.ai_socktype = SOCK_RAW;
hints.ai_protocol = IPPROTO_ICMPV6;
 
-   error = getaddrinfo(optarg, NULL, , );
+   error = cap_getaddrinfo(capdns, optarg, NULL, , 
);
if (error) {
errx(1, "invalid source address: %s",
 gai_strerror(error));
@@ -619,14 +631,14 @@ main(int argc, char *argv[])
} else
target = argv[argc - 1];
 
-   /* getaddrinfo */
+   /* cap_getaddrinfo */
memset(, 0, sizeof(struct addrinfo));
hints.ai_flags = AI_CANONNAME;
hints.ai_family = AF_INET6;
hints.ai_socktype = SOCK_RAW;
hints.ai_protocol = IPPROTO_ICMPV6;
 
-   error = getaddrinfo(target, NULL, , );
+   error = cap_getaddrinfo(capdns, target, NULL, , );
if (error)
errx(1, "%s", gai_strerror(error));
if (res->ai_canonname)
@@ -635,13 +647,16 @@ main(int argc, char *argv[])
hostname = target;
 
if (!res->ai_addr)
-   errx(1, "getaddrinfo failed");
+   errx(1, "cap_getaddrinfo failed");
 
(void)memcpy(, res->ai_addr, res->ai_addrlen);
 
-   if ((s = socket(res->ai_family, res->ai_socktype,
+   if ((ssend = socket(res->ai_family, res->ai_socktype,
res->ai_protocol)) < 0)
-   err(1, "socket");
+   err(1, 

svn commit: r351961 - head/sys/fs/fuse

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 19:40:11 2019
New Revision: 351961
URL: https://svnweb.freebsd.org/changeset/base/351961

Log:
  Coverity fixes in fusefs(5)
  
  CID 1404532 fixes a signed vs unsigned comparison error in fuse_vnop_bmap.
  It could potentially have resulted in VOP_BMAP reporting too many
  consecutive blocks.
  
  CID 1404364 is much worse. It was an array access by an untrusted,
  user-provided variable. It could potentially have resulted in a malicious
  file system crashing the kernel or worse.
  
  Reported by:  Coverity
  Reviewed by:  emaste
  MFC after:3 days
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21466

Modified:
  head/sys/fs/fuse/fuse_internal.c
  head/sys/fs/fuse/fuse_vnops.c

Modified: head/sys/fs/fuse/fuse_internal.c
==
--- head/sys/fs/fuse/fuse_internal.cFri Sep  6 19:36:41 2019
(r351960)
+++ head/sys/fs/fuse/fuse_internal.cFri Sep  6 19:40:11 2019
(r351961)
@@ -390,6 +390,9 @@ fuse_internal_invalidate_entry(struct mount *mp, struc
if ((err = uiomove(, sizeof(fnieo), uio)) != 0)
return (err);
 
+   if (fnieo.namelen > sizeof(name))
+   return (EINVAL);
+
if ((err = uiomove(name, fnieo.namelen, uio)) != 0)
return (err);
name[fnieo.namelen] = '\0';

Modified: head/sys/fs/fuse/fuse_vnops.c
==
--- head/sys/fs/fuse/fuse_vnops.c   Fri Sep  6 19:36:41 2019
(r351960)
+++ head/sys/fs/fuse/fuse_vnops.c   Fri Sep  6 19:40:11 2019
(r351961)
@@ -504,7 +504,7 @@ fuse_vnop_bmap(struct vop_bmap_args *ap)
if (runp != NULL) {
error = fuse_vnode_size(vp, , td->td_ucred, td);
if (error == 0)
-   *runp = MIN(MAX(0, filesize / biosize - lbn - 1),
+   *runp = MIN(MAX(0, filesize / (off_t)biosize - lbn - 1),
maxrun);
else
*runp = 0;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351960 - stable/12/share/mk

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 19:36:41 2019
New Revision: 351960
URL: https://svnweb.freebsd.org/changeset/base/351960

Log:
  MFC r350453:
  
  Add a CXXWARNFLAGS variable
  
  Some warning flags are valid for C++ but not C. GCC 8 complains if you pass
  such flags when building a C file. Using a separate variable for these
  flags allows building both C and C++ files in the same directory (such as
  the fusefs tests) under GCC.
  
  Reviewed by:  cem, emaste
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21116

Modified:
  stable/12/share/mk/bsd.sys.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/mk/bsd.sys.mk
==
--- stable/12/share/mk/bsd.sys.mk   Fri Sep  6 19:30:23 2019
(r351959)
+++ stable/12/share/mk/bsd.sys.mk   Fri Sep  6 19:36:41 2019
(r351960)
@@ -234,6 +234,8 @@ DEBUG_FILES_CFLAGS?= -g
 .if ${MK_WARNS} != "no"
 CFLAGS+=   ${CWARNFLAGS:M*} ${CWARNFLAGS.${COMPILER_TYPE}}
 CFLAGS+=   ${CWARNFLAGS.${.IMPSRC:T}}
+CXXFLAGS+= ${CXXWARNFLAGS:M*} ${CXXWARNFLAGS.${COMPILER_TYPE}}
+CXXFLAGS+= ${CXXWARNFLAGS.${.IMPSRC:T}}
 .endif
 
 CFLAGS+=${CFLAGS.${COMPILER_TYPE}}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351959 - head/stand/efi/libefi

2019-09-06 Thread Toomas Soome
Author: tsoome
Date: Fri Sep  6 19:30:23 2019
New Revision: 351959
URL: https://svnweb.freebsd.org/changeset/base/351959

Log:
  loader.efi: UEFI text mode background colors are only using 3 bits
  
  Need to mask background colors to pass allowed value.

Modified:
  head/stand/efi/libefi/efi_console.c

Modified: head/stand/efi/libefi/efi_console.c
==
--- head/stand/efi/libefi/efi_console.c Fri Sep  6 19:29:02 2019
(r351958)
+++ head/stand/efi/libefi/efi_console.c Fri Sep  6 19:30:23 2019
(r351959)
@@ -159,7 +159,7 @@ efi_text_printchar(const teken_pos_t *p)
}
 
attr = EFI_TEXT_ATTR(teken_color_to_efi_color[fg],
-   teken_color_to_efi_color[bg]);
+   teken_color_to_efi_color[bg] & 0x7);
 
conout->SetCursorPosition(conout, p->tp_col, p->tp_row);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351958 - stable/12/sys/kern

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 19:29:02 2019
New Revision: 351958
URL: https://svnweb.freebsd.org/changeset/base/351958

Log:
  MFC r350426:
  
  sendfile: don't panic when VOP_GETPAGES_ASYNC returns an error
  
  This is a partial merge of 350144 from projects/fuse2
  
  PR:   236466
  Reviewed by:  markj
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21095

Modified:
  stable/12/sys/kern/kern_sendfile.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/kern_sendfile.c
==
--- stable/12/sys/kern/kern_sendfile.c  Fri Sep  6 19:22:33 2019
(r351957)
+++ stable/12/sys/kern/kern_sendfile.c  Fri Sep  6 19:29:02 2019
(r351958)
@@ -316,13 +316,13 @@ sendfile_iodone(void *arg, vm_page_t *pg, int count, i
  * Iterate through pages vector and request paging for non-valid pages.
  */
 static int
-sendfile_swapin(vm_object_t obj, struct sf_io *sfio, off_t off, off_t len,
-int npages, int rhpages, int flags)
+sendfile_swapin(vm_object_t obj, struct sf_io *sfio, int *nios, off_t off,
+off_t len, int npages, int rhpages, int flags)
 {
vm_page_t *pa = sfio->pa;
-   int grabbed, nios;
+   int grabbed;
 
-   nios = 0;
+   *nios = 0;
flags = (flags & SF_NODISKIO) ? VM_ALLOC_NOWAIT : 0;
 
/*
@@ -341,7 +341,7 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
}
 
for (int i = 0; i < npages;) {
-   int j, a, count, rv __unused;
+   int j, a, count, rv;
 
/* Skip valid pages. */
if (vm_page_is_valid(pa[i], vmoff(i, off) & PAGE_MASK,
@@ -404,6 +404,17 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
rv = vm_pager_get_pages_async(obj, pa + i, count, NULL,
i + count == npages ?  : NULL,
_iodone, sfio);
+   if (rv != VM_PAGER_OK) {
+   for (j = i; j < i + count; j++) {
+   if (pa[j] != bogus_page) {
+   vm_page_lock(pa[j]);
+   vm_page_unwire(pa[j], PQ_INACTIVE);
+   vm_page_unlock(pa[j]);
+   }
+   }
+   VM_OBJECT_WUNLOCK(obj);
+   return (EIO);
+   }
KASSERT(rv == VM_PAGER_OK, ("%s: pager fail obj %p page %p",
__func__, obj, pa[i]));
 
@@ -425,15 +436,15 @@ sendfile_swapin(vm_object_t obj, struct sf_io *sfio, o
 
}
i += count;
-   nios++;
+   (*nios)++;
}
 
VM_OBJECT_WUNLOCK(obj);
 
-   if (nios == 0 && npages != 0)
+   if (*nios == 0 && npages != 0)
SFSTAT_INC(sf_noiocnt);
 
-   return (nios);
+   return (0);
 }
 
 static int
@@ -743,8 +754,14 @@ retry_space:
sfio->so = so;
sfio->error = 0;
 
-   nios = sendfile_swapin(obj, sfio, off, space, npages, rhpages,
-   flags);
+   error = sendfile_swapin(obj, sfio, , off, space, npages,
+   rhpages, flags);
+   if (error != 0) {
+   if (vp != NULL)
+   VOP_UNLOCK(vp, 0);
+   free(sfio, M_TEMP);
+   goto done;
+   }
 
/*
 * Loop and construct maximum sized mbuf chain to be bulk
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351957 - in stable/12/sys: kern sys

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 19:22:33 2019
New Revision: 351957
URL: https://svnweb.freebsd.org/changeset/base/351957

Log:
  MFC r350386, r350390
  
  r350386:
  Add v_inval_buf_range, like vtruncbuf but for a range of a file
  
  v_inval_buf_range invalidates all buffers within a certain LBA range of a
  file. It will be used by fusefs(5). This commit is a partial merge of
  r346162, r346606, and r346756 from projects/fuse2.
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21032
  
  r350390:
  Better comments for vlrureclaim
  
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/kern/vfs_subr.c
  stable/12/sys/sys/vnode.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/vfs_subr.c
==
--- stable/12/sys/kern/vfs_subr.c   Fri Sep  6 19:22:24 2019
(r351956)
+++ stable/12/sys/kern/vfs_subr.c   Fri Sep  6 19:22:33 2019
(r351957)
@@ -117,6 +117,8 @@ static void vfs_knl_assert_locked(void *arg);
 static voidvfs_knl_assert_unlocked(void *arg);
 static voidvnlru_return_batches(struct vfsops *mnt_op);
 static voiddestroy_vpollinfo(struct vpollinfo *vi);
+static int v_inval_buf_range_locked(struct vnode *vp, struct bufobj *bo,
+   daddr_t startlbn, daddr_t endlbn);
 
 /*
  * These fences are intended for cases where some synchronization is
@@ -944,9 +946,16 @@ vattr_null(struct vattr *vap)
  * desirable to reuse such vnodes.  These conditions may cause the
  * number of vnodes to reach some minimum value regardless of what
  * you set kern.maxvnodes to.  Do not set kern.maxvnodes too low.
+ *
+ * @param mpTry to reclaim vnodes from this mountpoint
+ * @param reclaim_nc_src Only reclaim directories with outgoing namecache
+ *  entries if this argument is strue
+ * @param trigger   Only reclaim vnodes with fewer than this many resident
+ *  pages.
+ * @return  The number of vnodes that were reclaimed.
  */
 static int
-vlrureclaim(struct mount *mp, int reclaim_nc_src, int trigger)
+vlrureclaim(struct mount *mp, bool reclaim_nc_src, int trigger)
 {
struct vnode *vp;
int count, done, target;
@@ -1235,7 +1244,8 @@ vnlru_proc(void)
 {
struct mount *mp, *nmp;
unsigned long onumvnodes;
-   int done, force, reclaim_nc_src, trigger, usevnodes;
+   int done, force, trigger, usevnodes;
+   bool reclaim_nc_src;
 
EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc,
SHUTDOWN_PRI_FIRST);
@@ -1945,9 +1955,8 @@ int
 vtruncbuf(struct vnode *vp, off_t length, int blksize)
 {
struct buf *bp, *nbp;
-   int anyfreed;
-   daddr_t trunclbn;
struct bufobj *bo;
+   daddr_t startlbn;
 
CTR4(KTR_VFS, "%s: vp %p with block %d:%ju", __func__,
vp, blksize, (uintmax_t)length);
@@ -1955,91 +1964,134 @@ vtruncbuf(struct vnode *vp, off_t length, int blksize)
/*
 * Round up to the *next* lbn.
 */
-   trunclbn = howmany(length, blksize);
+   startlbn = howmany(length, blksize);
 
ASSERT_VOP_LOCKED(vp, "vtruncbuf");
-restart:
+
bo = >v_bufobj;
+restart_unlocked:
BO_LOCK(bo);
-   anyfreed = 1;
-   for (;anyfreed;) {
-   anyfreed = 0;
-   TAILQ_FOREACH_SAFE(bp, >bo_clean.bv_hd, b_bobufs, nbp) {
-   if (bp->b_lblkno < trunclbn)
+
+   while (v_inval_buf_range_locked(vp, bo, startlbn, INT64_MAX) == EAGAIN)
+   ;
+
+   if (length > 0) {
+restartsync:
+   TAILQ_FOREACH_SAFE(bp, >bo_dirty.bv_hd, b_bobufs, nbp) {
+   if (bp->b_lblkno > 0)
continue;
+   /*
+* Since we hold the vnode lock this should only
+* fail if we're racing with the buf daemon.
+*/
if (BUF_LOCK(bp,
LK_EXCLUSIVE | LK_SLEEPFAIL | LK_INTERLOCK,
BO_LOCKPTR(bo)) == ENOLCK)
-   goto restart;
+   goto restart_unlocked;
 
-   bremfree(bp);
-   bp->b_flags |= (B_INVAL | B_RELBUF);
-   bp->b_flags &= ~B_ASYNC;
-   brelse(bp);
-   anyfreed = 1;
+   VNASSERT((bp->b_flags & B_DELWRI), vp,
+   ("buf(%p) on dirty queue without DELWRI", bp));
 
+   bremfree(bp);
+   bawrite(bp);
BO_LOCK(bo);
-   if (nbp != NULL &&
-   (((nbp->b_xflags & BX_VNCLEAN) == 0) ||
-   (nbp->b_vp != vp) 

svn commit: r351955 - stable/12/lib/libc/gen

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 19:07:34 2019
New Revision: 351955
URL: https://svnweb.freebsd.org/changeset/base/351955

Log:
  MFC r350314:
  
  special-case getvfsbyname(3) for fusefs(5)
  
  fusefs file systems may have a fsname subtype (set by mount_fusefs's "-o
  subtype" option) that gets appended to the fsname as returned by statfs(2).
  The subtype is set on a per-mount basis so it isn't part of the struct
  vfsconf. Special-case getvfsbyname to match either the full "fusefs.foobar"
  or short "fusefs" fsname.
  
  This is a merge of r348007, r348054, and r350093 from projects/fuse2
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21043

Modified:
  stable/12/lib/libc/gen/getvfsbyname.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libc/gen/getvfsbyname.c
==
--- stable/12/lib/libc/gen/getvfsbyname.c   Fri Sep  6 19:05:01 2019
(r351954)
+++ stable/12/lib/libc/gen/getvfsbyname.c   Fri Sep  6 19:07:34 2019
(r351955)
@@ -37,10 +37,26 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 /*
+ * fusefs(5) file systems may have a "subtype" which gets appended to
+ * statfs(2)'s f_fstypename field on a per-mount basis.  Allow getvfsbyname to
+ * match either the full "fusefs.foobar" or the more general "fusefs".
+ */
+static bool
+are_fusefs(const char *fsname, const char *vfc_name)
+{
+   const static char fusefs[] = "fusefs";
+   const static char fusefs_dot[] = "fusefs.";
+
+   return (strncmp(fsname, fusefs_dot, sizeof(fusefs_dot) - 1) == 0 &&
+   strcmp(fusefs, vfc_name) == 0);
+}
+
+/*
  * Given a filesystem name, determine if it is resident in the kernel,
  * and if it is resident, return its xvfsconf structure.
  */
@@ -62,7 +78,8 @@ getvfsbyname(const char *fsname, struct xvfsconf *vfcp
}
cnt = buflen / sizeof(struct xvfsconf);
for (i = 0; i < cnt; i++) {
-   if (strcmp(fsname, xvfsp[i].vfc_name) == 0) {
+   if (strcmp(fsname, xvfsp[i].vfc_name) == 0 ||
+   are_fusefs(fsname, xvfsp[i].vfc_name)) {
memcpy(vfcp, xvfsp + i, sizeof(struct xvfsconf));
free(xvfsp);
return (0);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351954 - head/share/mk

2019-09-06 Thread Simon J. Gerraty
Author: sjg
Date: Fri Sep  6 19:05:01 2019
New Revision: 351954
URL: https://svnweb.freebsd.org/changeset/base/351954

Log:
  Use file destdir for stage_as sets
  
  We cannot use file (without :T) to name targets
  but we can use the destination directory (with / replaced by _)
  This has the benefit of minimizing the targets created.
  
  Reviewed by:  bdrewery
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org//D21283

Modified:
  head/share/mk/bsd.files.mk

Modified: head/share/mk/bsd.files.mk
==
--- head/share/mk/bsd.files.mk  Fri Sep  6 18:51:41 2019(r351953)
+++ head/share/mk/bsd.files.mk  Fri Sep  6 19:05:01 2019(r351954)
@@ -101,11 +101,16 @@ ${group}NAME_${file}?=${${group}NAME}
 .else
 ${group}NAME_${file}?= ${file:T}
 .endif # defined(${group}NAME)
-STAGE_AS_SETS+=${file}
 STAGE_AS_${file}= ${${group}NAME_${file}}
-# XXX {group}OWN,GRP,MODE
-STAGE_DIR.${file}= ${STAGE_OBJTOP}${${_${group}DIR_${file}}}
-stage_as.${file}: ${file}
+# we cannot use file safely as a set name
+# since we cannot? apply :T
+# but we can use the ${group}DIR_${file}
+# as a set - meta.stage.mk will :O:u for us
+# we need to expand ${group}DIR_${file} and replace
+# all '/' and '*' with '_' to make a safe target name.
+STAGE_AS_SETS+=${${_${group}DIR_${file}}:C,[/*],_,g}
+STAGE_DIR.${${_${group}DIR_${file}}:C,[/*],_,g}= 
${STAGE_OBJTOP}${${group}DIR_${file}}
+stage_as.${${_${group}DIR_${file}}:C,[/*],_,g}: ${file}
 
 installfiles-${group}: _${group}INS1_${file}
 _${group}INS1_${file}: installdirs-${_${group}DIR_${file}} _${group}INS_${file}
@@ -122,12 +127,16 @@ realinstall: installfiles
 .ORDER: beforeinstall installfiles
 
 .if ${MK_STAGING} != "no"
+.if ${FILESGROUPS:@g@${$g}@} != ""
 .if !empty(STAGE_SETS)
 buildfiles: stage_files
 STAGE_TARGETS+= stage_files
+stage_files:
 .if !empty(STAGE_AS_SETS)
 buildfiles: stage_as
 STAGE_TARGETS+= stage_as
+stage_as:
+.endif
 .endif
 .endif
 .endif
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351953 - head/share/man/man8

2019-09-06 Thread Mateusz Piotrowski
Author: 0mp (ports committer)
Date: Fri Sep  6 18:51:41 2019
New Revision: 351953
URL: https://svnweb.freebsd.org/changeset/base/351953

Log:
  rc.8: Update documentation regarding old-style rc scripts
  
  The EXAMPLES section does not contain any examples of output formats for
  the old-style scripts. Remove the misleading bits stating otherwise.
  
  Reviewed by:  bcr, imp
  Approved by:  src (imp)
  Differential Revision:https://reviews.freebsd.org/D21552

Modified:
  head/share/man/man8/rc.8

Modified: head/share/man/man8/rc.8
==
--- head/share/man/man8/rc.8Fri Sep  6 18:33:39 2019(r351952)
+++ head/share/man/man8/rc.8Fri Sep  6 18:51:41 2019(r351953)
@@ -31,7 +31,7 @@
 .\" @(#)rc.8   8.2 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd August 7, 2019
+.Dd September 6, 2019
 .Dt RC 8
 .Os
 .Sh NAME
@@ -396,9 +396,7 @@ without the numeric prefixes the opposite would be tru
 The output from each script is traditionally a space character,
 followed by the name of the software package being started or shut down,
 .Em without
-a trailing newline character (see the
-.Sx EXAMPLES
-section).
+a trailing newline character.
 .El
 .Sh SCRIPTS OF INTEREST
 When an automatic reboot is in progress,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351952 - head/sys/netinet

2019-09-06 Thread Conrad Meyer
Author: cem
Date: Fri Sep  6 18:33:39 2019
New Revision: 351952
URL: https://svnweb.freebsd.org/changeset/base/351952

Log:
  Fix build after r351934
  
  tcp_queue_pkts() is only used if TCPHPTS is defined (and it is not by
  default).
  
  Reported by:  gcc

Modified:
  head/sys/netinet/tcp_lro.c

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Fri Sep  6 18:29:48 2019(r351951)
+++ head/sys/netinet/tcp_lro.c  Fri Sep  6 18:33:39 2019(r351952)
@@ -845,6 +845,7 @@ again:
}
 }
 
+#ifdef TCPHPTS
 static void
 tcp_queue_pkts(struct tcpcb *tp, struct lro_entry *le)
 {
@@ -860,6 +861,7 @@ tcp_queue_pkts(struct tcpcb *tp, struct lro_entry *le)
le->m_head = NULL;
le->m_last_mbuf = NULL;
 }
+#endif
 
 void
 tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *le)
@@ -959,7 +961,7 @@ tcp_lro_flush(struct lro_ctrl *lc, struct lro_entry *l
}
if (can_queue == 0) {
 skip_lookup:
-#endif
+#endif /* TCPHPTS */
/* Old fashioned lro method */
if (le->m_head != le->m_last_mbuf)  {
counter_u64_add(tcp_inp_lro_compressed, 1);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351951 - head/sys/netinet

2019-09-06 Thread Randall Stewart
Author: rrs
Date: Fri Sep  6 18:29:48 2019
New Revision: 351951
URL: https://svnweb.freebsd.org/changeset/base/351951

Log:
  This adds in the missing counter initialization which
  I had forgotten to bring over.. opps.
  
  Differential Revision: https://reviews.freebsd.org/D21127

Modified:
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_var.h

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Fri Sep  6 18:25:42 2019(r351950)
+++ head/sys/netinet/tcp_subr.c Fri Sep  6 18:29:48 2019(r351951)
@@ -1125,6 +1125,13 @@ tcp_init(void)
SHUTDOWN_PRI_DEFAULT);
EVENTHANDLER_REGISTER(maxsockets_change, tcp_zone_change, NULL,
EVENTHANDLER_PRI_ANY);
+
+   tcp_inp_lro_direct_queue = counter_u64_alloc(M_WAITOK);
+   tcp_inp_lro_wokeup_queue = counter_u64_alloc(M_WAITOK);
+   tcp_inp_lro_compressed = counter_u64_alloc(M_WAITOK);
+   tcp_inp_lro_single_push = counter_u64_alloc(M_WAITOK);
+   tcp_inp_lro_locks_taken = counter_u64_alloc(M_WAITOK);
+   tcp_inp_lro_sack_wake = counter_u64_alloc(M_WAITOK);
 #ifdef TCPPCAP
tcp_pcap_init();
 #endif

Modified: head/sys/netinet/tcp_var.h
==
--- head/sys/netinet/tcp_var.h  Fri Sep  6 18:25:42 2019(r351950)
+++ head/sys/netinet/tcp_var.h  Fri Sep  6 18:29:48 2019(r351951)
@@ -887,6 +887,13 @@ struct tcp_function_block *
 find_and_ref_tcp_fb(struct tcp_function_block *fs);
 int tcp_default_ctloutput(struct socket *so, struct sockopt *sopt, struct 
inpcb *inp, struct tcpcb *tp);
 
+extern counter_u64_t tcp_inp_lro_direct_queue;
+extern counter_u64_t tcp_inp_lro_wokeup_queue;
+extern counter_u64_t tcp_inp_lro_compressed;
+extern counter_u64_t tcp_inp_lro_single_push;
+extern counter_u64_t tcp_inp_lro_locks_taken;
+extern counter_u64_t tcp_inp_lro_sack_wake;
+
 uint32_t tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *);
 uint32_t tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *);
 u_int   tcp_maxseg(const struct tcpcb *);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351950 - head/sys/netinet

2019-09-06 Thread Warner Losh
Author: imp
Date: Fri Sep  6 18:25:42 2019
New Revision: 351950
URL: https://svnweb.freebsd.org/changeset/base/351950

Log:
  Initialize if_hw_tsomaxsegsize to 0 to appease gcc's flow analysis as a
  fail-safe.

Modified:
  head/sys/netinet/tcp_output.c

Modified: head/sys/netinet/tcp_output.c
==
--- head/sys/netinet/tcp_output.c   Fri Sep  6 18:23:00 2019
(r351949)
+++ head/sys/netinet/tcp_output.c   Fri Sep  6 18:25:42 2019
(r351950)
@@ -195,7 +195,7 @@ tcp_output(struct tcpcb *tp)
uint32_t recwin, sendwin;
int off, flags, error = 0;  /* Keep compiler happy */
u_int if_hw_tsomaxsegcount = 0;
-   u_int if_hw_tsomaxsegsize;
+   u_int if_hw_tsomaxsegsize = 0;
struct mbuf *m;
struct ip *ip = NULL;
 #ifdef TCPDEBUG
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351949 - stable/12/share/mk

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 18:23:00 2019
New Revision: 351949
URL: https://svnweb.freebsd.org/changeset/base/351949

Log:
  MFC r350291:
  
  Add c++14 and c++17 to COMPILER_FEATURES
  
  This will be used to gate the fusefs tests. It's a partial merge of r348281
  from projects/fuse2.
  
  Reviewed by:  kib, emaste
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21044

Modified:
  stable/12/share/mk/bsd.compiler.mk
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/mk/bsd.compiler.mk
==
--- stable/12/share/mk/bsd.compiler.mk  Fri Sep  6 18:14:14 2019
(r351948)
+++ stable/12/share/mk/bsd.compiler.mk  Fri Sep  6 18:23:00 2019
(r351949)
@@ -19,6 +19,8 @@
 # COMPILER_FEATURES will contain one or more of the following, based on
 # compiler support for that feature:
 #
+# - c++17: supports full (or nearly full) C++17 programming environment.
+# - c++14: supports full (or nearly full) C++14 programming environment.
 # - c++11: supports full (or nearly full) C++11 programming environment.
 # - retpoline: supports the retpoline speculative execution vulnerability
 #  mitigation.
@@ -181,9 +183,17 @@ ${X_}COMPILER_FREEBSD_VERSION= unknown
 .endif
 
 ${X_}COMPILER_FEATURES=
-.if ${${X_}COMPILER_TYPE} == "clang" || \
+.if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 30300) || 
\
(${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 40800)
 ${X_}COMPILER_FEATURES+=   c++11
+.endif
+.if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 30400) || 
\
+   (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 5)
+${X_}COMPILER_FEATURES+=   c++14
+.endif
+.if (${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 5) || 
\
+   (${${X_}COMPILER_TYPE} == "gcc" && ${${X_}COMPILER_VERSION} >= 7)
+${X_}COMPILER_FEATURES+=   c++17
 .endif
 .if ${${X_}COMPILER_TYPE} == "clang" && ${${X_}COMPILER_VERSION} >= 6
 ${X_}COMPILER_FEATURES+=   retpoline
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351948 - stable/12/share/man/man9

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 18:14:14 2019
New Revision: 351948
URL: https://svnweb.freebsd.org/changeset/base/351948

Log:
  MFC r350268:
  
  VOP_FSYNC.9: update copyright after r345677
  
  MFC-With: r345677
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/share/man/man9/VOP_FSYNC.9
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man9/VOP_FSYNC.9
==
--- stable/12/share/man/man9/VOP_FSYNC.9Fri Sep  6 18:11:39 2019
(r351947)
+++ stable/12/share/man/man9/VOP_FSYNC.9Fri Sep  6 18:14:14 2019
(r351948)
@@ -4,6 +4,11 @@
 .\"
 .\" All rights reserved.
 .\"
+.\" Copyright (c) 2019 The FreeBSD Foundation
+.\"
+.\" Portions of this documentation were written by BFF Storage Systems under
+.\" sponsorship from the FreeBSD Foundation.
+.\"
 .\" This program is free software.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351947 - stable/12/sys/kern

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 18:11:39 2019
New Revision: 351947
URL: https://svnweb.freebsd.org/changeset/base/351947

Log:
  MFC r350227:
  
  [skip ci] Fix the comment for cache_purge(9)
  
  This is a merge of r348738 from projects/fuse2
  
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation

Modified:
  stable/12/sys/kern/vfs_cache.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/vfs_cache.c
==
--- stable/12/sys/kern/vfs_cache.c  Fri Sep  6 18:10:03 2019
(r351946)
+++ stable/12/sys/kern/vfs_cache.c  Fri Sep  6 18:11:39 2019
(r351947)
@@ -1964,7 +1964,7 @@ cache_changesize(int newmaxvnodes)
 }
 
 /*
- * Invalidate all entries to a particular vnode.
+ * Invalidate all entries from and to a particular vnode.
  */
 void
 cache_purge(struct vnode *vp)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351946 - stable/12/share/man/man5

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 18:10:03 2019
New Revision: 351946
URL: https://svnweb.freebsd.org/changeset/base/351946

Log:
  MFC r346186:
  
  fusefs: add a fusefs(5) man page
  
  PR:   233393
  Reported by:  tech-li...@zyxst.net
  Reviewed by:  cem
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19651

Added:
  stable/12/share/man/man5/fusefs.5
 - copied unchanged from r346186, head/share/man/man5/fusefs.5
Modified:
  stable/12/share/man/man5/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man5/Makefile
==
--- stable/12/share/man/man5/Makefile   Fri Sep  6 18:08:13 2019
(r351945)
+++ stable/12/share/man/man5/Makefile   Fri Sep  6 18:10:03 2019
(r351946)
@@ -27,6 +27,7 @@ MAN=  acct.5 \
forward.5 \
fs.5 \
fstab.5 \
+   fusefs.5 \
group.5 \
hosts.5 \
hosts.equiv.5 \

Copied: stable/12/share/man/man5/fusefs.5 (from r346186, 
head/share/man/man5/fusefs.5)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/share/man/man5/fusefs.5   Fri Sep  6 18:10:03 2019
(r351946, copy of r346186, head/share/man/man5/fusefs.5)
@@ -0,0 +1,147 @@
+.\"
+.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+.\"
+.\" Copyright (c) 2019 The FreeBSD Foundation
+.\"
+.\" This software was developed by BFF Storage Systems, LLC under sponsorship
+.\" from the FreeBSD Foundation.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd April 13, 2019
+.Dt FUSEFS 5
+.Os
+.Sh NAME
+.Nm fusefs
+.Nd "File system in USErspace"
+.Sh SYNOPSIS
+To link into the kernel:
+.Bd -ragged -offset indent
+.Cd "options FUSEFS"
+.Ed
+.Pp
+To load as a loadable kernel module:
+.Pp
+.Dl "kldload fusefs"
+.Sh DESCRIPTION
+The
+.Nm
+driver implements a file system that is serviced by a userspace program.
+.Pp
+There are many uses for
+.Nm .
+Userspace daemons can access libraries or programming languages that cannot run
+in kernel-mode, for example.
+.Nm
+is also useful for developing and debugging file systems, because a crash of
+the daemon will not take down the entire operating system.
+Finally, the
+.Nm
+API is portable.
+Many daemons can run on multiple operating systems with minimal modifications.
+.Sh SYSCTL VARIABLES
+The following variables are available as both
+.Xr sysctl 8
+variables and
+.Xr loader 8
+tunables:
+.Bl -tag -width indent
+.It Va vfs.fusefs.kernelabi_major
+Major version of the FUSE kernel ABI supported by this driver.
+.It Va vfs.fusefs.kernelabi_minor
+Minor version of the FUSE kernel ABI supported by this driver.
+.It Va vfs.fusefs.data_cache_mode
+Controls how
+.Nm
+will cache file data.
+A value of 0 will disable caching entirely.
+Every data access will be forwarded to the daemon.
+A value of 1 will select write-through caching.
+Reads will be cached in the VFS layer as usual.
+Writes will be immediately forwarded to the daemon, and also added to the 
cache.
+A value of 2 will select write-back caching.
+Reads and writes will both be cached, and writes will occasionally be flushed
+to the daemon by the page daemon.
+Write-back caching is usually unsafe, especially for FUSE file systems that
+require network access.
+.It Va vfs.fusefs.lookup_cache_enable
+Controls whether
+.Nm
+will cache lookup responses from the file system.
+FUSE file systems indicate whether lookup responses should be cacheable, but
+it may be useful to globally disable caching them if a file system is
+misbehaving.

svn commit: r351945 - stable/12/sys/fs/fuse

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 18:08:13 2019
New Revision: 351945
URL: https://svnweb.freebsd.org/changeset/base/351945

Log:
  MFC r345986:
  
  fusefs: fix a panic on mount
  
  Don't page fault if the file descriptor provided with "-o fd" is invalid.
  This is a merge of r345419 from the projects/fuse2 branch.
  
  Reviewed by:  ngie
  Tested by:Marek Zarychta 
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19836

Modified:
  stable/12/sys/fs/fuse/fuse_vfsops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/fuse/fuse_vfsops.c
==
--- stable/12/sys/fs/fuse/fuse_vfsops.c Fri Sep  6 18:02:58 2019
(r351944)
+++ stable/12/sys/fs/fuse/fuse_vfsops.c Fri Sep  6 18:08:13 2019
(r351945)
@@ -225,7 +225,7 @@ fuse_vfsop_mount(struct mount *mp)
size_t len;
 
struct cdev *fdev;
-   struct fuse_data *data;
+   struct fuse_data *data = NULL;
struct thread *td;
struct file *fp, *fptmp;
char *fspec, *subtype;
@@ -361,7 +361,7 @@ fuse_vfsop_mount(struct mount *mp)
 out:
if (err) {
FUSE_LOCK();
-   if (data->mp == mp) {
+   if (data != NULL && data->mp == mp) {
/*
 * Destroy device only if we acquired reference to
 * it
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351944 - stable/12/sys/fs/fuse

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 18:02:58 2019
New Revision: 351944
URL: https://svnweb.freebsd.org/changeset/base/351944

Log:
  MFC r345675, r345689
  
  r345675:
  fusefs: convert debug printfs into dtrace probes
  
  fuse(4) was heavily instrumented with debug printf statements that could
  only be enabled with compile-time flags. They fell into three basic groups:
  
  1. Totally redundant with dtrace FBT probes. These I deleted.
  2. Print textual information, usually error messages. These I converted to
 SDT probes of the form fuse:fuse:FILE:trace. They work just like the old
 printf statements except they can be enabled at runtime with dtrace. They
 can be filtered by FILE and/or by priority.
  3. More complicated probes that print detailed information. These I
 converted into ad-hoc SDT probes.
  
  Also, de-inline fuse_internal_cache_attrs.  It's big enough to be a regular
  function, and this way it gets a dtrace FBT probe.
  
  This commit is a merge of r345304, r344914, r344703, and r344664 from
  projects/fuse2.
  
  Reviewed by:  cem
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19667
  
  r345689:
  fix the GENERIC-NODEBUG build after r345675
  
  Submitted by: cy
  Reported by:  cy, Michael Butler 
  X-MFC-With:   345675

Deleted:
  stable/12/sys/fs/fuse/fuse_debug.h
Modified:
  stable/12/sys/fs/fuse/fuse.h
  stable/12/sys/fs/fuse/fuse_device.c
  stable/12/sys/fs/fuse/fuse_file.c
  stable/12/sys/fs/fuse/fuse_internal.c
  stable/12/sys/fs/fuse/fuse_internal.h
  stable/12/sys/fs/fuse/fuse_io.c
  stable/12/sys/fs/fuse/fuse_ipc.c
  stable/12/sys/fs/fuse/fuse_ipc.h
  stable/12/sys/fs/fuse/fuse_main.c
  stable/12/sys/fs/fuse/fuse_node.c
  stable/12/sys/fs/fuse/fuse_vfsops.c
  stable/12/sys/fs/fuse/fuse_vnops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/fuse/fuse.h
==
--- stable/12/sys/fs/fuse/fuse.hFri Sep  6 17:56:24 2019
(r351943)
+++ stable/12/sys/fs/fuse/fuse.hFri Sep  6 18:02:58 2019
(r351944)
@@ -159,65 +159,8 @@ do {   \
(cred) = (td)->td_ucred;\
 } while (0)
 
-/* Debug related stuff */
-
-#ifndef FUSE_DEBUG_DEVICE
-#define FUSE_DEBUG_DEVICE   0
-#endif
-
-#ifndef FUSE_DEBUG_FILE
-#define FUSE_DEBUG_FILE 0
-#endif
-
-#ifndef FUSE_DEBUG_INTERNAL
-#define FUSE_DEBUG_INTERNAL 0
-#endif
-
-#ifndef FUSE_DEBUG_IO
-#define FUSE_DEBUG_IO   0
-#endif
-
-#ifndef FUSE_DEBUG_IPC
-#define FUSE_DEBUG_IPC  0
-#endif
-
-#ifndef FUSE_DEBUG_LOCK
-#define FUSE_DEBUG_LOCK 0
-#endif
-
-#ifndef FUSE_DEBUG_VFSOPS
-#define FUSE_DEBUG_VFSOPS   0
-#endif
-
-#ifndef FUSE_DEBUG_VNOPS
-#define FUSE_DEBUG_VNOPS0
-#endif
-
-#ifndef FUSE_TRACE
-#define FUSE_TRACE  0
-#endif
-
-#define DEBUGX(cond, fmt, ...) do {\
-   if (((cond))) { \
-   printf("%s: " fmt, __func__, ## __VA_ARGS__);   \
-   }   \
-} while (0)
-
-#define fuse_lck_mtx_lock(mtx) do {
\
-   DEBUGX(FUSE_DEBUG_LOCK, "0:   lock(%s): %s@%d by %d\n", 
\
-   __STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  
\
-   mtx_lock(&(mtx));   
\
-   DEBUGX(FUSE_DEBUG_LOCK, "1:   lock(%s): %s@%d by %d\n", 
\
-   __STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  
\
-} while (0)
-
-#define fuse_lck_mtx_unlock(mtx) do {  
\
-   DEBUGX(FUSE_DEBUG_LOCK, "0: unlock(%s): %s@%d by %d\n", 
\
-   __STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  
\
-   mtx_unlock(&(mtx)); 
\
-   DEBUGX(FUSE_DEBUG_LOCK, "1: unlock(%s): %s@%d by %d\n", 
\
-   __STRING(mtx), __func__, __LINE__, curthread->td_proc->p_pid);  
\
-} while (0)
+#define fuse_lck_mtx_lock(mtx) mtx_lock(&(mtx))
+#define fuse_lck_mtx_unlock(mtx) mtx_unlock(&(mtx))
 
 void fuse_ipc_init(void);
 void fuse_ipc_destroy(void);

Modified: stable/12/sys/fs/fuse/fuse_device.c
==
--- stable/12/sys/fs/fuse/fuse_device.c Fri Sep  6 17:56:24 2019
(r351943)
+++ stable/12/sys/fs/fuse/fuse_device.c Fri Sep  6 18:02:58 2019
(r351944)
@@ -73,6 +73,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -82,8 +83,13 @@ __FBSDID("$FreeBSD$");
 #include "fuse.h"
 

svn commit: r351943 - stable/12/sys/fs/fuse

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 17:56:24 2019
New Revision: 351943
URL: https://svnweb.freebsd.org/changeset/base/351943

Log:
  MFC r344183-r344187, r344333-r344334, r344407, r344857, r344865 (by cem)
  
  r344183:
  FUSE: Respect userspace FS "do-not-cache" of file attributes
  
  The FUSE protocol demands that kernel implementations cache user filesystem
  file attributes (vattr data) for a maximum period of time in the range of
  [0, ULONG_MAX] seconds.  In practice, typical requests are for 0, 1, or 10
  seconds; or "a long time" to represent indefinite caching.
  
  Historically, FreeBSD FUSE has ignored this client directive entirely.  This
  works fine for local-only filesystems, but causes consistency issues with
  multi-writer network filesystems.
  
  For now, respect 0 second cache TTLs and do not cache such metadata.
  Non-zero metadata caching TTLs in the range [0.1, ULONG_MAX] seconds
  are still cached indefinitely, because it is unclear how a userspace
  filesystem could do anything sensible with those semantics even if
  implemented.
  
  In the future, as an optimization, we should implement notify_inval_entry,
  etc, which provide userspace filesystems a way of evicting the kernel cache.
  
  One potentially bogus access to invalid cached attribute data was left in
  fuse_io_strategy.  It is restricted behind the undocumented and non-default
  "vfs.fuse.fix_broken_io" sysctl or "brokenio" mount option; maybe these are
  deadcode and can be eliminated?
  
  Some minor APIs changed to facilitate this:
  
  1. Attribute cache validity is tracked in FUSE inodes ("fuse_vnode_data").
  
  2. cache_attrs() respects the provided TTL and only caches in the FUSE
  inode if TTL > 0.  It also grows an "out" argument, which, if non-NULL,
  stores the translated fuse_attr (even if not suitable for caching).
  
  3. FUSE VTOVA(vp) returns NULL if the vnode's cache is invalid, to help
  avoid programming mistakes.
  
  4. A VOP_LINK check for potential nlink overflow prior to invoking the FUSE
  link op was weakened (only performed when we have a valid attr cache).  The
  check is racy in a multi-writer network filesystem anyway -- classic TOCTOU.
  We have to trust any userspace filesystem that rejects local caching to
  account for it correctly.
  
  PR:   230258 (inspired by; does not fix)
  
  r344184:
  FUSE: Respect userspace FS "do-not-cache" of path components
  
  The FUSE protocol demands that kernel implementations cache user filesystem
  path components (lookup/cnp data) for a maximum period of time in the range
  of [0, ULONG_MAX] seconds.  In practice, typical requests are for 0, 1, or
  10 seconds; or "a long time" to represent indefinite caching.
  
  Historically, FreeBSD FUSE has ignored this client directive entirely.  This
  works fine for local-only filesystems, but causes consistency issues with
  multi-writer network filesystems.
  
  For now, respect 0 second cache TTLs and do not cache such metadata.
  Non-zero metadata caching TTLs in the range [0.1, ULONG_MAX] seconds
  are still cached indefinitely, because it is unclear how a userspace
  filesystem could do anything sensible with those semantics even if
  implemented.
  
  Pass fuse_entry_out to fuse_vnode_get when available and only cache lookup
  if the user filesystem did not set a zero second TTL.
  
  PR:   230258 (inspired by; does not fix)
  
  r344185:
  FUSE: Only "dirty" cached file size when data is dirty
  
  Most users of fuse_vnode_setsize() set the cached fvdat->filesize and update
  the buf cache bounds as a result of either a read from the underlying FUSE
  filesystem, or as part of a write-through type operation (like truncate =>
  VOP_SETATTR).  In these cases, do not set the FN_SIZECHANGE flag, which
  indicates that an inode's data is dirty (in particular, that the local buf
  cache and fvdat->filesize have dirty extended data).
  
  PR:   230258 (related)
  
  r344186:
  FUSE: The FUSE design expects writethrough caching
  
  At least prior to 7.23 (which adds FUSE_WRITEBACK_CACHE), the FUSE protocol
  specifies only clean data to be cached.
  
  Prior to this change, we implement and default to writeback caching.  This
  is ok enough for local only filesystems without hardlinks, but violates the
  general design contract with FUSE and breaks distributed filesystems or
  concurrent access to hardlinks of the same inode.
  
  In this change, add cache mode as an extension of cache enable/disable.  The
  new modes are UC (was: cache disabled), WT (default), and WB (was: cache
  enabled).
  
  For now, WT caching is implemented as write-around, which meets the goal of
  only caching clean data.  WT can be better than WA for workloads that
  frequently read data that was recently written, but WA is trivial to
  implement.  Note that this has no effect on O_WRONLY-opened files, which
  were already coerced to write-around.
  
  Refs:
* 

svn commit: r351942 - in stable/12: share/man/man4 sys/conf sys/dev/usb sys/dev/usb/net sys/dev/usb/template sys/modules/usb sys/modules/usb/cdceem sys/modules/usb/template

2019-09-06 Thread Edward Tomasz Napierala
Author: trasz
Date: Fri Sep  6 17:54:51 2019
New Revision: 351942
URL: https://svnweb.freebsd.org/changeset/base/351942

Log:
  MFC r350685:
  
  Add cdceem(4) driver, for virtual ethernet devices compliant
  with Communication Device Class Ethernet Emulation Model (CDC EEM).
  The driver supports both the device, and host side operation; there
  is a new USB template (#11) for the former.
  
  This enables communication with virtual USB NIC provided by iLO 5,
  as found in new HPE Proliant servers.
  
  Reviewed by:  hselasky
  Relnotes: yes
  Sponsored by: Hewlett Packard Enterprise

Added:
  stable/12/share/man/man4/cdceem.4
 - copied unchanged from r350685, head/share/man/man4/cdceem.4
  stable/12/sys/dev/usb/net/if_cdceem.c
 - copied, changed from r350685, head/sys/dev/usb/net/if_cdceem.c
  stable/12/sys/dev/usb/template/usb_template_cdceem.c
 - copied unchanged from r350685, 
head/sys/dev/usb/template/usb_template_cdceem.c
  stable/12/sys/modules/usb/cdceem/
 - copied from r350685, head/sys/modules/usb/cdceem/
Modified:
  stable/12/share/man/man4/Makefile
  stable/12/share/man/man4/cdce.4
  stable/12/share/man/man4/ipheth.4
  stable/12/share/man/man4/urndis.4
  stable/12/share/man/man4/usb_template.4
  stable/12/sys/conf/files
  stable/12/sys/dev/usb/template/usb_template.c
  stable/12/sys/dev/usb/template/usb_template.h
  stable/12/sys/dev/usb/usb.h
  stable/12/sys/dev/usb/usb_ioctl.h
  stable/12/sys/modules/usb/Makefile
  stable/12/sys/modules/usb/template/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/Makefile
==
--- stable/12/share/man/man4/Makefile   Fri Sep  6 17:43:00 2019
(r351941)
+++ stable/12/share/man/man4/Makefile   Fri Sep  6 17:54:51 2019
(r351942)
@@ -109,6 +109,7 @@ MAN=aac.4 \
ccr.4 \
cd.4 \
cdce.4 \
+   cdceem.4 \
cfi.4 \
cfumass.4 \
ch.4 \

Modified: stable/12/share/man/man4/cdce.4
==
--- stable/12/share/man/man4/cdce.4 Fri Sep  6 17:43:00 2019
(r351941)
+++ stable/12/share/man/man4/cdce.4 Fri Sep  6 17:54:51 2019
(r351942)
@@ -117,6 +117,7 @@ is running low on mbufs.
 .El
 .Sh SEE ALSO
 .Xr arp 4 ,
+.Xr cdceem 4 ,
 .Xr intro 4 ,
 .Xr ipheth 4 ,
 .Xr netintro 4 ,

Copied: stable/12/share/man/man4/cdceem.4 (from r350685, 
head/share/man/man4/cdceem.4)
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/12/share/man/man4/cdceem.4   Fri Sep  6 17:54:51 2019
(r351942, copy of r350685, head/share/man/man4/cdceem.4)
@@ -0,0 +1,119 @@
+.\" Copyright (c) 2019 Edward Tomasz Napierala 
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"notice, this list of conditions and the following disclaimer in the
+.\"documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.Dd August 7, 2019
+.Dt CDCEEM 4
+.Os
+.Sh NAME
+.Nm cdceem
+.Nd "USB Communication Device Class Ethernet Emulation Model (CDC EEM) driver"
+.Sh SYNOPSIS
+To compile this driver into the kernel,
+place the following lines in your
+kernel configuration file:
+.Bd -ragged -offset indent
+.Cd "device uhci"
+.Cd "device ohci"
+.Cd "device usb"
+.Cd "device miibus"
+.Cd "device uether"
+.Cd "device cdceem"
+.Ed
+.Pp
+Alternatively, to load the driver as a
+module at boot time, place the following line in
+.Xr loader.conf 5 :
+.Bd -literal -offset indent
+if_cdceem_load="YES"
+.Ed
+.Sh DESCRIPTION
+The
+.Nm
+driver provides support for USB devices based on the USB Communication
+Device Class Ethernet Emulation Model (CDC EEM) specification.
+.Pp
+The driver 

svn commit: r351941 - in stable/12: sbin/ping6 usr.sbin/mld6query usr.sbin/traceroute6

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 17:43:00 2019
New Revision: 351941
URL: https://svnweb.freebsd.org/changeset/base/351941

Log:
  MFC r350225:
  
  Remove the USE_RFC2292BIS option and reap dead code
  
  This option was imported as part of the KAME project in r62627 (in 2000).
  It was turned on unconditionally in r121472 (in 2003) and has been on ever
  since. The old alternative code has bitrotted. Reap the dead code.
  
  Reported by:  Ján Sučan 
  Differential Revision:https://reviews.freebsd.org/D20938

Modified:
  stable/12/sbin/ping6/Makefile
  stable/12/sbin/ping6/ping6.c
  stable/12/usr.sbin/mld6query/Makefile
  stable/12/usr.sbin/mld6query/mld6.c
  stable/12/usr.sbin/traceroute6/Makefile
  stable/12/usr.sbin/traceroute6/traceroute6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/ping6/Makefile
==
--- stable/12/sbin/ping6/Makefile   Fri Sep  6 17:21:21 2019
(r351940)
+++ stable/12/sbin/ping6/Makefile   Fri Sep  6 17:43:00 2019
(r351941)
@@ -4,7 +4,7 @@ PACKAGE=runtime
 PROG=  ping6
 MAN=   ping6.8
 
-CFLAGS+=-DIPSEC -DKAME_SCOPEID -DUSE_RFC2292BIS
+CFLAGS+=-DIPSEC -DKAME_SCOPEID
 WARNS?=3
 
 BINOWN=root

Modified: stable/12/sbin/ping6/ping6.c
==
--- stable/12/sbin/ping6/ping6.cFri Sep  6 17:21:21 2019
(r351940)
+++ stable/12/sbin/ping6/ping6.cFri Sep  6 17:43:00 2019
(r351941)
@@ -307,9 +307,7 @@ main(int argc, char *argv[])
 #endif
int usepktinfo = 0;
struct in6_pktinfo *pktinfo = NULL;
-#ifdef USE_RFC2292BIS
struct ip6_rthdr *rthdr = NULL;
-#endif
 #ifdef IPSEC_POLICY_IPSEC
char *policy_in = NULL;
char *policy_out = NULL;
@@ -902,11 +900,8 @@ main(int argc, char *argv[])
 
if (argc > 1) { /* some intermediate addrs are specified */
int hops;
-#ifdef USE_RFC2292BIS
int rthdrlen;
-#endif
 
-#ifdef USE_RFC2292BIS
rthdrlen = inet6_rth_space(IPV6_RTHDR_TYPE_0, argc - 1);
scmsgp->cmsg_len = CMSG_LEN(rthdrlen);
scmsgp->cmsg_level = IPPROTO_IPV6;
@@ -916,11 +911,6 @@ main(int argc, char *argv[])
IPV6_RTHDR_TYPE_0, argc - 1);
if (rthdr == NULL)
errx(1, "can't initialize rthdr");
-#else  /* old advanced API */
-   if ((scmsgp = (struct cmsghdr *)inet6_rthdr_init(scmsgp,
-   IPV6_RTHDR_TYPE_0)) == NULL)
-   errx(1, "can't initialize rthdr");
-#endif /* USE_RFC2292BIS */
 
for (hops = 0; hops < argc - 1; hops++) {
memset(, 0, sizeof(hints));
@@ -933,22 +923,11 @@ main(int argc, char *argv[])
errx(1,
"bad addr family of an intermediate addr");
sin6 = (struct sockaddr_in6 *)(void *)res->ai_addr;
-#ifdef USE_RFC2292BIS
if (inet6_rth_add(rthdr, >sin6_addr))
errx(1, "can't add an intermediate node");
-#else  /* old advanced API */
-   if (inet6_rthdr_add(scmsg, >sin6_addr,
-   IPV6_RTHDR_LOOSE))
-   errx(1, "can't add an intermediate node");
-#endif /* USE_RFC2292BIS */
freeaddrinfo(res);
}
 
-#ifndef USE_RFC2292BIS
-   if (inet6_rthdr_lasthop(scmsgp, IPV6_RTHDR_LOOSE))
-   errx(1, "can't set the last flag");
-#endif
-
scmsgp = CMSG_NXTHDR(, scmsgp);
}
 
@@ -968,7 +947,6 @@ main(int argc, char *argv[])
src.sin6_port = ntohs(DUMMY_PORT);
src.sin6_scope_id = dst.sin6_scope_id;
 
-#ifdef USE_RFC2292BIS
if (pktinfo &&
setsockopt(dummy, IPPROTO_IPV6, IPV6_PKTINFO,
(void *)pktinfo, sizeof(*pktinfo)))
@@ -988,12 +966,6 @@ main(int argc, char *argv[])
setsockopt(dummy, IPPROTO_IPV6, IPV6_RTHDR,
(void *)rthdr, (rthdr->ip6r_len + 1) << 3))
err(1, "UDP setsockopt(IPV6_RTHDR)");
-#else  /* old advanced API */
-   if (smsghdr.msg_control &&
-   setsockopt(dummy, IPPROTO_IPV6, IPV6_PKTOPTIONS,
-   (void *)smsghdr.msg_control, smsghdr.msg_controllen))
-   err(1, "UDP setsockopt(IPV6_PKTOPTIONS)");
-#endif
 
if (connect(dummy, (struct sockaddr *), len) < 0)
err(1, "UDP connect");
@@ -1785,7 +1757,6 @@ pr_exthdrs(struct msghdr *mhdr)
}
 }
 
-#ifdef USE_RFC2292BIS
 static void
 pr_ip6opt(void *extbuf, size_t bufsize)
 {
@@ -1847,17 +1818,7 @@ pr_ip6opt(void *extbuf, size_t bufsize)
}
return;
 }
-#else  /* 

svn commit: r351940 - in stable/12: . lib/libjail sbin/mount_fusefs sys/conf sys/fs/fuse sys/modules sys/modules/em sys/modules/fuse sys/modules/fusefs sys/modules/iavf

2019-09-06 Thread Alan Somers
Author: asomers
Date: Fri Sep  6 17:21:21 2019
New Revision: 351940
URL: https://svnweb.freebsd.org/changeset/base/351940

Log:
  MFC r345350, r346441, r346765
  
  r345350:
  Rename fuse(4) to fusefs(4)
  
  This makes it more consistent with other filesystems, which all end in "fs",
  and more consistent with its mount helper, which is already named
  "mount_fusefs".
  
  Reviewed by:  cem, rgrimes
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19649
  
  r346441:
  Use symlinks for kernel modules rather than hardlinks
  
  When aliasing a kernel module to a different name (ie if_igb for if_em),
  it's better to use symlinks than hard links. kldxref will omit entries for
  the links, ensuring that the loaded module has the correct name.
  
  Reviewed by:  imp
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19979
  
  r346765:
  Don't symlink fusefs.ko to fuse.ko on PPC
  
  Some PPC systems (PowerNV) use msdosfs for /boot, which can't handle either
  symlinks or hardlinks. So on PPC, copy the module instead. This change fixes
  installkernel on such systems after r345350.
  
  Reported by:  Brandon Bergren 
  Reviewed by:  jhibbits, rgrimes
  MFC-With: 345350, 346441
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D19993

Added:
  stable/12/sys/modules/fusefs/
 - copied from r345350, head/sys/modules/fusefs/
Deleted:
  stable/12/sys/modules/fuse/
Modified:
  stable/12/UPDATING
  stable/12/lib/libjail/jail.c
  stable/12/sbin/mount_fusefs/mount_fusefs.c
  stable/12/sys/conf/NOTES
  stable/12/sys/conf/files
  stable/12/sys/conf/options
  stable/12/sys/fs/fuse/fuse.h
  stable/12/sys/fs/fuse/fuse_file.c
  stable/12/sys/fs/fuse/fuse_ipc.c
  stable/12/sys/fs/fuse/fuse_main.c
  stable/12/sys/fs/fuse/fuse_node.c
  stable/12/sys/fs/fuse/fuse_vfsops.c
  stable/12/sys/fs/fuse/fuse_vnops.c
  stable/12/sys/modules/Makefile
  stable/12/sys/modules/em/Makefile
  stable/12/sys/modules/fusefs/Makefile
  stable/12/sys/modules/iavf/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/UPDATING
==
--- stable/12/UPDATING  Fri Sep  6 17:06:48 2019(r351939)
+++ stable/12/UPDATING  Fri Sep  6 17:21:21 2019(r351940)
@@ -16,6 +16,12 @@ from older versions of FreeBSD, try WITHOUT_CLANG and 
 the tip of head, and then rebuild without this option. The bootstrap process
 from older version of current across the gcc/clang cutover is a bit fragile.
 
+20190906:
+   The fuse(4) module has been renamed to fusefs(4) for consistency with
+   other filesystems.  You should update any kld_load="fuse" entries in
+   /etc/rc.conf, fuse_load="YES" entries in /boot/loader.conf, and
+   "options FUSE" enties in kernel config files.
+
 20190811:
Default permissions on the /var/account/acct file (and copies of it 
rotated by periodic daily scripts) are changed from 0644 to 0640 

Modified: stable/12/lib/libjail/jail.c
==
--- stable/12/lib/libjail/jail.cFri Sep  6 17:06:48 2019
(r351939)
+++ stable/12/lib/libjail/jail.cFri Sep  6 17:21:21 2019
(r351940)
@@ -1050,14 +1050,8 @@ kldload_param(const char *name)
kl = kldload(name);
else if (strncmp(name, "allow.mount.", 12) == 0) {
/* Load the matching filesystem */
-   const char *modname;
+   const char *modname = name + 12;
 
-   if (strcmp("fusefs", name + 12) == 0 ||
-   strcmp("nofusefs", name + 12) == 0) {
-   modname = "fuse";
-   } else {
-   modname = name + 12;
-   }
kl = kldload(modname);
if (kl < 0 && errno == ENOENT &&
strncmp(modname, "no", 2) == 0)

Modified: stable/12/sbin/mount_fusefs/mount_fusefs.c
==
--- stable/12/sbin/mount_fusefs/mount_fusefs.c  Fri Sep  6 17:06:48 2019
(r351939)
+++ stable/12/sbin/mount_fusefs/mount_fusefs.c  Fri Sep  6 17:21:21 2019
(r351940)
@@ -501,7 +501,7 @@ init_backgrounded(void)
 
len = sizeof(ibg);
 
-   if (sysctlbyname("vfs.fuse.init_backgrounded", , , NULL, 0))
+   if (sysctlbyname("vfs.fusefs.init_backgrounded", , , NULL, 0))
return (0);
 
return (ibg);

Modified: stable/12/sys/conf/NOTES
==
--- stable/12/sys/conf/NOTESFri Sep  6 17:06:48 2019(r351939)
+++ stable/12/sys/c

svn commit: r351939 - head/share/misc

2019-09-06 Thread Scott Long
Author: scottl
Date: Fri Sep  6 17:06:48 2019
New Revision: 351939
URL: https://svnweb.freebsd.org/changeset/base/351939

Log:
  Add myself as a mentor for Scott Phillip (scottph)

Modified:
  head/share/misc/committers-src.dot

Modified: head/share/misc/committers-src.dot
==
--- head/share/misc/committers-src.dot  Fri Sep  6 16:06:37 2019
(r351938)
+++ head/share/misc/committers-src.dot  Fri Sep  6 17:06:48 2019
(r351939)
@@ -841,6 +841,7 @@ scottl -> jimharris
 scottl -> pjd
 scottl -> sah
 scottl -> sbruno
+scottl -> scottph
 scottl -> slm
 scottl -> yongari
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351938 - head/contrib/llvm/lib/CodeGen

2019-09-06 Thread Dimitry Andric
Author: dim
Date: Fri Sep  6 16:06:37 2019
New Revision: 351938
URL: https://svnweb.freebsd.org/changeset/base/351938

Log:
  Pull in r37 from upstream llvm trunk (by Eli Friedman):
  
[IfConversion] Fix diamond conversion with unanalyzable branches.
  
The code was incorrectly counting the number of identical
instructions, and therefore tried to predicate an instruction which
should not have been predicated.  This could have various effects: a
compiler crash, an assembler failure, a miscompile, or just
generating an extra, unnecessary instruction.
  
Instead of depending on TargetInstrInfo::removeBranch, which only
works on analyzable branches, just remove all branch instructions.
  
Fixes https://bugs.llvm.org/show_bug.cgi?id=43121 and
https://bugs.llvm.org/show_bug.cgi?id=41121 .
  
Differential Revision: https://reviews.llvm.org/D67203
  
  This should fix "Unable to predicate BX killed renamable $r0" errors
  when building the lang/spidermonkey170 and lang/spidermonkey38 ports for
  armv7 and armv6.
  
  PR:   236567
  MFC after:3 days

Modified:
  head/contrib/llvm/lib/CodeGen/IfConversion.cpp

Modified: head/contrib/llvm/lib/CodeGen/IfConversion.cpp
==
--- head/contrib/llvm/lib/CodeGen/IfConversion.cpp  Fri Sep  6 15:43:53 
2019(r351937)
+++ head/contrib/llvm/lib/CodeGen/IfConversion.cpp  Fri Sep  6 16:06:37 
2019(r351938)
@@ -1759,9 +1759,15 @@ bool IfConverter::IfConvertDiamondCommon(
   if (!BBI1->IsBrAnalyzable)
 verifySameBranchInstructions(, );
 #endif
-  BBI1->NonPredSize -= TII->removeBranch(*BBI1->BB);
-  // Remove duplicated instructions.
+  // Remove duplicated instructions from the tail of MBB1: any branch
+  // instructions, and the common instructions counted by NumDups2.
   DI1 = MBB1.end();
+  while (DI1 != MBB1.begin()) {
+MachineBasicBlock::iterator Prev = std::prev(DI1);
+if (!Prev->isBranch() && !Prev->isDebugInstr())
+  break;
+DI1 = Prev;
+  }
   for (unsigned i = 0; i != NumDups2; ) {
 // NumDups2 only counted non-dbg_value instructions, so this won't
 // run off the head of the list.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351937 - in head/sys: compat/linuxkpi/common/include/linux sys

2019-09-06 Thread Johannes Lundberg
Author: johalun
Date: Fri Sep  6 15:43:53 2019
New Revision: 351937
URL: https://svnweb.freebsd.org/changeset/base/351937

Log:
  LinuxKPI: Improve sysfs support.
  
  - Add functions for creating and merging sysfs groups.
  - Add sysfs_streq function to compare strings ignoring newline from the
sysctl userland call.
  - Add a call to sysfs_create_groups in device_add.
  - Remove duplicate header include.
  - Bump __FreeBSD_version.
  
  Reviewed by:  hselasky
  Approved by:  imp (mentor), hselasky
  MFC after:4 days
  Differential Revision:D21542

Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h
  head/sys/compat/linuxkpi/common/include/linux/sysfs.h
  head/sys/sys/param.h

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==
--- head/sys/compat/linuxkpi/common/include/linux/device.h  Fri Sep  6 
15:01:47 2019(r351936)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h  Fri Sep  6 
15:43:53 2019(r351937)
@@ -40,7 +40,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -316,6 +315,10 @@ device_add(struct device *dev)
dev->devt = makedev(0, device_get_unit(dev->bsddev));
}
kobject_add(>kobj, >class->kobj, dev_name(dev));
+
+   if (dev->groups)
+   return (sysfs_create_groups(>kobj, dev->groups));
+
return (0);
 }
 

Modified: head/sys/compat/linuxkpi/common/include/linux/sysfs.h
==
--- head/sys/compat/linuxkpi/common/include/linux/sysfs.h   Fri Sep  6 
15:01:47 2019(r351936)
+++ head/sys/compat/linuxkpi/common/include/linux/sysfs.h   Fri Sep  6 
15:43:53 2019(r351937)
@@ -175,6 +175,27 @@ sysfs_remove_files(struct kobject *kobj, const struct 
sysfs_remove_file(kobj, attrs[i]);
 }
 
+static inline int
+sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp)
+{
+   struct attribute **attr;
+   struct sysctl_oid *oidp;
+
+   /* Don't create the group node if grp->name is undefined. */
+   if (grp->name)
+   oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(kobj->oidp),
+   OID_AUTO, grp->name, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, 
grp->name);
+   else
+   oidp = kobj->oidp;
+   for (attr = grp->attrs; *attr != NULL; attr++) {
+   SYSCTL_ADD_OID(NULL, SYSCTL_CHILDREN(oidp), OID_AUTO,
+   (*attr)->name, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE,
+   kobj, (uintptr_t)*attr, sysctl_handle_attr, "A", "");
+   }
+
+   return (0);
+}
+
 static inline void
 sysfs_remove_group(struct kobject *kobj, const struct attribute_group *grp)
 {
@@ -184,20 +205,40 @@ sysfs_remove_group(struct kobject *kobj, const struct 
 }
 
 static inline int
-sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp)
+sysfs_create_groups(struct kobject *kobj, const struct attribute_group **grps)
 {
+   int error = 0;
+   int i;
+
+   for (i = 0; grps[i] && !error; i++)
+   error = sysfs_create_group(kobj, grps[i]);
+   while (error && --i >= 0)
+   sysfs_remove_group(kobj, grps[i]);
+
+   return (error);
+}
+
+static inline int
+sysfs_merge_group(struct kobject *kobj, const struct attribute_group *grp)
+{
+
+   /* Really expected behavior is to return failure if group exists. */
+   return (sysfs_create_group(kobj, grp));
+}
+
+static inline void
+sysfs_unmerge_group(struct kobject *kobj, const struct attribute_group *grp)
+{
struct attribute **attr;
struct sysctl_oid *oidp;
 
-   oidp = SYSCTL_ADD_NODE(NULL, SYSCTL_CHILDREN(kobj->oidp),
-   OID_AUTO, grp->name, CTLFLAG_RD|CTLFLAG_MPSAFE, NULL, grp->name);
-   for (attr = grp->attrs; *attr != NULL; attr++) {
-   SYSCTL_ADD_OID(NULL, SYSCTL_CHILDREN(oidp), OID_AUTO,
-   (*attr)->name, CTLTYPE_STRING|CTLFLAG_RW|CTLFLAG_MPSAFE,
-   kobj, (uintptr_t)*attr, sysctl_handle_attr, "A", "");
+   SLIST_FOREACH(oidp, SYSCTL_CHILDREN(kobj->oidp), oid_link) {
+   if (strcmp(oidp->oid_name, grp->name) != 0)
+   continue;
+   for (attr = grp->attrs; *attr != NULL; attr++) {
+   sysctl_remove_name(oidp, (*attr)->name, 1, 1);
+   }
}
-
-   return (0);
 }
 
 static inline int
@@ -222,6 +263,22 @@ sysfs_remove_dir(struct kobject *kobj)
if (kobj->oidp == NULL)
return;
sysctl_remove_oid(kobj->oidp, 1, 1);
+}
+
+static inline bool
+sysfs_streq(const char *s1, const char *s2)
+{
+   int l1, l2;
+
+   l1 = strlen(s1);
+   l2 = strlen(s2);
+
+   if (l1 != 0 && s1[l1-1] == '\n')
+   l1--;
+   if (l2 != 0 && s2[l2-1] == '\n')
+   

svn commit: r351936 - head/sbin/ggate/shared

2019-09-06 Thread Warner Losh
Author: imp
Date: Fri Sep  6 15:01:47 2019
New Revision: 351936
URL: https://svnweb.freebsd.org/changeset/base/351936

Log:
  Fix typo not -> nor and add 'the' because we are talking about specific flags
  and make the punctuation parallel between the three cases.
  
  Submitted by: Yoshihiro Ota-san
  Differential Revision: https://reviews.freebsd.org/D21530

Modified:
  head/sbin/ggate/shared/ggate.h

Modified: head/sbin/ggate/shared/ggate.h
==
--- head/sbin/ggate/shared/ggate.h  Fri Sep  6 14:30:23 2019
(r351935)
+++ head/sbin/ggate/shared/ggate.h  Fri Sep  6 15:01:47 2019
(r351936)
@@ -47,8 +47,8 @@
 #defineGGATE_FLAG_RDONLY   0x0001
 #defineGGATE_FLAG_WRONLY   0x0002
 /*
- * If GGATE_FLAG_SEND not GGATE_FLAG_RECV flag is set, this is initial
- * connection.
+ * If neither the GGATE_FLAG_SEND nor the GGATE_FLAG_RECV flag is
+ * set - this is initial connection.
  * If GGATE_FLAG_SEND flag is set - this is socket to send data.
  * If GGATE_FLAG_RECV flag is set - this is socket to receive data.
  */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351935 - head/sys/netipsec

2019-09-06 Thread Fabien Thomas
Author: fabient
Date: Fri Sep  6 14:30:23 2019
New Revision: 351935
URL: https://svnweb.freebsd.org/changeset/base/351935

Log:
  Fix broken window replay check that will allow old packet to be accepted.
  This was introduced in r309144.
  
  Submitted by: Jean-Francois HREN 
  Approved by:  ae@
  MFC after:3 days

Modified:
  head/sys/netipsec/ipsec.c

Modified: head/sys/netipsec/ipsec.c
==
--- head/sys/netipsec/ipsec.c   Fri Sep  6 14:25:41 2019(r351934)
+++ head/sys/netipsec/ipsec.c   Fri Sep  6 14:30:23 2019(r351935)
@@ -1323,6 +1323,8 @@ ok:
__func__, replay->overflow,
ipsec_sa2str(sav, buf, sizeof(buf;
}
+
+   replay->count++;
return (0);
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351934 - in head/sys: netinet netinet/tcp_stacks sys

2019-09-06 Thread Randall Stewart
Author: rrs
Date: Fri Sep  6 14:25:41 2019
New Revision: 351934
URL: https://svnweb.freebsd.org/changeset/base/351934

Log:
  This adds the final tweaks to LRO that will now allow me
  to add BBR. These changes make it so you can get an
  array of timestamps instead of a compressed ack/data segment.
  BBR uses this to aid with its delivery estimates. We also
  now (via Drew's suggestions) will not go to the expense of
  the tcb lookup if no stack registers to want this feature. If
  HPTS is not present the feature is not present either and you
  just get the compressed behavior.
  
  Sponsored by: Netflix Inc
  Differential Revision: https://reviews.freebsd.org/D21127

Modified:
  head/sys/netinet/tcp_lro.c
  head/sys/netinet/tcp_lro.h
  head/sys/netinet/tcp_stacks/rack_bbr_common.c
  head/sys/sys/mbuf.h

Modified: head/sys/netinet/tcp_lro.c
==
--- head/sys/netinet/tcp_lro.c  Fri Sep  6 12:29:51 2019(r351933)
+++ head/sys/netinet/tcp_lro.c  Fri Sep  6 14:25:41 2019(r351934)
@@ -44,6 +44,8 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 
 #include 
@@ -56,11 +58,14 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
-
+#include 
+#include 
 #include 
 
 #include 
@@ -79,11 +84,47 @@ static int  tcp_lro_rx2(struct lro_ctrl *lc, struct mbu
 SYSCTL_NODE(_net_inet_tcp, OID_AUTO, lro,  CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
 "TCP LRO");
 
+static long tcplro_stacks_wanting_mbufq = 0;
+counter_u64_t tcp_inp_lro_direct_queue;
+counter_u64_t tcp_inp_lro_wokeup_queue;
+counter_u64_t tcp_inp_lro_compressed;
+counter_u64_t tcp_inp_lro_single_push;
+counter_u64_t tcp_inp_lro_locks_taken;
+counter_u64_t tcp_inp_lro_sack_wake;
+
 static unsignedtcp_lro_entries = TCP_LRO_ENTRIES;
+static int32_t hold_lock_over_compress = 0;
+SYSCTL_INT(_net_inet_tcp_lro, OID_AUTO, hold_lock, CTLFLAG_RW,
+_lock_over_compress, 0,
+"Do we hold the lock over the compress of mbufs?");
 SYSCTL_UINT(_net_inet_tcp_lro, OID_AUTO, entries,
 CTLFLAG_RDTUN | CTLFLAG_MPSAFE, _lro_entries, 0,
 "default number of LRO entries");
+SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, fullqueue, CTLFLAG_RD,
+_inp_lro_direct_queue, "Number of lro's fully queued to transport");
+SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, wokeup, CTLFLAG_RD,
+_inp_lro_wokeup_queue, "Number of lro's where we woke up transport via 
hpts");
+SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, compressed, CTLFLAG_RD,
+_inp_lro_compressed, "Number of lro's compressed and sent to 
transport");
+SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, single, CTLFLAG_RD,
+_inp_lro_single_push, "Number of lro's sent with single segment");
+SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, lockcnt, CTLFLAG_RD,
+_inp_lro_locks_taken, "Number of lro's inp_wlocks taken");
+SYSCTL_COUNTER_U64(_net_inet_tcp_lro, OID_AUTO, sackwakeups, CTLFLAG_RD,
+_inp_lro_sack_wake, "Number of wakeups caused by sack/fin");
 
+void
+tcp_lro_reg_mbufq(void)
+{
+   atomic_fetchadd_long(_stacks_wanting_mbufq, 1);
+}
+
+void
+tcp_lro_dereg_mbufq(void)
+{
+   atomic_fetchadd_long(_stacks_wanting_mbufq, -1);
+}
+
 static __inline void
 tcp_lro_active_insert(struct lro_ctrl *lc, struct lro_head *bucket,
 struct lro_entry *le)
@@ -162,6 +203,36 @@ tcp_lro_init_args(struct lro_ctrl *lc, struct ifnet *i
return (0);
 }
 
+static struct tcphdr *
+tcp_lro_get_th(struct lro_entry *le, struct mbuf *m)
+{
+   struct ether_header *eh;
+   struct tcphdr *th = NULL;
+#ifdef INET6
+   struct ip6_hdr *ip6 = NULL; /* Keep compiler happy. */
+#endif
+#ifdef INET
+   struct ip *ip4 = NULL;  /* Keep compiler happy. */
+#endif
+
+   eh = mtod(m, struct ether_header *);
+   switch (le->eh_type) {
+#ifdef INET6
+   case ETHERTYPE_IPV6:
+   ip6 = (struct ip6_hdr *)(eh + 1);
+   th = (struct tcphdr *)(ip6 + 1);
+   break;
+#endif
+#ifdef INET
+   case ETHERTYPE_IP:
+   ip4 = (struct ip *)(eh + 1);
+   th = (struct tcphdr *)(ip4 + 1);
+   break;
+#endif
+   }
+   return (th);
+}
+
 void
 tcp_lro_free(struct lro_ctrl *lc)
 {
@@ -192,7 +263,6 @@ tcp_lro_free(struct lro_ctrl *lc)
lc->lro_mbuf_data = NULL;
 }
 
-#ifdef TCP_LRO_UPDATE_CSUM
 static uint16_t
 tcp_lro_csum_th(struct tcphdr *th)
 {
@@ -275,7 +345,6 @@ tcp_lro_rx_csum_fixup(struct lro_entry *le, void *l3hd
 
return (c & 0x);
 }
-#endif
 
 static void
 tcp_lro_rx_done(struct lro_ctrl *lc)
@@ -297,7 +366,7 @@ tcp_lro_flush_inactive(struct lro_ctrl *lc, const stru
if (LIST_EMPTY(>lro_active))
return;
 
-   getmicrotime();
+   getmicrouptime();
timevalsub(, timeout);
LIST_FOREACH_SAFE(le, >lro_active, next, le_tmp) {
if 

Re: svn commit: r351918 - head/sys/kern

2019-09-06 Thread Ian Lepore
On Fri, 2019-09-06 at 12:15 +0800, Philip Paeps wrote:
> On 2019-09-06 11:15:12 (+0800), Ian Lepore wrote:
> > On Fri, 2019-09-06 at 01:19 +, Philip Paeps wrote:
> > > Author: philip
> > > Date: Fri Sep  6 01:19:31 2019
> > > New Revision: 351918
> > > URL: https://svnweb.freebsd.org/changeset/base/351918
> > > 
> > > Log:
> > >   riscv: default to HZ=100
> > > 
> > >   Most current RISC-V development platforms are not fast enough
> > > to
> > > benefit
> > >   from the increased granularity provided by HZ=1000.
> > > 
> > >   Sponsored by:   Axiado
> > > 
> > > Modified:
> > >   head/sys/kern/subr_param.c
> > > 
> > > Modified: head/sys/kern/subr_param.c
> > > =
> > > 
> > > =
> > > --- head/sys/kern/subr_param.cFri Sep  6 00:06:55 2019(
> > > r351
> > > 917)
> > > +++ head/sys/kern/subr_param.cFri Sep  6 01:19:31 2019(
> > > r351
> > > 918)
> > > @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
> > >   */
> > > 
> > >  #ifndef HZ
> > > -#  if defined(__mips__) || defined(__arm__)
> > > +#  if defined(__mips__) || defined(__arm__) || defined(__riscv)
> > >  #define  HZ 100
> > >  #  else
> > >  #define  HZ 1000
> > > 
> > 
> > This seems like a bad idea.  I've run a 90mhz armv4 chip with
> > HZ=1000 
> > and didn't notice any performance hit from doing so.  Almost all
> > arm 
> > kernel config files set HZ as an option, so that define doesn't do 
> > much for arm these days.  It probably does still set HZ for
> > various 
> > mips platforms.
> > 
> > I would think 1000 is appropriate for anything modern running at 
> > 200mhz or more.
> > 
> > Setting it to 100 has the bad side effect of making things like 
> > msleep(), tsleep(), and pause() (which show up in plenty of
> > drivers) 
> > all have a minimum timeout of 10ms, which is a long long time on 
> > modern hardware.
> > 
> > What benefit do you think you'll get from the lower number?
> 
> On systems running at 10s of MHz (or slower, ick), with HZ=1000 you 
> spend an awful lot of time servicing the timer interrupt and not
> very 
> much time doing anything else.
> 
> My rationale was that most RISC-V systems (including emulation and
> FPGA 
> prototypes) I've encountered are running slower than the tipping
> point 
> where HZ=1000 makes sense.  With the default of HZ=100, faster 
> exceptions can still set HZ=1000 in their individual configs.
> 
> When the RISC-V world evolves to having more actual silicon and
> fewer 
> slow prototypes, I definitely agree this default should be flipped
> again 
> for HZ=1000 by default and HZ=100 in the config files for the 
> exceptions.
> 
> Philip
> 

Wait a second... are you saying that the riscv implementation doesn't
support event timers and uses an old-style periodic tick based on HZ? 
I thought only ancient mips and armv5 systems still did that.  Event
timer based (so-called "tickless") systems only take timer interrupts
when actually necessary -- either because something needs to wake up at
that time, or just often enough to prevent timer rollovers, which is
typically a number like 2 or 4 hz.

-- Ian

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


Re: svn commit: r351918 - head/sys/kern

2019-09-06 Thread Ruslan Bukin
On Fri, Sep 06, 2019 at 12:15:07PM +0800, Philip Paeps wrote:
> On 2019-09-06 11:15:12 (+0800), Ian Lepore wrote:
> > On Fri, 2019-09-06 at 01:19 +, Philip Paeps wrote:
> >> Author: philip
> >> Date: Fri Sep  6 01:19:31 2019
> >> New Revision: 351918
> >> URL: https://svnweb.freebsd.org/changeset/base/351918
> >>
> >> Log:
> >>   riscv: default to HZ=100
> >>
> >>   Most current RISC-V development platforms are not fast enough to
> >> benefit
> >>   from the increased granularity provided by HZ=1000.
> >>
> >>   Sponsored by:Axiado
> >>
> >> Modified:
> >>   head/sys/kern/subr_param.c
> >>
> >> Modified: head/sys/kern/subr_param.c
> >> =
> >> =
> >> --- head/sys/kern/subr_param.c Fri Sep  6 00:06:55 2019(r351
> >> 917)
> >> +++ head/sys/kern/subr_param.c Fri Sep  6 01:19:31 2019(r351
> >> 918)
> >> @@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
> >>   */
> >>
> >>  #ifndef HZ
> >> -#  if defined(__mips__) || defined(__arm__)
> >> +#  if defined(__mips__) || defined(__arm__) || defined(__riscv)
> >>  #define   HZ 100
> >>  #  else
> >>  #define   HZ 1000
> >>
> >
> > This seems like a bad idea.  I've run a 90mhz armv4 chip with HZ=1000 
> > and didn't notice any performance hit from doing so.  Almost all arm 
> > kernel config files set HZ as an option, so that define doesn't do 
> > much for arm these days.  It probably does still set HZ for various 
> > mips platforms.
> >
> > I would think 1000 is appropriate for anything modern running at 
> > 200mhz or more.
> >
> > Setting it to 100 has the bad side effect of making things like 
> > msleep(), tsleep(), and pause() (which show up in plenty of drivers) 
> > all have a minimum timeout of 10ms, which is a long long time on 
> > modern hardware.
> >
> > What benefit do you think you'll get from the lower number?
> 
> On systems running at 10s of MHz (or slower, ick), with HZ=1000 you 
> spend an awful lot of time servicing the timer interrupt and not very 
> much time doing anything else.
> 
> My rationale was that most RISC-V systems (including emulation and FPGA 
> prototypes) I've encountered are running slower than the tipping point 
> where HZ=1000 makes sense.  With the default of HZ=100, faster 
> exceptions can still set HZ=1000 in their individual configs.
> 
> When the RISC-V world evolves to having more actual silicon and fewer 
> slow prototypes, I definitely agree this default should be flipped again 
> for HZ=1000 by default and HZ=100 in the config files for the 
> exceptions.
> 

Hi Philip

I only worry about HiFive Unleashed board, which is the only real hardware 
available at the moment for community and it does not require this change (it 
is 1.5 GHz clock).

With an amount of real silicons growing we may want to keep HZ set to 1000 in 
GENERIC soon-ish so users download/build the GENERIC image and have immediate 
fun.

For FPGA I usually tune (increase) timer clock frequency locally in the DTS 
file based on the timing of a synthesized core.

Ruslan

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


svn commit: r351933 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-09-06 Thread Andriy Gapon
Author: avg
Date: Fri Sep  6 12:29:51 2019
New Revision: 351933
URL: https://svnweb.freebsd.org/changeset/base/351933

Log:
  MFC r351593: zfs_ioc_snapshot: check user-prop permissions on snapshotted 
datasets

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

Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Fri Sep  6 12:27:47 2019(r351932)
+++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Fri Sep  6 12:29:51 2019(r351933)
@@ -2748,10 +2748,9 @@ retry:
  * Check that all the properties are valid user properties.
  */
 static int
-zfs_check_userprops(const char *fsname, nvlist_t *nvl)
+zfs_check_userprops(nvlist_t *nvl)
 {
nvpair_t *pair = NULL;
-   int error = 0;
 
while ((pair = nvlist_next_nvpair(nvl, pair)) != NULL) {
const char *propname = nvpair_name(pair);
@@ -2760,10 +2759,6 @@ zfs_check_userprops(const char *fsname, nvlist_t *nvl)
nvpair_type(pair) != DATA_TYPE_STRING)
return (SET_ERROR(EINVAL));
 
-   if (error = zfs_secpolicy_write_perms(fsname,
-   ZFS_DELEG_PERM_USERPROP, CRED()))
-   return (error);
-
if (strlen(propname) >= ZAP_MAXNAMELEN)
return (SET_ERROR(ENAMETOOLONG));
 
@@ -3430,12 +3425,11 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl
nvpair_t *pair;
 
(void) nvlist_lookup_nvlist(innvl, "props", );
-   if ((error = zfs_check_userprops(poolname, props)) != 0)
-   return (error);
-
if (!nvlist_empty(props) &&
zfs_earlier_version(poolname, SPA_VERSION_SNAP_PROPS))
return (SET_ERROR(ENOTSUP));
+   if ((error = zfs_check_userprops(props)) != 0)
+   return (error);
 
if (nvlist_lookup_nvlist(innvl, "snaps", ) != 0)
return (SET_ERROR(EINVAL));
@@ -3443,7 +3437,7 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
const char *name = nvpair_name(pair);
-   const char *cp = strchr(name, '@');
+   char *cp = strchr(name, '@');
 
/*
 * The snap name must contain an @, and the part after it must
@@ -3459,6 +3453,18 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl
if (strncmp(name, poolname, poollen) != 0 ||
(name[poollen] != '/' && name[poollen] != '@'))
return (SET_ERROR(EXDEV));
+
+   /*
+* Check for permission to set the properties on the fs.
+*/
+   if (!nvlist_empty(props)) {
+   *cp = '\0';
+   error = zfs_secpolicy_write_perms(name,
+   ZFS_DELEG_PERM_USERPROP, CRED());
+   *cp = '@';
+   if (error != 0)
+   return (error);
+   }
 
/* This must be the only snap of this fs. */
for (nvpair_t *pair2 = nvlist_next_nvpair(snaps, pair);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351932 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

2019-09-06 Thread Andriy Gapon
Author: avg
Date: Fri Sep  6 12:27:47 2019
New Revision: 351932
URL: https://svnweb.freebsd.org/changeset/base/351932

Log:
  MFC r351593: zfs_ioc_snapshot: check user-prop permissions on snapshotted 
datasets

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

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Fri Sep  6 12:26:45 2019(r351931)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
Fri Sep  6 12:27:47 2019(r351932)
@@ -2747,10 +2747,9 @@ retry:
  * Check that all the properties are valid user properties.
  */
 static int
-zfs_check_userprops(const char *fsname, nvlist_t *nvl)
+zfs_check_userprops(nvlist_t *nvl)
 {
nvpair_t *pair = NULL;
-   int error = 0;
 
while ((pair = nvlist_next_nvpair(nvl, pair)) != NULL) {
const char *propname = nvpair_name(pair);
@@ -2759,10 +2758,6 @@ zfs_check_userprops(const char *fsname, nvlist_t *nvl)
nvpair_type(pair) != DATA_TYPE_STRING)
return (SET_ERROR(EINVAL));
 
-   if (error = zfs_secpolicy_write_perms(fsname,
-   ZFS_DELEG_PERM_USERPROP, CRED()))
-   return (error);
-
if (strlen(propname) >= ZAP_MAXNAMELEN)
return (SET_ERROR(ENAMETOOLONG));
 
@@ -3429,12 +3424,11 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl
nvpair_t *pair;
 
(void) nvlist_lookup_nvlist(innvl, "props", );
-   if ((error = zfs_check_userprops(poolname, props)) != 0)
-   return (error);
-
if (!nvlist_empty(props) &&
zfs_earlier_version(poolname, SPA_VERSION_SNAP_PROPS))
return (SET_ERROR(ENOTSUP));
+   if ((error = zfs_check_userprops(props)) != 0)
+   return (error);
 
if (nvlist_lookup_nvlist(innvl, "snaps", ) != 0)
return (SET_ERROR(EINVAL));
@@ -3442,7 +3436,7 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl
for (pair = nvlist_next_nvpair(snaps, NULL); pair != NULL;
pair = nvlist_next_nvpair(snaps, pair)) {
const char *name = nvpair_name(pair);
-   const char *cp = strchr(name, '@');
+   char *cp = strchr(name, '@');
 
/*
 * The snap name must contain an @, and the part after it must
@@ -3458,6 +3452,18 @@ zfs_ioc_snapshot(const char *poolname, nvlist_t *innvl
if (strncmp(name, poolname, poollen) != 0 ||
(name[poollen] != '/' && name[poollen] != '@'))
return (SET_ERROR(EXDEV));
+
+   /*
+* Check for permission to set the properties on the fs.
+*/
+   if (!nvlist_empty(props)) {
+   *cp = '\0';
+   error = zfs_secpolicy_write_perms(name,
+   ZFS_DELEG_PERM_USERPROP, CRED());
+   *cp = '@';
+   if (error != 0)
+   return (error);
+   }
 
/* This must be the only snap of this fs. */
for (nvpair_t *pair2 = nvlist_next_nvpair(snaps, pair);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351931 - head/share/mk

2019-09-06 Thread Emmanuel Vadot
Author: manu
Date: Fri Sep  6 12:26:45 2019
New Revision: 351931
URL: https://svnweb.freebsd.org/changeset/base/351931

Log:
  pkgbase: r351861 didn't solve everything, we need to default to the utilities 
package too

Modified:
  head/share/mk/bsd.files.mk

Modified: head/share/mk/bsd.files.mk
==
--- head/share/mk/bsd.files.mk  Fri Sep  6 10:12:05 2019(r351930)
+++ head/share/mk/bsd.files.mk  Fri Sep  6 12:26:45 2019(r351931)
@@ -39,7 +39,7 @@ ${group}DIR?= BINDIR
 STAGE_SETS+=   ${group:C,[/*],_,g}
 
 .if ${group} == "FILES"
-FILESPACKAGE=  ${PACKAGE}
+FILESPACKAGE=  ${PACKAGE:Uutilities}
 .endif
 
 .if defined(NO_ROOT)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351930 - in head: share/man/man4 sys/dev/acpi_support

2019-09-06 Thread Takanori Watanabe
Author: takawata
Date: Fri Sep  6 10:12:05 2019
New Revision: 351930
URL: https://svnweb.freebsd.org/changeset/base/351930

Log:
  Add embedded Managed Object Format blob access to acpi_wmi(4).
  This blob is can be converted to human readable form by bmfdec.
  (http://github.com/pali/bmfdec)
  
  Differential Revision:https://reviews.freebsd.org/D21529

Modified:
  head/share/man/man4/acpi_wmi.4
  head/sys/dev/acpi_support/acpi_wmi.c

Modified: head/share/man/man4/acpi_wmi.4
==
--- head/share/man/man4/acpi_wmi.4  Fri Sep  6 08:08:33 2019
(r351929)
+++ head/share/man/man4/acpi_wmi.4  Fri Sep  6 10:12:05 2019
(r351930)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 22, 2011
+.Dd Sep 5, 2019
 .Dt ACPI_WMI 4
 .Os
 .Sh NAME
@@ -56,6 +56,15 @@ information about GUIDs found in the system.
 .It Pa /dev/wmistat%d
 WMI status device.
 .El
+.Sh SYSCTLS
+The following sysctl node is currently implemented:
+.Bl -tag 
+.It Va dev.acpi_wmi.%d.bmof
+Managed Object Format (MOF) blob.
+You can obtain human readable output by bmf2mof in bmfdec tool.
+(https://github.com/pali/bmfdec)
+.El
+
 .Sh EXAMPLES
 .Bd -literal
 # cat /dev/wmistat0
@@ -72,6 +81,20 @@ GUID  INST EXPE METH S
 {8232DE3D-663D-4327-A8F4-E293ADB9BF05}   0 NO   NO   NO  NOBG
 {8F1F6436-9F42-42C8-BADC-0E9424F20C9A}   0 NO   NO   NO  NOBH
 {8F1F6435-9F42-42C8-BADC-0E9424F20C9A}   0 NO   NO   NO  NOBI
+# sysctl -b dev.acpi_wmi.0.bmof |bmf2mof
+[abstract]
+class Lenovo_BIOSElement {
+};
+
+[WMI, Dynamic, Provider("WMIProv"), WmiExpense(1), Description("Bios Setting"),
+GUID("{51F5230E-9677-46cd-A1CF-C0B23EE34DB7}"), Locale("MS\\0x409")]
+class Lenovo_BiosSetting : Lenovo_BiosElement {
+  [key, read] String InstanceName;
+[read] Boolean Active;
+  [WmiDataId(1), Description("BIOS setting")] String CurrentSetting;
+  };
+   ...
+
 .Ed
 .Sh SEE ALSO
 .Xr acpi 4
@@ -91,6 +114,9 @@ Work has been inspired by the Linux acpi-wmi driver wr
 .Pp
 See http://www.microsoft.com/whdc/system/pnppwr/wmi/wmi-acpi.mspx for
 the specification of ACPI-WMI.
+.Pp
+MOF part has been inspired by the Linux wmi-bmof driver
+written by Andy Lutomirski.
 .Pp
 This manual page was written by
 .An Michael Gmelin Aq Mt free...@grem.de .

Modified: head/sys/dev/acpi_support/acpi_wmi.c
==
--- head/sys/dev/acpi_support/acpi_wmi.cFri Sep  6 08:08:33 2019
(r351929)
+++ head/sys/dev/acpi_support/acpi_wmi.cFri Sep  6 10:12:05 2019
(r351930)
@@ -62,6 +62,7 @@ ACPI_MODULE_NAME("ACPI_WMI");
 #define ACPI_WMI_REGFLAG_METHOD0x2 /* GUID flag: Method 
call */
 #define ACPI_WMI_REGFLAG_STRING0x4 /* GUID flag: String */
 #define ACPI_WMI_REGFLAG_EVENT 0x8 /* GUID flag: Event */
+#define ACPI_WMI_BMOF_UUID "05901221-D566-11D1-B2F0-00A0C9062910"
 
 /*
  * acpi_wmi driver private structure
@@ -74,6 +75,8 @@ struct acpi_wmi_softc {
struct sbuf wmistat_sbuf;   /* sbuf for /dev/wmistat output */
pid_t   wmistat_open_pid; /* pid operating on /dev/wmistat */
int wmistat_bufptr; /* /dev/wmistat ptr to buffer position 
*/
+   char*mofbuf;
+   
TAILQ_HEAD(wmi_info_list_head, wmi_info) wmi_info_list;
 };
 
@@ -274,6 +277,29 @@ acpi_wmi_attach(device_t dev)
}
ACPI_SERIAL_END(acpi_wmi);
 
+   if (acpi_wmi_provides_guid_string_method(dev, ACPI_WMI_BMOF_UUID)) {
+   ACPI_BUFFER out = { ACPI_ALLOCATE_BUFFER, NULL };
+   ACPI_OBJECT *obj;
+
+   device_printf(dev, "Embedded MOF found\n");
+   status = acpi_wmi_get_block_method(dev,  ACPI_WMI_BMOF_UUID,
+   0, );
+   if (ACPI_SUCCESS(status)) {
+   obj = out.Pointer;
+   if (obj && obj->Type == ACPI_TYPE_BUFFER) {
+   SYSCTL_ADD_OPAQUE(device_get_sysctl_ctx(dev),
+   SYSCTL_CHILDREN(
+   device_get_sysctl_tree(dev)),
+   OID_AUTO, "bmof", 
+   CTLFLAG_RD | CTLFLAG_MPSAFE,
+   obj->Buffer.Pointer,
+   obj->Buffer.Length,
+   "A", "MOF Blob");
+   }
+   }
+   sc->mofbuf = out.Pointer;
+   }
+   
if (ret == 0) {
bus_generic_probe(dev);
ret = bus_generic_attach(dev);
@@ -321,6 +347,7 @@ acpi_wmi_detach(device_t dev)
sc->wmistat_open_pid = 0;
destroy_dev(sc->wmistat_dev_t);
ret = 0;
+   AcpiOsFree(sc->mofbuf);
}

Re: svn commit: r351831 - in head: . stand/efi/boot1 stand/efi/gptboot tools/build/mk

2019-09-06 Thread Andrew Turner

> On 4 Sep 2019, at 21:55, Rebecca Cran  wrote:
> 
> Author: bcran
> Date: Wed Sep  4 20:55:48 2019
> New Revision: 351831
> URL: https://svnweb.freebsd.org/changeset/base/351831
> 
> Log:
>  The efifat files are no longer used: remove the code to build them

I use them in a Jenkins instance to test arm64. I specifically don’t give the 
Jenkins user any root access so am unable to use mdconfig to create the ESP 
image. I would use makefs however support for generating fat images hasn’t made 
it into a release yet, and it doesn’t build on 12 as many needed structs are 
protected by _KERNEL.

I don’t care about the image being installed, but would like to be able to 
generate it when needed on the latest 12 release without needing root access.

Andrew

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


svn commit: r351929 - head/sys/ufs/ffs

2019-09-06 Thread Conrad Meyer
Author: cem
Date: Fri Sep  6 08:08:33 2019
New Revision: 351929
URL: https://svnweb.freebsd.org/changeset/base/351929

Log:
  ufs: Remove redundant brelse() after r294954
  
  Same automation.
  
  No functional change.

Modified:
  head/sys/ufs/ffs/ffs_alloc.c
  head/sys/ufs/ffs/ffs_balloc.c
  head/sys/ufs/ffs/ffs_snapshot.c
  head/sys/ufs/ffs/ffs_softdep.c
  head/sys/ufs/ffs/ffs_subr.c
  head/sys/ufs/ffs/ffs_vfsops.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==
--- head/sys/ufs/ffs/ffs_alloc.cFri Sep  6 08:08:10 2019
(r351928)
+++ head/sys/ufs/ffs/ffs_alloc.cFri Sep  6 08:08:33 2019
(r351929)
@@ -300,7 +300,6 @@ retry:
 */
error = bread_gb(vp, lbprev, osize, NOCRED, gbflags, );
if (error) {
-   brelse(bp);
return (error);
}
 

Modified: head/sys/ufs/ffs/ffs_balloc.c
==
--- head/sys/ufs/ffs/ffs_balloc.c   Fri Sep  6 08:08:10 2019
(r351928)
+++ head/sys/ufs/ffs/ffs_balloc.c   Fri Sep  6 08:08:33 2019
(r351929)
@@ -173,7 +173,6 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, i
if (nb != 0 && ip->i_size >= smalllblktosize(fs, lbn + 1)) {
error = bread(vp, lbn, fs->fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
bp->b_blkno = fsbtodb(fs, nb);
@@ -189,7 +188,6 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, i
if (nsize <= osize) {
error = bread(vp, lbn, osize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
bp->b_blkno = fsbtodb(fs, nb);
@@ -292,7 +290,6 @@ retry:
error = bread(vp,
indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
goto fail;
}
bap = (ufs1_daddr_t *)bp->b_data;
@@ -665,7 +662,6 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, i
error = bread_gb(vp, -1 - lbn, fs->fs_bsize, NOCRED,
gbflags, );
if (error) {
-   brelse(bp);
return (error);
}
bp->b_blkno = fsbtodb(fs, nb);
@@ -683,7 +679,6 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, i
error = bread_gb(vp, -1 - lbn, osize, NOCRED,
gbflags, );
if (error) {
-   brelse(bp);
return (error);
}
bp->b_blkno = fsbtodb(fs, nb);
@@ -771,7 +766,6 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, i
error = bread_gb(vp, lbn, fs->fs_bsize, NOCRED,
gbflags, );
if (error) {
-   brelse(bp);
return (error);
}
bp->b_blkno = fsbtodb(fs, nb);
@@ -788,7 +782,6 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, i
error = bread_gb(vp, lbn, osize, NOCRED,
gbflags, );
if (error) {
-   brelse(bp);
return (error);
}
bp->b_blkno = fsbtodb(fs, nb);
@@ -892,7 +885,6 @@ retry:
error = bread(vp,
indirs[i].in_lbn, (int)fs->fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
goto fail;
}
bap = (ufs2_daddr_t *)bp->b_data;

Modified: head/sys/ufs/ffs/ffs_snapshot.c
==
--- head/sys/ufs/ffs/ffs_snapshot.c Fri Sep  6 08:08:10 2019
(r351928)
+++ head/sys/ufs/ffs/ffs_snapshot.c Fri Sep  6 08:08:33 2019
(r351929)
@@ -789,7 +789,6 @@ out1:
for (loc = 0; loc < len; loc++) {
error = bread(vp, blkno + loc, fs->fs_bsize, KERNCRED, );
if (error) {
-   brelse(nbp);
fs->fs_snapinum[snaploc] = 0;
free(snapblklist, M_UFSMNT);
goto done;


svn commit: r351928 - head/sys/fs/msdosfs

2019-09-06 Thread Conrad Meyer
Author: cem
Date: Fri Sep  6 08:08:10 2019
New Revision: 351928
URL: https://svnweb.freebsd.org/changeset/base/351928

Log:
  msdosfs: Remove redundant brelse() after r294954
  
  Same automation.
  
  No functional change.

Modified:
  head/sys/fs/msdosfs/msdosfs_fat.c
  head/sys/fs/msdosfs/msdosfs_lookup.c
  head/sys/fs/msdosfs/msdosfs_vfsops.c
  head/sys/fs/msdosfs/msdosfs_vnops.c

Modified: head/sys/fs/msdosfs/msdosfs_fat.c
==
--- head/sys/fs/msdosfs/msdosfs_fat.c   Fri Sep  6 08:07:36 2019
(r351927)
+++ head/sys/fs/msdosfs/msdosfs_fat.c   Fri Sep  6 08:08:10 2019
(r351928)
@@ -202,7 +202,6 @@ pcbmap(struct denode *dep, u_long findcn, daddr_t *bnp
brelse(bp);
error = bread(pmp->pm_devvp, bn, bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
bp_bn = bn;
@@ -504,7 +503,6 @@ fatentry(int function, struct msdosfsmount *pmp, u_lon
fatblock(pmp, byteoffset, , , );
error = bread(pmp->pm_devvp, bn, bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
 
@@ -587,7 +585,6 @@ fatchain(struct msdosfsmount *pmp, u_long start, u_lon
fatblock(pmp, byteoffset, , , );
error = bread(pmp->pm_devvp, bn, bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
while (count > 0) {
@@ -843,7 +840,6 @@ freeclusterchain(struct msdosfsmount *pmp, u_long clus
updatefats(pmp, bp, lbn);
error = bread(pmp->pm_devvp, bn, bsize, NOCRED, );
if (error) {
-   brelse(bp);
MSDOSFS_UNLOCK_MP(pmp);
return (error);
}

Modified: head/sys/fs/msdosfs/msdosfs_lookup.c
==
--- head/sys/fs/msdosfs/msdosfs_lookup.cFri Sep  6 08:07:36 2019
(r351927)
+++ head/sys/fs/msdosfs/msdosfs_lookup.cFri Sep  6 08:08:10 2019
(r351928)
@@ -234,7 +234,6 @@ msdosfs_lookup_(struct vnode *vdp, struct vnode **vpp,
}
error = bread(pmp->pm_devvp, bn, blsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
for (blkoff = 0; blkoff < blsize;
@@ -681,7 +680,6 @@ createde(struct denode *dep, struct denode *ddep, stru
error = bread(pmp->pm_devvp, bn, blsize,
  NOCRED, );
if (error) {
-   brelse(bp);
return error;
}
ndep = bptoep(pmp, bp, ddep->de_fndoffset);
@@ -747,7 +745,6 @@ dosdirempty(struct denode *dep)
}
error = bread(pmp->pm_devvp, bn, blsize, NOCRED, );
if (error) {
-   brelse(bp);
return (0);
}
for (dentp = (struct direntry *)bp->b_data;
@@ -960,7 +957,6 @@ removede(struct denode *pdep, struct denode *dep)
return error;
error = bread(pmp->pm_devvp, bn, blsize, NOCRED, );
if (error) {
-   brelse(bp);
return error;
}
ep = bptoep(pmp, bp, offset);
@@ -1037,7 +1033,6 @@ uniqdosname(struct denode *dep, struct componentname *
}
error = bread(pmp->pm_devvp, bn, blsize, NOCRED, );
if (error) {
-   brelse(bp);
return error;
}
for (dentp = (struct direntry *)bp->b_data;

Modified: head/sys/fs/msdosfs/msdosfs_vfsops.c
==
--- head/sys/fs/msdosfs/msdosfs_vfsops.cFri Sep  6 08:07:36 2019
(r351927)
+++ head/sys/fs/msdosfs/msdosfs_vfsops.cFri Sep  6 08:08:10 2019
(r351928)
@@ -862,7 +862,6 @@ msdosfs_fsiflush(struct msdosfsmount *pmp, int waitfor
error = bread(pmp->pm_devvp, pmp->pm_fsinfo, pmp->pm_BytesPerSec,
NOCRED, );
if (error != 0) {
-   brelse(bp);
goto unlock;
}
fp = (struct fsinfo *)bp->b_data;

Modified: head/sys/fs/msdosfs/msdosfs_vnops.c

svn commit: r351927 - head/sys/fs/cd9660

2019-09-06 Thread Conrad Meyer
Author: cem
Date: Fri Sep  6 08:07:36 2019
New Revision: 351927
URL: https://svnweb.freebsd.org/changeset/base/351927

Log:
  cd9660: Remove redundant brelse() after r294954
  
  Same automation.
  
  No functional change.

Modified:
  head/sys/fs/cd9660/cd9660_vfsops.c
  head/sys/fs/cd9660/cd9660_vnops.c

Modified: head/sys/fs/cd9660/cd9660_vfsops.c
==
--- head/sys/fs/cd9660/cd9660_vfsops.c  Fri Sep  6 08:07:12 2019
(r351926)
+++ head/sys/fs/cd9660/cd9660_vfsops.c  Fri Sep  6 08:07:36 2019
(r351927)
@@ -753,7 +753,6 @@ cd9660_vget_internal(mp, ino, flags, vpp, relocated, i
  imp->logical_block_size, NOCRED, );
if (error) {
vput(vp);
-   brelse(bp);
printf("fhtovp: bread error %d\n",error);
return (error);
}

Modified: head/sys/fs/cd9660/cd9660_vnops.c
==
--- head/sys/fs/cd9660/cd9660_vnops.c   Fri Sep  6 08:07:12 2019
(r351926)
+++ head/sys/fs/cd9660/cd9660_vnops.c   Fri Sep  6 08:07:36 2019
(r351927)
@@ -689,7 +689,6 @@ cd9660_readlink(ap)
  (imp->im_bshift - DEV_BSHIFT),
  imp->logical_block_size, NOCRED, );
if (error) {
-   brelse(bp);
return (EINVAL);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r351926 - head/sys/fs/ext2fs

2019-09-06 Thread Conrad Meyer
Author: cem
Date: Fri Sep  6 08:07:12 2019
New Revision: 351926
URL: https://svnweb.freebsd.org/changeset/base/351926

Log:
  ext2fs: Remove redundant brelse() after r294954
  
  Coccinelle:
  
  @ rule1 @
   identifier __error;
  @@
   ...
   int __error;
   ...
  
  @ rule2 depends on rule1 @
   identifier rule1.__error;
   identifier __bp;
  @@
  
   __error =
  (
   bread
  |
   bread_gb
  |
   breadn
  |
   breadn_flags
  )
   (..., &__bp);
   if (
  (
   __error
  |
   __error != 0
  )
   ) {
   ...
  - brelse(__bp);
   ...
   }
  
  No functional change.

Modified:
  head/sys/fs/ext2fs/ext2_alloc.c
  head/sys/fs/ext2fs/ext2_balloc.c
  head/sys/fs/ext2fs/ext2_extattr.c
  head/sys/fs/ext2fs/ext2_extents.c
  head/sys/fs/ext2fs/ext2_vfsops.c

Modified: head/sys/fs/ext2fs/ext2_alloc.c
==
--- head/sys/fs/ext2fs/ext2_alloc.c Fri Sep  6 05:34:31 2019
(r351925)
+++ head/sys/fs/ext2fs/ext2_alloc.c Fri Sep  6 08:07:12 2019
(r351926)
@@ -1313,7 +1313,6 @@ ext2_nodealloccg(struct inode *ip, int cg, daddr_t ipr
e2fs_gd_get_i_bitmap(>e2fs_gd[cg])),
(int)fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
EXT2_LOCK(ump);
return (0);
}
@@ -1417,7 +1416,6 @@ ext2_blkfree(struct inode *ip, e4fs_daddr_t bno, long 
fsbtodb(fs, e2fs_gd_get_b_bitmap(>e2fs_gd[cg])),
(int)fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return;
}
bbp = (char *)bp->b_data;
@@ -1464,7 +1462,6 @@ ext2_vfree(struct vnode *pvp, ino_t ino, int mode)
fsbtodb(fs, e2fs_gd_get_i_bitmap(>e2fs_gd[cg])),
(int)fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (0);
}
ibp = (char *)bp->b_data;

Modified: head/sys/fs/ext2fs/ext2_balloc.c
==
--- head/sys/fs/ext2fs/ext2_balloc.cFri Sep  6 05:34:31 2019
(r351925)
+++ head/sys/fs/ext2fs/ext2_balloc.cFri Sep  6 08:07:12 2019
(r351926)
@@ -78,7 +78,6 @@ ext2_ext_balloc(struct inode *ip, uint32_t lbn, int si
} else {
error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
}
@@ -142,7 +141,6 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size
if (nb != 0) {
error = bread(vp, lbn, fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
bp->b_blkno = fsbtodb(fs, nb);
@@ -219,7 +217,6 @@ ext2_balloc(struct inode *ip, e2fs_lbn_t lbn, int size
error = bread(vp,
indirs[i].in_lbn, (int)fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
bap = (e2fs_daddr_t *)bp->b_data;

Modified: head/sys/fs/ext2fs/ext2_extattr.c
==
--- head/sys/fs/ext2fs/ext2_extattr.c   Fri Sep  6 05:34:31 2019
(r351925)
+++ head/sys/fs/ext2fs/ext2_extattr.c   Fri Sep  6 08:07:12 2019
(r351926)
@@ -280,7 +280,6 @@ ext2_extattr_block_list(struct inode *ip, int attrname
error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
 
@@ -421,7 +420,6 @@ ext2_extattr_block_get(struct inode *ip, int attrnames
error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
 
@@ -681,7 +679,6 @@ ext2_extattr_block_delete(struct inode *ip, int attrna
error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
 
@@ -1074,7 +1071,6 @@ ext2_extattr_block_set(struct inode *ip, int attrnames
error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
 
@@ -1221,7 +1217,6 @@ int ext2_extattr_free(struct inode *ip)
error = bread(ip->i_devvp, fsbtodb(fs, ip->i_facl),
fs->e2fs_bsize, NOCRED, );
if (error) {
-   brelse(bp);
return (error);
}
 

Modified: head/sys/fs/ext2fs/ext2_extents.c