svn commit: r265632 - in stable/10: sbin/camcontrol sys/cam sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 06:55:48 2014
New Revision: 265632
URL: http://svnweb.freebsd.org/changeset/base/265632

Log:
  MFC r260509:
  Replace several instances of -1 with appropriate CAM_*_WILDCARD and types.
  
  It was equal before r259397, but for good or bad, not any more for LUNs.
  
  This change fixes at least CAM debugging.

Modified:
  stable/10/sbin/camcontrol/camcontrol.c
  stable/10/sys/cam/cam_debug.h
  stable/10/sys/cam/cam_xpt.c
  stable/10/sys/cam/scsi/scsi_low.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/camcontrol.c
==
--- stable/10/sbin/camcontrol/camcontrol.c  Thu May  8 03:43:18 2014
(r265631)
+++ stable/10/sbin/camcontrol/camcontrol.c  Thu May  8 06:55:48 2014
(r265632)
@@ -264,11 +264,12 @@ static int scsiinquiry(struct cam_device
 static int scsiserial(struct cam_device *device, int retry_count, int timeout);
 static int camxferrate(struct cam_device *device);
 #endif /* MINIMALISTIC */
-static int parse_btl(char *tstr, int *bus, int *target, int *lun,
-cam_argmask *arglst);
+static int parse_btl(char *tstr, path_id_t *bus, target_id_t *target,
+lun_id_t *lun, cam_argmask *arglst);
 static int dorescan_or_reset(int argc, char **argv, int rescan);
-static int rescan_or_reset_bus(int bus, int rescan);
-static int scanlun_or_reset_dev(int bus, int target, int lun, int scan);
+static int rescan_or_reset_bus(path_id_t bus, int rescan);
+static int scanlun_or_reset_dev(path_id_t bus, target_id_t target,
+lun_id_t lun, int scan);
 #ifndef MINIMALISTIC
 static int readdefects(struct cam_device *device, int argc, char **argv,
   char *combinedopt, int retry_count, int timeout);
@@ -3019,7 +3020,8 @@ atasecurity(struct cam_device *device, i
  * Returns the number of parsed components, or 0.
  */
 static int
-parse_btl(char *tstr, int *bus, int *target, int *lun, cam_argmask *arglst)
+parse_btl(char *tstr, path_id_t *bus, target_id_t *target, lun_id_t *lun,
+cam_argmask *arglst)
 {
char *tmpstr;
int convs = 0;
@@ -3055,7 +3057,9 @@ dorescan_or_reset(int argc, char **argv,
static const char must[] =
you must specify \all\, a bus, or a bus:target:lun to %s;
int rv, error = 0;
-   int bus = -1, target = -1, lun = -1;
+   path_id_t bus = CAM_BUS_WILDCARD;
+   target_id_t target = CAM_TARGET_WILDCARD;
+   lun_id_t lun = CAM_LUN_WILDCARD;
char *tstr;
 
if (argc  3) {
@@ -3087,7 +3091,7 @@ dorescan_or_reset(int argc, char **argv,
 }
 
 static int
-rescan_or_reset_bus(int bus, int rescan)
+rescan_or_reset_bus(path_id_t bus, int rescan)
 {
union ccb ccb, matchccb;
int fd, retval;
@@ -3101,7 +3105,7 @@ rescan_or_reset_bus(int bus, int rescan)
return(1);
}
 
-   if (bus != -1) {
+   if (bus != CAM_BUS_WILDCARD) {
ccb.ccb_h.func_code = rescan ? XPT_SCAN_BUS : XPT_RESET_BUS;
ccb.ccb_h.path_id = bus;
ccb.ccb_h.target_id = CAM_TARGET_WILDCARD;
@@ -3201,7 +3205,7 @@ rescan_or_reset_bus(int bus, int rescan)
 * We don't want to rescan or reset the xpt bus.
 * See above.
 */
-   if ((int)bus_result-path_id == -1)
+   if (bus_result-path_id == CAM_XPT_PATH_ID)
continue;
 
ccb.ccb_h.func_code = rescan ? XPT_SCAN_BUS :
@@ -3254,7 +3258,7 @@ bailout:
 }
 
 static int
-scanlun_or_reset_dev(int bus, int target, int lun, int scan)
+scanlun_or_reset_dev(path_id_t bus, target_id_t target, lun_id_t lun, int scan)
 {
union ccb ccb;
struct cam_device *device;
@@ -3262,18 +3266,18 @@ scanlun_or_reset_dev(int bus, int target
 
device = NULL;
 
-   if (bus  0) {
+   if (bus == CAM_BUS_WILDCARD) {
warnx(invalid bus number %d, bus);
return(1);
}
 
-   if (target  0) {
+   if (target == CAM_TARGET_WILDCARD) {
warnx(invalid target number %d, target);
return(1);
}
 
-   if (lun  0) {
-   warnx(invalid lun number %d, lun);
+   if (lun == CAM_LUN_WILDCARD) {
+   warnx(invalid lun number %jx, (uintmax_t)lun);
return(1);
}
 
@@ -3331,12 +3335,12 @@ scanlun_or_reset_dev(int bus, int target
if (((ccb.ccb_h.status  CAM_STATUS_MASK) == CAM_REQ_CMP)
 || ((!scan)
   ((ccb.ccb_h.status  CAM_STATUS_MASK) == CAM_BDR_SENT))) {
-   fprintf(stdout, %s of %d:%d:%d was successful\n,
-   scan? Re-scan : Reset, bus, target, lun);
+   fprintf(stdout, %s of %d:%d:%jx was successful\n,
+   scan? Re-scan : Reset, bus, target, (uintmax_t)lun);
   

svn commit: r265633 - in stable/9: sbin/camcontrol sys/cam sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 06:56:59 2014
New Revision: 265633
URL: http://svnweb.freebsd.org/changeset/base/265633

Log:
  MFC r260509:
  Replace several instances of -1 with appropriate CAM_*_WILDCARD and types.
  
  It was equal before r259397, but for good or bad, not any more for LUNs.
  
  This change fixes at least CAM debugging.

Modified:
  stable/9/sbin/camcontrol/camcontrol.c
  stable/9/sys/cam/cam_debug.h
  stable/9/sys/cam/cam_xpt.c
  stable/9/sys/cam/scsi/scsi_low.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sbin/   (props changed)
  stable/9/sbin/camcontrol/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sbin/camcontrol/camcontrol.c
==
--- stable/9/sbin/camcontrol/camcontrol.c   Thu May  8 06:55:48 2014
(r265632)
+++ stable/9/sbin/camcontrol/camcontrol.c   Thu May  8 06:56:59 2014
(r265633)
@@ -264,11 +264,12 @@ static int scsiinquiry(struct cam_device
 static int scsiserial(struct cam_device *device, int retry_count, int timeout);
 static int camxferrate(struct cam_device *device);
 #endif /* MINIMALISTIC */
-static int parse_btl(char *tstr, int *bus, int *target, int *lun,
-cam_argmask *arglst);
+static int parse_btl(char *tstr, path_id_t *bus, target_id_t *target,
+lun_id_t *lun, cam_argmask *arglst);
 static int dorescan_or_reset(int argc, char **argv, int rescan);
-static int rescan_or_reset_bus(int bus, int rescan);
-static int scanlun_or_reset_dev(int bus, int target, int lun, int scan);
+static int rescan_or_reset_bus(path_id_t bus, int rescan);
+static int scanlun_or_reset_dev(path_id_t bus, target_id_t target,
+lun_id_t lun, int scan);
 #ifndef MINIMALISTIC
 static int readdefects(struct cam_device *device, int argc, char **argv,
   char *combinedopt, int retry_count, int timeout);
@@ -3001,7 +3002,8 @@ atasecurity(struct cam_device *device, i
  * Returns the number of parsed components, or 0.
  */
 static int
-parse_btl(char *tstr, int *bus, int *target, int *lun, cam_argmask *arglst)
+parse_btl(char *tstr, path_id_t *bus, target_id_t *target, lun_id_t *lun,
+cam_argmask *arglst)
 {
char *tmpstr;
int convs = 0;
@@ -3037,7 +3039,9 @@ dorescan_or_reset(int argc, char **argv,
static const char must[] =
you must specify \all\, a bus, or a bus:target:lun to %s;
int rv, error = 0;
-   int bus = -1, target = -1, lun = -1;
+   path_id_t bus = CAM_BUS_WILDCARD;
+   target_id_t target = CAM_TARGET_WILDCARD;
+   lun_id_t lun = CAM_LUN_WILDCARD;
char *tstr;
 
if (argc  3) {
@@ -3069,7 +3073,7 @@ dorescan_or_reset(int argc, char **argv,
 }
 
 static int
-rescan_or_reset_bus(int bus, int rescan)
+rescan_or_reset_bus(path_id_t bus, int rescan)
 {
union ccb ccb, matchccb;
int fd, retval;
@@ -3083,7 +3087,7 @@ rescan_or_reset_bus(int bus, int rescan)
return(1);
}
 
-   if (bus != -1) {
+   if (bus != CAM_BUS_WILDCARD) {
ccb.ccb_h.func_code = rescan ? XPT_SCAN_BUS : XPT_RESET_BUS;
ccb.ccb_h.path_id = bus;
ccb.ccb_h.target_id = CAM_TARGET_WILDCARD;
@@ -3183,7 +3187,7 @@ rescan_or_reset_bus(int bus, int rescan)
 * We don't want to rescan or reset the xpt bus.
 * See above.
 */
-   if ((int)bus_result-path_id == -1)
+   if (bus_result-path_id == CAM_XPT_PATH_ID)
continue;
 
ccb.ccb_h.func_code = rescan ? XPT_SCAN_BUS :
@@ -3236,7 +3240,7 @@ bailout:
 }
 
 static int
-scanlun_or_reset_dev(int bus, int target, int lun, int scan)
+scanlun_or_reset_dev(path_id_t bus, target_id_t target, lun_id_t lun, int scan)
 {
union ccb ccb;
struct cam_device *device;
@@ -3244,18 +3248,18 @@ scanlun_or_reset_dev(int bus, int target
 
device = NULL;
 
-   if (bus  0) {
+   if (bus == CAM_BUS_WILDCARD) {
warnx(invalid bus number %d, bus);
return(1);
}
 
-   if (target  0) {
+   if (target == CAM_TARGET_WILDCARD) {
warnx(invalid target number %d, target);
return(1);
}
 
-   if (lun  0) {
-   warnx(invalid lun number %d, lun);
+   if (lun == CAM_LUN_WILDCARD) {
+   warnx(invalid lun number %jx, (uintmax_t)lun);
return(1);
}
 
@@ -3313,12 +3317,12 @@ scanlun_or_reset_dev(int bus, int target
if (((ccb.ccb_h.status  CAM_STATUS_MASK) == CAM_REQ_CMP)
 || ((!scan)
   ((ccb.ccb_h.status  CAM_STATUS_MASK) == CAM_BDR_SENT))) {
-   fprintf(stdout, %s of %d:%d:%d was successful\n,
-   scan? Re-scan : Reset, bus, target, lun);
+   fprintf(stdout, %s 

svn commit: r265634 - in stable/10/sys/cam: ctl scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:00:45 2014
New Revision: 265634
URL: http://svnweb.freebsd.org/changeset/base/265634

Log:
  MFC r264274, r264279, r264283, r264296, r264297:
  Add support for SCSI UNMAP commands to CTL.
  
  This patch adds support for three new SCSI commands: UNMAP, WRITE SAME(10)
  and WRITE SAME(16).  WRITE SAME commands support both normal write mode
  and UNMAP flag.  To properly report UNMAP capabilities this patch also adds
  support for reporting two new VPD pages: Block limits and Logical Block
  Provisioning.
  
  UNMAP support can be enabled per-LUN by adding -o unmap=on to `ctladm
  create` command line or option unmap on to lun sections of /etc/ctl.conf.
  
  At this moment UNMAP supported for ramdisks and device-backed block LUNs.
  It was tested to work great with ZFS ZVOLs.  For file-backed LUNs UNMAP
  support is unfortunately missing due to absence of respective VFS KPI.
  
  Sponsored by:   iXsystems, Inc

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend.h
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
  stable/10/sys/cam/ctl/ctl_cmd_table.c
  stable/10/sys/cam/ctl/ctl_io.h
  stable/10/sys/cam/ctl/ctl_private.h
  stable/10/sys/cam/ctl/ctl_ser_table.c
  stable/10/sys/cam/scsi/scsi_all.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Thu May  8 06:56:59 2014(r265633)
+++ stable/10/sys/cam/ctl/ctl.c Thu May  8 07:00:45 2014(r265634)
@@ -331,9 +331,10 @@ SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verb
 verbose, 0, Show SCSI errors returned to initiator);
 
 /*
- * Serial number (0x80), device id (0x83), and supported pages (0x00)
+ * Serial number (0x80), device id (0x83), supported pages (0x00),
+ * Block limits (0xB0) and Logical Block Provisioning (0xB2)
  */
-#define SCSI_EVPD_NUM_SUPPORTED_PAGES  3
+#define SCSI_EVPD_NUM_SUPPORTED_PAGES  5
 
 static void ctl_isc_event_handler(ctl_ha_channel chanel, ctl_ha_event event,
  int param);
@@ -391,6 +392,9 @@ static void ctl_hndl_per_res_out_on_othe
 static int ctl_inquiry_evpd_supported(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_serial(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd_devid(struct ctl_scsiio *ctsio, int alloc_len);
+static int ctl_inquiry_evpd_block_limits(struct ctl_scsiio *ctsio,
+int alloc_len);
+static int ctl_inquiry_evpd_lbp(struct ctl_scsiio *ctsio, int alloc_len);
 static int ctl_inquiry_evpd(struct ctl_scsiio *ctsio);
 static int ctl_inquiry_std(struct ctl_scsiio *ctsio);
 static int ctl_get_lba_len(union ctl_io *io, uint64_t *lba, uint32_t *len);
@@ -5787,6 +5791,195 @@ ctl_write_buffer(struct ctl_scsiio *ctsi
return (CTL_RETVAL_COMPLETE);
 }
 
+int
+ctl_write_same(struct ctl_scsiio *ctsio)
+{
+   struct ctl_lun *lun;
+   struct ctl_lba_len_flags lbalen;
+   uint64_t lba;
+   uint32_t num_blocks;
+   int len, retval;
+   uint8_t byte2;
+
+   retval = CTL_RETVAL_COMPLETE;
+
+   CTL_DEBUG_PRINT((ctl_write_same\n));
+
+   lun = (struct ctl_lun *)ctsio-io_hdr.ctl_private[CTL_PRIV_LUN].ptr;
+
+   switch (ctsio-cdb[0]) {
+   case WRITE_SAME_10: {
+   struct scsi_write_same_10 *cdb;
+
+   cdb = (struct scsi_write_same_10 *)ctsio-cdb;
+
+   lba = scsi_4btoul(cdb-addr);
+   num_blocks = scsi_2btoul(cdb-length);
+   byte2 = cdb-byte2;
+   break;
+   }
+   case WRITE_SAME_16: {
+   struct scsi_write_same_16 *cdb;
+
+   cdb = (struct scsi_write_same_16 *)ctsio-cdb;
+
+   lba = scsi_8btou64(cdb-addr);
+   num_blocks = scsi_4btoul(cdb-length);
+   byte2 = cdb-byte2;
+   break;
+   }
+   default:
+   /*
+* We got a command we don't support.  This shouldn't
+* happen, commands should be filtered out above us.
+*/
+   ctl_set_invalid_opcode(ctsio);
+   ctl_done((union ctl_io *)ctsio);
+
+   return (CTL_RETVAL_COMPLETE);
+   break; /* NOTREACHED */
+   }
+
+   /*
+* The first check is to make sure we're in bounds, the second
+* check is to catch wrap-around problems.  If the lba + num blocks
+* is less than the lba, then we've wrapped around and the block
+* range is invalid anyway.
+*/
+   if (((lba + num_blocks)  (lun-be_lun-maxlba + 1))
+|| ((lba + num_blocks)  lba)) {
+   ctl_set_lba_out_of_range(ctsio);
+   ctl_done((union ctl_io *)ctsio);
+   return (CTL_RETVAL_COMPLETE);
+   }
+
+   /* Zero number of blocks means to the last logical block */

svn commit: r265635 - stable/10/sys/cam

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:01:54 2014
New Revision: 265635
URL: http://svnweb.freebsd.org/changeset/base/265635

Log:
  MFC r264406:
  Report more readable state - for idle CAM scan thread.

Modified:
  stable/10/sys/cam/cam_xpt.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/cam_xpt.c
==
--- stable/10/sys/cam/cam_xpt.c Thu May  8 07:00:45 2014(r265634)
+++ stable/10/sys/cam/cam_xpt.c Thu May  8 07:01:54 2014(r265635)
@@ -768,7 +768,7 @@ xpt_scanner_thread(void *dummy)
for (;;) {
if (TAILQ_EMPTY(xsoftc.ccb_scanq))
msleep(xsoftc.ccb_scanq, xsoftc.xpt_topo_lock, PRIBIO,
-  ccb_scanq, 0);
+  -, 0);
if ((ccb = (union ccb *)TAILQ_FIRST(xsoftc.ccb_scanq)) != 
NULL) {
TAILQ_REMOVE(xsoftc.ccb_scanq, ccb-ccb_h, 
sim_links.tqe);
xpt_unlock_buses();
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265636 - stable/9/sys/cam

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:02:46 2014
New Revision: 265636
URL: http://svnweb.freebsd.org/changeset/base/265636

Log:
  MFC r264406:
  Report more readable state - for idle CAM scan thread.

Modified:
  stable/9/sys/cam/cam_xpt.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/cam_xpt.c
==
--- stable/9/sys/cam/cam_xpt.c  Thu May  8 07:01:54 2014(r265635)
+++ stable/9/sys/cam/cam_xpt.c  Thu May  8 07:02:46 2014(r265636)
@@ -792,7 +792,7 @@ xpt_scanner_thread(void *dummy)
for (;;) {
if (TAILQ_EMPTY(xsoftc.ccb_scanq))
msleep(xsoftc.ccb_scanq, xsoftc.xpt_topo_lock, PRIBIO,
-  ccb_scanq, 0);
+  -, 0);
if ((ccb = (union ccb *)TAILQ_FIRST(xsoftc.ccb_scanq)) != 
NULL) {
TAILQ_REMOVE(xsoftc.ccb_scanq, ccb-ccb_h, 
sim_links.tqe);
xpt_unlock_buses();
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265637 - stable/10/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:04:13 2014
New Revision: 265637
URL: http://svnweb.freebsd.org/changeset/base/265637

Log:
  MFC r264407:
  Join CTL worker threads into one process for convenience.
  Report their idle state as -.

Modified:
  stable/10/sys/cam/ctl/ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Thu May  8 07:02:46 2014(r265636)
+++ stable/10/sys/cam/ctl/ctl.c Thu May  8 07:04:13 2014(r265637)
@@ -1112,8 +1112,8 @@ ctl_init(void)
}
 
for (i = 0; i  worker_threads; i++) {
-   error = kproc_create(ctl_work_thread, softc, 
softc-work_thread, 0, 0,
-   ctl_thrd%d, i);
+   error = kproc_kthread_add(ctl_work_thread, softc,
+   softc-work_thread, NULL, 0, 0, ctl, work%d, i);
if (error != 0) {
printf(error creating CTL work thread!\n);
mtx_lock(softc-ctl_lock);
@@ -13380,7 +13380,7 @@ ctl_work_thread(void *arg)
 
/* XXX KDM use the PDROP flag?? */
/* Sleep until we have something to do. */
-   mtx_sleep(softc, softc-ctl_lock, PRIBIO, ctl_work, 0);
+   mtx_sleep(softc, softc-ctl_lock, PRIBIO, -, 0);
 
/* Back to the top of the loop to see what woke us up. */
continue;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265638 - stable/10/sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:05:19 2014
New Revision: 265638
URL: http://svnweb.freebsd.org/changeset/base/265638

Log:
  MFC r264834:
  Disable UNMAP support for STEC 842 SSDs.
  
  In some unknown cases UNMAP commands make device firmware stuck.

Modified:
  stable/10/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_da.c
==
--- stable/10/sys/cam/scsi/scsi_da.cThu May  8 07:04:13 2014
(r265637)
+++ stable/10/sys/cam/scsi/scsi_da.cThu May  8 07:05:19 2014
(r265638)
@@ -99,7 +99,8 @@ typedef enum {
DA_Q_NO_6_BYTE  = 0x02,
DA_Q_NO_PREVENT = 0x04,
DA_Q_4K = 0x08,
-   DA_Q_NO_RC16= 0x10
+   DA_Q_NO_RC16= 0x10,
+   DA_Q_NO_UNMAP   = 0x20
 } da_quirks;
 
 #define DA_Q_BIT_STRING\
@@ -349,6 +350,13 @@ static struct da_quirk_entry da_quirk_ta
{T_DIRECT, SIP_MEDIA_FIXED, COMPAQ, RAID*, *},
/*quirks*/ DA_Q_NO_SYNC_CACHE
},
+   {
+   /*
+* The STEC 842 sometimes hang on UNMAP.
+*/
+   {T_DIRECT, SIP_MEDIA_FIXED, STEC, S842E800M2, *},
+   /*quirks*/ DA_Q_NO_UNMAP
+   },
/* USB mass storage devices supported by umass(4) */
{
/*
@@ -3205,7 +3213,7 @@ dadone(struct cam_periph *periph, union 
 
/* Ensure re-probe doesn't see old delete. */
softc-delete_available = 0;
-   if (lbp) {
+   if (lbp  (softc-quirks  DA_Q_NO_UNMAP) == 0) {
/*
 * Based on older SBC-3 spec revisions
 * any of the UNMAP methods may be
@@ -3404,7 +3412,8 @@ dadone(struct cam_periph *periph, union 
if ((csio-ccb_h.status  CAM_STATUS_MASK) == CAM_REQ_CMP) {
for (i = 0; i  sizeof(*ata_params) / 2; i++)
ptr[i] = le16toh(ptr[i]);
-   if (ata_params-support_dsm  ATA_SUPPORT_DSM_TRIM) {
+   if (ata_params-support_dsm  ATA_SUPPORT_DSM_TRIM 
+   (softc-quirks  DA_Q_NO_UNMAP) == 0) {
dadeleteflag(softc, DA_DELETE_ATA_TRIM, 1);
if (ata_params-max_dsm_blocks != 0)
softc-trim_max_ranges = min(
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265639 - stable/9/sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:06:15 2014
New Revision: 265639
URL: http://svnweb.freebsd.org/changeset/base/265639

Log:
  MFC r264834:
  Disable UNMAP support for STEC 842 SSDs.
  
  In some unknown cases UNMAP commands make device firmware stuck.

Modified:
  stable/9/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/scsi/scsi_da.c
==
--- stable/9/sys/cam/scsi/scsi_da.c Thu May  8 07:05:19 2014
(r265638)
+++ stable/9/sys/cam/scsi/scsi_da.c Thu May  8 07:06:15 2014
(r265639)
@@ -99,7 +99,8 @@ typedef enum {
DA_Q_NO_6_BYTE  = 0x02,
DA_Q_NO_PREVENT = 0x04,
DA_Q_4K = 0x08,
-   DA_Q_NO_RC16= 0x10
+   DA_Q_NO_RC16= 0x10,
+   DA_Q_NO_UNMAP   = 0x20
 } da_quirks;
 
 #define DA_Q_BIT_STRING\
@@ -350,6 +351,13 @@ static struct da_quirk_entry da_quirk_ta
{T_DIRECT, SIP_MEDIA_FIXED, COMPAQ, RAID*, *},
/*quirks*/ DA_Q_NO_SYNC_CACHE
},
+   {
+   /*
+* The STEC 842 sometimes hang on UNMAP.
+*/
+   {T_DIRECT, SIP_MEDIA_FIXED, STEC, S842E800M2, *},
+   /*quirks*/ DA_Q_NO_UNMAP
+   },
/* USB mass storage devices supported by umass(4) */
{
/*
@@ -3210,7 +3218,7 @@ dadone(struct cam_periph *periph, union 
 
/* Ensure re-probe doesn't see old delete. */
softc-delete_available = 0;
-   if (lbp) {
+   if (lbp  (softc-quirks  DA_Q_NO_UNMAP) == 0) {
/*
 * Based on older SBC-3 spec revisions
 * any of the UNMAP methods may be
@@ -3409,7 +3417,8 @@ dadone(struct cam_periph *periph, union 
if ((csio-ccb_h.status  CAM_STATUS_MASK) == CAM_REQ_CMP) {
for (i = 0; i  sizeof(*ata_params) / 2; i++)
ptr[i] = le16toh(ptr[i]);
-   if (ata_params-support_dsm  ATA_SUPPORT_DSM_TRIM) {
+   if (ata_params-support_dsm  ATA_SUPPORT_DSM_TRIM 
+   (softc-quirks  DA_Q_NO_UNMAP) == 0) {
dadeleteflag(softc, DA_DELETE_ATA_TRIM, 1);
if (ata_params-max_dsm_blocks != 0)
softc-trim_max_ranges = min(
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265640 - stable/10/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:07:51 2014
New Revision: 265640
URL: http://svnweb.freebsd.org/changeset/base/265640

Log:
  MFC r264880 (by trasz):
  Modify CTL iSCSI frontend to properly handle situations where datamove
  routine is called multiple times per SCSI task.

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Thu May  8 07:06:15 2014
(r265639)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c  Thu May  8 07:07:51 2014
(r265640)
@@ -709,7 +709,7 @@ cfiscsi_handle_data_segment(struct icl_p
(bad opcode 0x%x, request-ip_bhs-bhs_opcode));
 
/*
-* We're only using fields common for Data Out and SCSI Command PDUs.
+* We're only using fields common for Data-Out and SCSI Command PDUs.
 */
bhsdo = (struct iscsi_bhs_data_out *)request-ip_bhs;
 
@@ -742,10 +742,13 @@ cfiscsi_handle_data_segment(struct icl_p
 * Make sure the offset, as sent by the initiator, matches the offset
 * we're supposed to be at in the scatter-gather list.
 */
-   if (buffer_offset != io-scsiio.ext_data_filled) {
+   if (buffer_offset !=
+   io-scsiio.kern_rel_offset + io-scsiio.ext_data_filled) {
CFISCSI_SESSION_WARN(cs, received bad buffer offset %zd, 
-   expected %zd, buffer_offset,
+   expected %zd; dropping connection, buffer_offset,
+   (size_t)io-scsiio.kern_rel_offset +
(size_t)io-scsiio.ext_data_filled);
+   ctl_set_data_phase_error(io-scsiio);
cfiscsi_session_terminate(cs);
return (true);
}
@@ -804,40 +807,62 @@ cfiscsi_handle_data_segment(struct icl_p
}
 
if (len  off) {
+   /*
+* In case of unsolicited data, it's possible that the buffer
+* provided by CTL is smaller than negotiated FirstBurstLength.
+* Just ignore the superfluous data; will ask for them with R2T
+* on next call to cfiscsi_datamove().
+*
+* This obviously can only happen with SCSI Command PDU. 
+*/
+   if ((request-ip_bhs-bhs_opcode  ~ISCSI_BHS_OPCODE_IMMEDIATE) 
==
+   ISCSI_BHS_OPCODE_SCSI_COMMAND) {
+   CFISCSI_SESSION_DEBUG(cs, received too much immediate 
+   data: got %zd bytes, expected %zd,
+   icl_pdu_data_segment_length(request), off);
+   return (true);
+   }
+
CFISCSI_SESSION_WARN(cs, received too much data: got %zd 
bytes, 
-   expected %zd, icl_pdu_data_segment_length(request), off);
+   expected %zd; dropping connection,
+   icl_pdu_data_segment_length(request), off);
+   ctl_set_data_phase_error(io-scsiio);
cfiscsi_session_terminate(cs);
return (true);
}
 
-   if (bhsdo-bhsdo_flags  BHSDO_FLAGS_F ||
-   io-scsiio.ext_data_filled == io-scsiio.kern_total_len) {
-   if ((bhsdo-bhsdo_flags  BHSDO_FLAGS_F) == 0) {
-   CFISCSI_SESSION_WARN(cs, got the final packet without 
-   the F flag; flags = 0x%x; dropping connection,
-   bhsdo-bhsdo_flags);
+   if (io-scsiio.ext_data_filled == io-scsiio.kern_data_len 
+   (bhsdo-bhsdo_flags  BHSDO_FLAGS_F) == 0) {
+   CFISCSI_SESSION_WARN(cs, got the final packet without 
+   the F flag; flags = 0x%x; dropping connection,
+   bhsdo-bhsdo_flags);
+   ctl_set_data_phase_error(io-scsiio);
+   cfiscsi_session_terminate(cs);
+   return (true);
+   }
+
+   if (io-scsiio.ext_data_filled != io-scsiio.kern_data_len 
+   (bhsdo-bhsdo_flags  BHSDO_FLAGS_F) != 0) {
+   if ((request-ip_bhs-bhs_opcode  ~ISCSI_BHS_OPCODE_IMMEDIATE) 
==
+   ISCSI_BHS_OPCODE_SCSI_DATA_OUT) {
+   CFISCSI_SESSION_WARN(cs, got the final packet, but the 

+   transmitted size was %zd bytes instead of %d; 
+   dropping connection,
+   (size_t)io-scsiio.ext_data_filled,
+   io-scsiio.kern_data_len);
+   ctl_set_data_phase_error(io-scsiio);
cfiscsi_session_terminate(cs);
return (true);
+   } else {
+   /*
+* For SCSI Command PDU, this just means we need to
+* solicit more data by sending R2T.
+ 

svn commit: r265641 - stable/10/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:08:47 2014
New Revision: 265641
URL: http://svnweb.freebsd.org/changeset/base/265641

Log:
  MFC r264884:
  Make CAM target CTL frontend respect SIM I/O size limitations.
  
  If datamove size is bigger then SIM can handle, or it has more segments
  then this code can handle -- split it into several CTIO requests.

Modified:
  stable/10/sys/cam/ctl/scsi_ctl.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/scsi_ctl.c
==
--- stable/10/sys/cam/ctl/scsi_ctl.cThu May  8 07:07:51 2014
(r265640)
+++ stable/10/sys/cam/ctl/scsi_ctl.cThu May  8 07:08:47 2014
(r265641)
@@ -79,6 +79,7 @@ typedef enum {
 struct ctlfe_softc {
struct ctl_frontend fe;
path_id_t path_id;
+   u_int   maxio;
struct cam_sim *sim;
char port_name[DEV_IDLEN];
struct mtx lun_softc_mtx;
@@ -129,13 +130,15 @@ typedef enum {
  */
 struct ctlfe_lun_cmd_info {
int cur_transfer_index;
+   size_t cur_transfer_off;
ctlfe_cmd_flags flags;
/*
 * XXX KDM struct bus_dma_segment is 8 bytes on i386, and 16
 * bytes on amd64.  So with 32 elements, this is 256 bytes on
 * i386 and 512 bytes on amd64.
 */
-   bus_dma_segment_t cam_sglist[32];
+#define CTLFE_MAX_SEGS 32
+   bus_dma_segment_t cam_sglist[CTLFE_MAX_SEGS];
 };
 
 /*
@@ -375,6 +378,10 @@ ctlfeasync(void *callback_arg, uint32_t 
 
bus_softc-path_id = cpi-ccb_h.path_id;
bus_softc-sim = xpt_path_sim(path);
+   if (cpi-maxio != 0)
+   bus_softc-maxio = cpi-maxio;
+   else
+   bus_softc-maxio = DFLTPHYS;
mtx_init(bus_softc-lun_softc_mtx, LUN softc mtx, NULL,
MTX_DEF);
STAILQ_INIT(bus_softc-lun_softc_list);
@@ -693,6 +700,90 @@ ctlfecleanup(struct cam_periph *periph)
 }
 
 static void
+ctlfedata(struct ctlfe_lun_softc *softc, union ctl_io *io,
+ccb_flags *flags, uint8_t **data_ptr, uint32_t *dxfer_len,
+u_int16_t *sglist_cnt)
+{
+   struct ctlfe_softc *bus_softc;
+   struct ctlfe_lun_cmd_info *cmd_info;
+   struct ctl_sg_entry *ctl_sglist;
+   bus_dma_segment_t *cam_sglist;
+   size_t off;
+   int i, idx;
+
+   cmd_info = (struct ctlfe_lun_cmd_info *)io-io_hdr.port_priv;
+   bus_softc = softc-parent_softc;
+
+   /*
+* Set the direction, relative to the initiator.
+*/
+   *flags = ~CAM_DIR_MASK;
+   if ((io-io_hdr.flags  CTL_FLAG_DATA_MASK) == CTL_FLAG_DATA_IN)
+   *flags |= CAM_DIR_IN;
+   else
+   *flags |= CAM_DIR_OUT;
+
+   *flags = ~CAM_DATA_MASK;
+   idx = cmd_info-cur_transfer_index;
+   off = cmd_info-cur_transfer_off;
+   cmd_info-flags = ~CTLFE_CMD_PIECEWISE;
+   if (io-scsiio.kern_sg_entries == 0) {
+   /* No S/G list. */
+   *data_ptr = io-scsiio.kern_data_ptr + off;
+   if (io-scsiio.kern_data_len - off = bus_softc-maxio) {
+   *dxfer_len = io-scsiio.kern_data_len - off;
+   } else {
+   *dxfer_len = bus_softc-maxio;
+   cmd_info-cur_transfer_index = -1;
+   cmd_info-cur_transfer_off = bus_softc-maxio;
+   cmd_info-flags |= CTLFE_CMD_PIECEWISE;
+   }
+   *sglist_cnt = 0;
+
+   if (io-io_hdr.flags  CTL_FLAG_BUS_ADDR)
+   *flags |= CAM_DATA_PADDR;
+   else
+   *flags |= CAM_DATA_VADDR;
+   } else {
+   /* S/G list with physical or virtual pointers. */
+   ctl_sglist = (struct ctl_sg_entry *)io-scsiio.kern_data_ptr;
+   cam_sglist = cmd_info-cam_sglist;
+   *dxfer_len = 0;
+   for (i = 0; i  io-scsiio.kern_sg_entries - idx; i++) {
+   cam_sglist[i].ds_addr = (bus_addr_t)ctl_sglist[i + 
idx].addr + off;
+   if (ctl_sglist[i + idx].len - off = bus_softc-maxio - 
*dxfer_len) {
+   cam_sglist[i].ds_len = ctl_sglist[idx + i].len 
- off;
+   *dxfer_len += cam_sglist[i].ds_len;
+   } else {
+   cam_sglist[i].ds_len = bus_softc-maxio - 
*dxfer_len;
+   cmd_info-cur_transfer_index = idx + i;
+   cmd_info-cur_transfer_off = 
cam_sglist[i].ds_len + off;
+   cmd_info-flags |= CTLFE_CMD_PIECEWISE;
+   *dxfer_len += cam_sglist[i].ds_len;
+   if (ctl_sglist[i].len != 0)
+   i++;
+   break;
+   }
+   if 

svn commit: r265642 - stable/10/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:10:38 2014
New Revision: 265642
URL: http://svnweb.freebsd.org/changeset/base/265642

Log:
  MFC r264886:
  Remove limits on size of READ/WRITE operations.
  
  Instead of allocating up to 16MB or RAM at once to handle whole I/O,
  allocate up to 1MB at a time, but do multiple ctl_datamove() and storage
  I/Os if needed.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_backend_block.c
  stable/10/sys/cam/ctl/ctl_backend_ramdisk.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==
--- stable/10/sys/cam/ctl/ctl.c Thu May  8 07:08:47 2014(r265641)
+++ stable/10/sys/cam/ctl/ctl.c Thu May  8 07:10:38 2014(r265642)
@@ -9534,7 +9534,7 @@ ctl_inquiry_evpd_block_limits(struct ctl
 
bl_ptr-page_code = SVPD_BLOCK_LIMITS;
scsi_ulto2b(sizeof(*bl_ptr), bl_ptr-page_length);
-   scsi_ulto4b((16 * 1024 * 1024) / bs, bl_ptr-max_txfer_len);
+   scsi_ulto4b(0x, bl_ptr-max_txfer_len);
scsi_ulto4b(MAXPHYS / bs, bl_ptr-opt_txfer_len);
if (lun-be_lun-flags  CTL_LUN_FLAG_UNMAP) {
scsi_ulto4b(0x, bl_ptr-max_unmap_lba_cnt);

Modified: stable/10/sys/cam/ctl/ctl_backend_block.c
==
--- stable/10/sys/cam/ctl/ctl_backend_block.c   Thu May  8 07:08:47 2014
(r265641)
+++ stable/10/sys/cam/ctl/ctl_backend_block.c   Thu May  8 07:10:38 2014
(r265642)
@@ -91,11 +91,12 @@ __FBSDID($FreeBSD$);
 #include cam/ctl/ctl_error.h
 
 /*
- * The idea here is that we'll allocate enough S/G space to hold a 16MB
- * I/O.  If we get an I/O larger than that, we'll reject it.
+ * The idea here is that we'll allocate enough S/G space to hold a 1MB
+ * I/O.  If we get an I/O larger than that, we'll split it.
  */
-#defineCTLBLK_MAX_IO_SIZE  (16 * 1024 * 1024)
-#defineCTLBLK_MAX_SEGS (CTLBLK_MAX_IO_SIZE / MAXPHYS) + 1
+#defineCTLBLK_MAX_IO_SIZE  (1024 * 1024)
+#defineCTLBLK_MAX_SEG  MAXPHYS
+#defineCTLBLK_MAX_SEGS MAX(CTLBLK_MAX_IO_SIZE / 
CTLBLK_MAX_SEG, 1)
 
 #ifdef CTLBLK_DEBUG
 #define DPRINTF(fmt, args...) \
@@ -500,14 +501,6 @@ ctl_be_block_biodone(struct bio *bio)
ctl_set_success(io-scsiio);
ctl_complete_beio(beio);
} else {
-   io-scsiio.be_move_done = ctl_be_block_move_done;
-   io-scsiio.kern_data_ptr = (uint8_t *)beio-sg_segs;
-   io-scsiio.kern_data_len = beio-io_len;
-   io-scsiio.kern_total_len = beio-io_len;
-   io-scsiio.kern_rel_offset = 0;
-   io-scsiio.kern_data_resid = 0;
-   io-scsiio.kern_sg_entries = beio-num_segs;
-   io-io_hdr.flags |= CTL_FLAG_ALLOCATED | CTL_FLAG_KDPTR_SGLIST;
 #ifdef CTL_TIME_IO
getbintime(io-io_hdr.dma_start_bt);
 #endif  
@@ -707,14 +700,6 @@ ctl_be_block_dispatch_file(struct ctl_be
ctl_complete_beio(beio);
} else {
SDT_PROBE(cbb, kernel, read, file_done, 0, 0, 0, 0, 0);
-   io-scsiio.be_move_done = ctl_be_block_move_done;
-   io-scsiio.kern_data_ptr = (uint8_t *)beio-sg_segs;
-   io-scsiio.kern_data_len = beio-io_len;
-   io-scsiio.kern_total_len = beio-io_len;
-   io-scsiio.kern_rel_offset = 0;
-   io-scsiio.kern_data_resid = 0;
-   io-scsiio.kern_sg_entries = beio-num_segs;
-   io-io_hdr.flags |= CTL_FLAG_ALLOCATED | CTL_FLAG_KDPTR_SGLIST;
 #ifdef CTL_TIME_IO
getbintime(io-io_hdr.dma_start_bt);
 #endif  
@@ -1014,7 +999,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
/*
 * Setup the S/G entry for this chunk.
 */
-   seglen = MIN(MAXPHYS, len_left);
+   seglen = MIN(CTLBLK_MAX_SEG, len_left);
seglen -= seglen % be_lun-blocksize;
beio-sg_segs[i].len = seglen;
beio-sg_segs[i].addr = uma_zalloc(be_lun-lun_zone, M_WAITOK);
@@ -1167,13 +1152,44 @@ SDT_PROBE_DEFINE1(cbb, kernel, read, all
 SDT_PROBE_DEFINE1(cbb, kernel, write, alloc_done, uint64_t);
 
 static void
+ctl_be_block_next(struct ctl_be_block_io *beio)
+{
+   struct ctl_be_block_lun *be_lun;
+   union ctl_io *io;
+
+   io = beio-io;
+   be_lun = beio-lun;
+   ctl_free_beio(beio);
+   if (((io-io_hdr.status  CTL_STATUS_MASK) != CTL_STATUS_NONE)
+  ((io-io_hdr.status  CTL_STATUS_MASK) != CTL_SUCCESS)) {
+   ctl_done(io);
+   return;
+   }
+
+   io-scsiio.kern_rel_offset += io-scsiio.kern_data_len;
+   io-io_hdr.status = ~CTL_STATUS_MASK;
+   io-io_hdr.status |= CTL_STATUS_NONE;
+
+   mtx_lock(be_lun-lock);
+   /*
+* XXX KDM make sure that links 

svn commit: r265643 - stable/10/sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:12:06 2014
New Revision: 265643
URL: http://svnweb.freebsd.org/changeset/base/265643

Log:
  MFC r265150:
  Do not reread SCSI disk VPD pages on every device open.
  
  Instead of rereading VPD pages on every device open, do it only on initial
  device probe, and in cases when device reported via UNIT ATTENTIONs that
  something has changed.  Capacity is still rereaded on every open because
  it is more critical for operation and more probable to change in run time.
  
  On my tests with Intel 530 SSDs on mps(4) HBA this change reduces time
  GEOM needs to retaste the device (that includes few open/close cycles)
  from ~150ms to ~30ms.

Modified:
  stable/10/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_da.c
==
--- stable/10/sys/cam/scsi/scsi_da.cThu May  8 07:10:38 2014
(r265642)
+++ stable/10/sys/cam/scsi/scsi_da.cThu May  8 07:12:06 2014
(r265643)
@@ -90,7 +90,8 @@ typedef enum {
DA_FLAG_SCTX_INIT   = 0x200,
DA_FLAG_CAN_RC16= 0x400,
DA_FLAG_PROBED  = 0x800,
-   DA_FLAG_DIRTY   = 0x1000
+   DA_FLAG_DIRTY   = 0x1000,
+   DA_FLAG_ANNOUNCED   = 0x2000
 } da_flags;
 
 typedef enum {
@@ -1658,10 +1659,18 @@ daasync(void *callback_arg, u_int32_t co
 error_code, sense_key, asc, ascq)) {
if (asc == 0x2A  ascq == 0x09) {
xpt_print(ccb-ccb_h.path,
-   capacity data has changed\n);
+   Capacity data has changed\n);
+   softc-flags = ~DA_FLAG_PROBED;
dareprobe(periph);
-   } else if (asc == 0x28  ascq == 0x00)
+   } else if (asc == 0x28  ascq == 0x00) {
+   softc-flags = ~DA_FLAG_PROBED;
disk_media_changed(softc-disk, M_NOWAIT);
+   } else if (asc == 0x3F  ascq == 0x03) {
+   xpt_print(ccb-ccb_h.path,
+   INQUIRY data has changed\n);
+   softc-flags = ~DA_FLAG_PROBED;
+   dareprobe(periph);
+   }
}
cam_periph_async(periph, code, path, arg);
break;
@@ -1891,7 +1900,7 @@ daprobedone(struct cam_periph *periph, u
 
dadeletemethodchoose(softc, DA_DELETE_NONE);
 
-   if (bootverbose  (softc-flags  DA_FLAG_PROBED) == 0) {
+   if (bootverbose  (softc-flags  DA_FLAG_ANNOUNCED) == 0) {
char buf[80];
int i, sep;
 
@@ -1932,10 +1941,11 @@ daprobedone(struct cam_periph *periph, u
 */
xpt_release_ccb(ccb);
softc-state = DA_STATE_NORMAL;
+   softc-flags |= DA_FLAG_PROBED;
daschedule(periph);
wakeup(softc-disk-d_mediasize);
-   if ((softc-flags  DA_FLAG_PROBED) == 0) {
-   softc-flags |= DA_FLAG_PROBED;
+   if ((softc-flags  DA_FLAG_ANNOUNCED) == 0) {
+   softc-flags |= DA_FLAG_ANNOUNCED;
cam_periph_unhold(periph);
} else
cam_periph_release_locked(periph);
@@ -3193,7 +3203,8 @@ dadone(struct cam_periph *periph, union 
}
}
free(csio-data_ptr, M_SCSIDA);
-   if (announce_buf[0] != '\0'  ((softc-flags  DA_FLAG_PROBED) 
== 0)) {
+   if (announce_buf[0] != '\0' 
+   ((softc-flags  DA_FLAG_ANNOUNCED) == 0)) {
/*
 * Create our sysctl variables, now that we know
 * we have successfully attached.
@@ -3211,6 +3222,12 @@ dadone(struct cam_periph *periph, union 
}
}
 
+   /* We already probed the device. */
+   if (softc-flags  DA_FLAG_PROBED) {
+   daprobedone(periph, done_ccb);
+   return;
+   }
+
/* Ensure re-probe doesn't see old delete. */
softc-delete_available = 0;
if (lbp  (softc-quirks  DA_Q_NO_UNMAP) == 0) {
@@ -3528,13 +3545,21 @@ daerror(union ccb *ccb, u_int32_t cam_fl
 */
else if (sense_key == SSD_KEY_UNIT_ATTENTION 
asc == 0x2A  ascq == 0x09) {
-   xpt_print(periph-path, capacity data has changed\n);
+   xpt_print(periph-path, Capacity data has changed\n);
+   softc-flags = ~DA_FLAG_PROBED;
dareprobe(periph);
sense_flags |= SF_NO_PRINT;
} else if (sense_key == SSD_KEY_UNIT_ATTENTION 
-   

svn commit: r265644 - stable/10/sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:13:22 2014
New Revision: 265644
URL: http://svnweb.freebsd.org/changeset/base/265644

Log:
  MFC r265159:
  Respect MAXIMUM TRANSFER LENGTH field of Block Limits VPD page.
  
  Nobody yet reported disk supporting I/Os less then our MAXPHYS value, but
  since we any way have code to read Block Limits VPD page, that is easy.

Modified:
  stable/10/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/scsi/scsi_da.c
==
--- stable/10/sys/cam/scsi/scsi_da.cThu May  8 07:12:06 2014
(r265643)
+++ stable/10/sys/cam/scsi/scsi_da.cThu May  8 07:13:22 2014
(r265644)
@@ -212,6 +212,7 @@ struct da_softc {
int  trim_max_ranges;
int  delete_running;
int  delete_available;  /* Delete methods possibly available */
+   u_intmaxio;
uint32_tunmap_max_ranges;
uint32_tunmap_max_lba; /* Max LBAs in UNMAP req */
uint64_tws_max_blks;
@@ -2135,11 +2136,12 @@ daregister(struct cam_periph *periph, vo
softc-disk-d_name = da;
softc-disk-d_drv1 = periph;
if (cpi.maxio == 0)
-   softc-disk-d_maxsize = DFLTPHYS;  /* traditional default 
*/
+   softc-maxio = DFLTPHYS;/* traditional default */
else if (cpi.maxio  MAXPHYS)
-   softc-disk-d_maxsize = MAXPHYS;   /* for safety */
+   softc-maxio = MAXPHYS; /* for safety */
else
-   softc-disk-d_maxsize = cpi.maxio;
+   softc-maxio = cpi.maxio;
+   softc-disk-d_maxsize = softc-maxio;
softc-disk-d_unit = periph-unit_number;
softc-disk-d_flags = DISKFLAG_DIRECT_COMPLETION;
if ((softc-quirks  DA_Q_NO_SYNC_CACHE) == 0)
@@ -3279,14 +3281,6 @@ dadone(struct cam_periph *periph, union 
 (lbp-flags  SVPD_LBP_WS10));
dadeleteflag(softc, DA_DELETE_UNMAP,
 (lbp-flags  SVPD_LBP_UNMAP));
-
-   if (lbp-flags  SVPD_LBP_UNMAP) {
-   free(lbp, M_SCSIDA);
-   xpt_release_ccb(done_ccb);
-   softc-state = DA_STATE_PROBE_BLK_LIMITS;
-   xpt_schedule(periph, priority);
-   return;
-   }
} else {
int error;
error = daerror(done_ccb, CAM_RETRY_SELTO,
@@ -3312,7 +3306,7 @@ dadone(struct cam_periph *periph, union 
 
free(lbp, M_SCSIDA);
xpt_release_ccb(done_ccb);
-   softc-state = DA_STATE_PROBE_BDC;
+   softc-state = DA_STATE_PROBE_BLK_LIMITS;
xpt_schedule(periph, priority);
return;
}
@@ -3323,12 +3317,20 @@ dadone(struct cam_periph *periph, union 
block_limits = (struct scsi_vpd_block_limits *)csio-data_ptr;
 
if ((csio-ccb_h.status  CAM_STATUS_MASK) == CAM_REQ_CMP) {
+   uint32_t max_txfer_len = scsi_4btoul(
+   block_limits-max_txfer_len);
uint32_t max_unmap_lba_cnt = scsi_4btoul(
block_limits-max_unmap_lba_cnt);
uint32_t max_unmap_blk_cnt = scsi_4btoul(
block_limits-max_unmap_blk_cnt);
uint64_t ws_max_blks = scsi_8btou64(
block_limits-max_write_same_length);
+
+   if (max_txfer_len != 0) {
+   softc-disk-d_maxsize = MIN(softc-maxio,
+   (off_t)max_txfer_len * 
softc-params.secsize);
+   }
+
/*
 * We should already support UNMAP but we check lba
 * and block count to be sure
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265472 - head/bin/dd

2014-05-08 Thread Bruce Evans

On Wed, 7 May 2014, Alan Somers wrote:


On Tue, May 6, 2014 at 9:47 PM, Bruce Evans b...@optusnet.com.au wrote:

On Tue, 6 May 2014, Alan Somers wrote:


This is about some minor details that I didn't reply to for later followups.


+   if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv))
+   err(EX_OSERR, clock_gettime);
+   if (clock_getres(CLOCK_MONOTONIC_PRECISE, tv_res))
+   err(EX_OSERR, clock_getres);



clock_getres() is almost useless, and is useless here.  It is broken
as designed, since the precision may be less than 1 nanosecond but
1 nanosecond is the smallest positive representable value, but that
is not a problem here since clock_gettime() also can't distinguish
differences smaller than 1 nanosecond.


Since it's reporting the clock resolution and not precision, and since
clock_gettime() only reports with 1ns resolution, I don't think it's a
problem for clock_getres to report with 1ns resolution too.


I got most of the backwardness backwards.  The syscall is clock_getres(),
not clock_getprec(), and the variable name matches this.  But what it
returns is the precision.  The resolution is just that of a timespec (1
nanosecond).  No API is needed to report this.  APIs are needed to report:
- the precision.  The API is misnamed clock_getres()
- the granularity.  This is the minimum time between successive measurements.
   It can be determined by actually doing some measurements.
- the accuracy.  No API is available
For clocks based on timecounters, we use time timecounter clock period
rounded up to nanoseconds for the precision.  With a TSC, this is always
1 nanosecond above 1GHz.

dd needs more like the granularity than the precision, but it doesn't
really matter since the runtime must be much larger than the granularity
for the statistics to be accurate, and usually is.


The fixup is now only reachable in 3 cases that can't happen:
- when the monotonic time goes backwards due to a kernel bug
- when the monotonic time doesn't increase, so that the difference is 0.
  Oops, this can happen for timecounters with very low precision.
  You don't need to know the precision to check for this.


On my Xeon E5504 systems, I can see adjacent calls to clock_gettime
return equal values when using one of the _FAST clocks.  It can't be
proven that this case will never happen with any other clock either,
so the program needs to handle it.


Hrmph.  This is either from the design error of the existence of the
_FAST clocks, or from the design error of the existence of TSC-low.

First, the _FAST clocks are only supposed to have a resolution of 1/hz.
clock_getres() is quite broken here.  It returns the timecounter
precision for the _FAST clocks too.  Also, if it returned 1/hz, then
it would be inconsistent with the libc implementation of
clock_gettime().  The latter gives gives the timecounter precision.

TSC-low intentionally destroys the hardware TSC precision by right shifting,
due to FUD and to handle a minor problem above 4GHz.  The shift used to
be excessive in most cases.  On freefall it used to be about 7, so the
precision of ~1/2.67 nsec was reduced to ~48 nsec.  This was easy to
see in tests programs for such things.  Now the shift is just 1.
Since 11 is less than 2.67, the loss of precision from the shift is
less than the loss of precision from converting from bintimes to
timespecs.  The shift is still a pessimization.

sysctl has a read-only tunable kern.timecounter.tsc_shift.  Use of this
seems to be quite broken.  The shift count is determined dynamically,
and the tunable barely effects this.  The active shift count is not
written back to the tunable, so you can't see what it is easy.  However,
the shift count is now always 1 except in exceptional cases.  The tunable
defaults to 1.  This is for CPU speeds between 2GHz and 4GHz to implement
the support for the FUD at these speeds.  Above 4GHz, the shift is increased
to 2 without changing the tunable.  Above 8GHz, the shift is increased to
3.  That can't happen yet, but you can tune higher to get a higher
shift count at lower speeds.  You can also tune to 0 to avoid the shift
up to 4GHz.

The shift together with some fencing pessimizations that are not even done
in the kernel version (only libc) is due to FUD.  rdtsc is not a serializing
instruction, so its direct use may give surprising results.  I think it
is serialized with respect to itself on the same CPU.  It is obviously
not serialized with respect to other instructions on the same CPU.  So
it doesn't work properly in code like rdtsc; save results; v++; rdtsc;
compare results even with quite a bit more than v++ between the rdtsc's.
Normally there is much more than v++ between rdtsc's so code like this
works well in practice.  When the rdtsc's are on separate CPUs, it is
just a bug to depend on their order unless there are synchronization
instructions for more than the rdtsc's.

The old kernel code is sloppy about such things.  It tries to do
everything without 

Re: svn commit: r265472 - head/bin/dd

2014-05-08 Thread Bruce Evans

On Wed, 7 May 2014, Alan Somers wrote:


On Tue, May 6, 2014 at 9:47 PM, Bruce Evans b...@optusnet.com.au wrote:

On Tue, 6 May 2014, Alan Somers wrote:


This is about some minor details that I didn't reply to for later followups.


+   if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv))
+   err(EX_OSERR, clock_gettime);
+   if (clock_getres(CLOCK_MONOTONIC_PRECISE, tv_res))
+   err(EX_OSERR, clock_getres);



clock_getres() is almost useless, and is useless here.  It is broken
as designed, since the precision may be less than 1 nanosecond but
1 nanosecond is the smallest positive representable value, but that
is not a problem here since clock_gettime() also can't distinguish
differences smaller than 1 nanosecond.


Since it's reporting the clock resolution and not precision, and since
clock_gettime() only reports with 1ns resolution, I don't think it's a
problem for clock_getres to report with 1ns resolution too.


I got most of the backwardness backwards.  The syscall is clock_getres(),
not clock_getprec(), and the variable name matches this.  But what it
returns is the precision.  The resolution is just that of a timespec (1
nanosecond).  No API is needed to report this.  APIs are needed to report:
- the precision.  The API is misnamed clock_getres()
- the granularity.  This is the minimum time between successive measurements.
  It can be determined by actually doing some measurements.
- the accuracy.  No API is available
For clocks based on timecounters, we use time timecounter clock period
rounded up to nanoseconds for the precision.  With a TSC, this is always
1 nanosecond above 1GHz.

dd needs more like the granularity than the precision, but it doesn't
really matter since the runtime must be much larger than the granularity
for the statistics to be accurate, and usually is.


The fixup is now only reachable in 3 cases that can't happen:
- when the monotonic time goes backwards due to a kernel bug
- when the monotonic time doesn't increase, so that the difference is 0.
  Oops, this can happen for timecounters with very low precision.
  You don't need to know the precision to check for this.


On my Xeon E5504 systems, I can see adjacent calls to clock_gettime
return equal values when using one of the _FAST clocks.  It can't be
proven that this case will never happen with any other clock either,
so the program needs to handle it.


Hrmph.  This is either from the design error of the existence of the
_FAST clocks, or from the design error of the existence of TSC-low.

First, the _FAST clocks are only supposed to have a resolution of 1/hz.
clock_getres() is quite broken here.  It returns the timecounter
precision for the _FAST clocks too.  Also, if it returned 1/hz, then
it would be inconsistent with the libc implementation of
clock_gettime().  The latter gives gives the timecounter precision.

TSC-low intentionally destroys the hardware TSC precision by right shifting,
due to FUD and to handle a minor problem above 4GHz.  The shift used to
be excessive in most cases.  On freefall it used to be about 7, so the
precision of ~1/2.67 nsec was reduced to ~48 nsec.  This was easy to
see in tests programs for such things.  Now the shift is just 1.
Since 11 is less than 2.67, the loss of precision from the shift is
less than the loss of precision from converting from bintimes to
timespecs.  The shift is still a pessimization.

sysctl has a read-only tunable kern.timecounter.tsc_shift.  Use of this
seems to be quite broken.  The shift count is determined dynamically,
and the tunable barely effects this.  The active shift count is not
written back to the tunable, so you can't see what it is easy.  However,
the shift count is now always 1 except in exceptional cases.  The tunable
defaults to 1.  This is for CPU speeds between 2GHz and 4GHz to implement
the support for the FUD at these speeds.  Above 4GHz, the shift is increased
to 2 without changing the tunable.  Above 8GHz, the shift is increased to
3.  That can't happen yet, but you can tune higher to get a higher
shift count at lower speeds.  You can also tune to 0 to avoid the shift
up to 4GHz.

The shift together with some fencing pessimizations that are not even done
in the kernel version (only libc) is due to FUD.  rdtsc is not a serializing
instruction, so its direct use may give surprising results.  I think it
is serialized with respect to itself on the same CPU.  It is obviously
not serialized with respect to other instructions on the same CPU.  So
it doesn't work properly in code like rdtsc; save results; v++; rdtsc;
compare results even with quite a bit more than v++ between the rdtsc's.
Normally there is much more than v++ between rdtsc's so code like this
works well in practice.  When the rdtsc's are on separate CPUs, it is
just a bug to depend on their order unless there are synchronization
instructions for more than the rdtsc's.

The old kernel code is sloppy about such things.  It tries to do
everything without 

svn commit: r265645 - in stable/9: . sys

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 07:56:05 2014
New Revision: 265645
URL: http://svnweb.freebsd.org/changeset/base/265645

Log:
  MFC r244015 (by ken):
  Fix the CTL OOA queue dumping code so that it does not hold a mutex
  while doing a copyout.  That can cause a panic, because copyout
  can trigger VM faults, and we can't handle VM faults while holding
  a mutex.
  
  The solution here is to malloc a separate buffer to hold the OOA
  queue entries, so that we don't risk a VM fault while filling up
  the buffer and we don't have to drop the lock.  The other solution
  would be to wire the user's memory while filling their buffer with
  copyout, but that would have been a little more complex.
  
  Also fix a debugging parenthesis issue in ctl_abort_task() pointed
  out by Chuck Tuffli.

Modified:
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265646 - stable/9/sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:08:24 2014
New Revision: 265646
URL: http://svnweb.freebsd.org/changeset/base/265646

Log:
  MFC r255043 (by ken):
  Bump up the default timeouts for move commands in the ch(4) driver
  to 15 minutes, and 5 minutes for things like READ ELEMENT STATUS.
  
  This is needed to account for the worst case scenarios on at least
  some Spectra Logic tape libraries.

Modified:
  stable/9/sys/cam/scsi/scsi_ch.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/scsi/scsi_ch.c
==
--- stable/9/sys/cam/scsi/scsi_ch.c Thu May  8 07:56:05 2014
(r265645)
+++ stable/9/sys/cam/scsi/scsi_ch.c Thu May  8 08:08:24 2014
(r265646)
@@ -99,10 +99,10 @@ __FBSDID($FreeBSD$);
  */
 
 static const u_int32_t CH_TIMEOUT_MODE_SENSE= 6000;
-static const u_int32_t CH_TIMEOUT_MOVE_MEDIUM   = 10;
-static const u_int32_t CH_TIMEOUT_EXCHANGE_MEDIUM   = 10;
-static const u_int32_t CH_TIMEOUT_POSITION_TO_ELEMENT   = 10;
-static const u_int32_t CH_TIMEOUT_READ_ELEMENT_STATUS   = 6;
+static const u_int32_t CH_TIMEOUT_MOVE_MEDIUM   = 15 * 60 * 1000;
+static const u_int32_t CH_TIMEOUT_EXCHANGE_MEDIUM   = 15 * 60 * 1000;
+static const u_int32_t CH_TIMEOUT_POSITION_TO_ELEMENT   = 15 * 60 * 1000;
+static const u_int32_t CH_TIMEOUT_READ_ELEMENT_STATUS   = 5 * 60 * 1000;
 static const u_int32_t CH_TIMEOUT_SEND_VOLTAG   = 1;
 static const u_int32_t CH_TIMEOUT_INITIALIZE_ELEMENT_STATUS = 50;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265647 - in stable/9/sys/cam: ata scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:11:44 2014
New Revision: 265647
URL: http://svnweb.freebsd.org/changeset/base/265647

Log:
  MFC r256547 (by smh):
  Added 4K quirks for Corsair Neutron GTX SSD's

Modified:
  stable/9/sys/cam/ata/ata_da.c
  stable/9/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ata/ata_da.c
==
--- stable/9/sys/cam/ata/ata_da.c   Thu May  8 08:08:24 2014
(r265646)
+++ stable/9/sys/cam/ata/ata_da.c   Thu May  8 08:11:44 2014
(r265647)
@@ -293,6 +293,14 @@ static struct ada_quirk_entry ada_quirk_
},
{
/*
+* Corsair Neutron GTX SSDs
+* 4k optimised  trim only works in 4k requests + 4k aligned
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, *, Corsair Neutron GTX*, * },
+   /*quirks*/ADA_Q_4K
+   },
+   {
+   /*
 * Corsair Force GT SSDs
 * 4k optimised  trim only works in 4k requests + 4k aligned
 */

Modified: stable/9/sys/cam/scsi/scsi_da.c
==
--- stable/9/sys/cam/scsi/scsi_da.c Thu May  8 08:08:24 2014
(r265646)
+++ stable/9/sys/cam/scsi/scsi_da.c Thu May  8 08:11:44 2014
(r265647)
@@ -956,6 +956,14 @@ static struct da_quirk_entry da_quirk_ta
{ T_DIRECT, SIP_MEDIA_FIXED, ATA, Corsair Force 3*, * },
/*quirks*/DA_Q_4K
},
+{
+   /*
+* Corsair Neutron GTX SSDs
+* 4k optimised  trim only works in 4k requests + 4k aligned
+*/
+   { T_DIRECT, SIP_MEDIA_FIXED, *, Corsair Neutron GTX*, * },
+   /*quirks*/DA_Q_4K
+   },
{
/*
 * Corsair Force GT SSDs
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265648 - stable/9/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:15:42 2014
New Revision: 265648
URL: http://svnweb.freebsd.org/changeset/base/265648

Log:
  MFC r257946:
  Introduce seperate mutex lock to protect protect CTL I/O pools, slightly
  reducing global CTL lock scope and congestion.
  
  While there, simplify CTL I/O pools KPI, hiding implementation details.

Modified:
  stable/9/sys/cam/ctl/ctl.c
  stable/9/sys/cam/ctl/ctl_frontend.c
  stable/9/sys/cam/ctl/ctl_private.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl.c
==
--- stable/9/sys/cam/ctl/ctl.c  Thu May  8 08:11:44 2014(r265647)
+++ stable/9/sys/cam/ctl/ctl.c  Thu May  8 08:15:42 2014(r265648)
@@ -364,7 +364,6 @@ static union ctl_io *ctl_malloc_io(ctl_i
   int can_wait);
 static void ctl_kfree_io(union ctl_io *io);
 #endif /* unused */
-static void ctl_free_io_internal(union ctl_io *io, int have_lock);
 static int ctl_alloc_lun(struct ctl_softc *ctl_softc, struct ctl_lun *lun,
 struct ctl_be_lun *be_lun, struct ctl_id target_id);
 static int ctl_free_lun(struct ctl_lun *lun);
@@ -1001,6 +1000,7 @@ ctl_init(void)
   Report no lun possible for invalid LUNs);
 
mtx_init(softc-ctl_lock, CTL mutex, NULL, MTX_DEF);
+   mtx_init(softc-pool_lock, CTL pool mutex, NULL, MTX_DEF);
softc-open_count = 0;
 
/*
@@ -1060,7 +1060,7 @@ ctl_init(void)
CTL_POOL_ENTRIES_EMERGENCY, emergency_pool) != 0) {
printf(ctl: can't allocate %d entry emergency pool, 
   exiting\n, CTL_POOL_ENTRIES_EMERGENCY);
-   ctl_pool_free(softc, internal_pool);
+   ctl_pool_free(internal_pool);
return (ENOMEM);
}
 
@@ -1069,8 +1069,8 @@ ctl_init(void)
{
printf(ctl: can't allocate %d entry other SC pool, 
   exiting\n, CTL_POOL_ENTRIES_OTHER_SC);
-   ctl_pool_free(softc, internal_pool);
-   ctl_pool_free(softc, emergency_pool);
+   ctl_pool_free(internal_pool);
+   ctl_pool_free(emergency_pool);
return (ENOMEM);
}
 
@@ -1078,12 +1078,6 @@ ctl_init(void)
softc-emergency_pool = emergency_pool;
softc-othersc_pool = other_pool;
 
-   mtx_lock(softc-ctl_lock);
-   ctl_pool_acquire(internal_pool);
-   ctl_pool_acquire(emergency_pool);
-   ctl_pool_acquire(other_pool);
-   mtx_unlock(softc-ctl_lock);
-
/*
 * We used to allocate a processor LUN here.  The new scheme is to
 * just let the user allocate LUNs as he sees fit.
@@ -1100,10 +1094,10 @@ ctl_init(void)
printf(error creating CTL work thread!\n);
mtx_lock(softc-ctl_lock);
ctl_free_lun(lun);
-   ctl_pool_free(softc, internal_pool);
-   ctl_pool_free(softc, emergency_pool);
-   ctl_pool_free(softc, other_pool);
mtx_unlock(softc-ctl_lock);
+   ctl_pool_free(internal_pool);
+   ctl_pool_free(emergency_pool);
+   ctl_pool_free(other_pool);
return (error);
}
printf(ctl: CAM Target Layer loaded\n);
@@ -1156,7 +1150,7 @@ ctl_shutdown(void)
 {
struct ctl_softc *softc;
struct ctl_lun *lun, *next_lun;
-   struct ctl_io_pool *pool, *next_pool;
+   struct ctl_io_pool *pool;
 
softc = (struct ctl_softc *)control_softc;
 
@@ -1173,6 +1167,8 @@ ctl_shutdown(void)
ctl_free_lun(lun);
}
 
+   mtx_unlock(softc-ctl_lock);
+
/*
 * This will rip the rug out from under any FETDs or anyone else
 * that has a pool allocated.  Since we increment our module
@@ -1181,18 +1177,14 @@ ctl_shutdown(void)
 * able to unload the CTL module until client modules have
 * successfully unloaded.
 */
-   for (pool = STAILQ_FIRST(softc-io_pools); pool != NULL;
-pool = next_pool) {
-   next_pool = STAILQ_NEXT(pool, links);
-   ctl_pool_free(softc, pool);
-   }
-
-   mtx_unlock(softc-ctl_lock);
+   while ((pool = STAILQ_FIRST(softc-io_pools)) != NULL)
+   ctl_pool_free(pool);
 
 #if 0
ctl_shutdown_thread(softc-work_thread);
 #endif
 
+   mtx_destroy(softc-pool_lock);
mtx_destroy(softc-ctl_lock);
 
destroy_dev(softc-dev);
@@ -3342,11 +3334,12 @@ ctl_pool_create(struct ctl_softc *ctl_so
pool-type = pool_type;
pool-ctl_softc = ctl_softc;
 
-   mtx_lock(ctl_softc-ctl_lock);
+   mtx_lock(ctl_softc-pool_lock);
pool-id = ctl_softc-cur_pool_id++;
-   mtx_unlock(ctl_softc-ctl_lock);
+   mtx_unlock(ctl_softc-pool_lock);
 
pool-flags = CTL_POOL_FLAG_NONE;
+   

svn commit: r265650 - stable/10/cddl/contrib/opensolaris/cmd/zfs

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:17:12 2014
New Revision: 265650
URL: http://svnweb.freebsd.org/changeset/base/265650

Log:
  MFC r264851
  
  Eliminated optarg global being used outside of the function which called 
getopt
  
  Sponsored by: Multiplay

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

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu May  8 
08:17:04 2014(r265649)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c   Thu May  8 
08:17:12 2014(r265650)
@@ -495,9 +495,8 @@ usage(boolean_t requested)
 }
 
 static int
-parseprop(nvlist_t *props)
+parseprop(nvlist_t *props, char *propname)
 {
-   char *propname = optarg;
char *propval, *strval;
 
if ((propval = strchr(propname, '=')) == NULL) {
@@ -526,7 +525,7 @@ parse_depth(char *opt, int *flags)
depth = (int)strtol(opt, tmp, 0);
if (*tmp) {
(void) fprintf(stderr,
-   gettext(%s is not an integer\n), optarg);
+   gettext(%s is not an integer\n), opt);
usage(B_FALSE);
}
if (depth  0) {
@@ -617,7 +616,7 @@ zfs_do_clone(int argc, char **argv)
while ((c = getopt(argc, argv, o:p)) != -1) {
switch (c) {
case 'o':
-   if (parseprop(props))
+   if (parseprop(props, optarg))
return (1);
break;
case 'p':
@@ -767,7 +766,7 @@ zfs_do_create(int argc, char **argv)
nomem();
break;
case 'o':
-   if (parseprop(props))
+   if (parseprop(props, optarg))
goto error;
break;
case 's':
@@ -3636,7 +3635,7 @@ zfs_do_snapshot(int argc, char **argv)
while ((c = getopt(argc, argv, ro:)) != -1) {
switch (c) {
case 'o':
-   if (parseprop(props))
+   if (parseprop(props, optarg))
return (1);
break;
case 'r':
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265649 - stable/9/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:17:04 2014
New Revision: 265649
URL: http://svnweb.freebsd.org/changeset/base/265649

Log:
  MFC r258871:
  Properly report an error instead of panicing when user tries to create
  LUN backed by non-disk device, e.g. /dev/null.

Modified:
  stable/9/sys/cam/ctl/ctl_backend_block.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl_backend_block.c
==
--- stable/9/sys/cam/ctl/ctl_backend_block.cThu May  8 08:15:42 2014
(r265648)
+++ stable/9/sys/cam/ctl/ctl_backend_block.cThu May  8 08:17:04 2014
(r265649)
@@ -1518,6 +1518,7 @@ ctl_be_block_close(struct ctl_be_block_l
vfs_is_locked = VFS_LOCK_GIANT(be_lun-vn-v_mount);
break;
case CTL_BE_BLOCK_NONE:
+   break;
default:
panic(Unexpected backend type.);
break;
@@ -1537,6 +1538,7 @@ ctl_be_block_close(struct ctl_be_block_l
}
break;
case CTL_BE_BLOCK_NONE:
+   break;
default:
panic(Unexpected backend type.);
break;
@@ -1626,7 +1628,7 @@ ctl_be_block_open(struct ctl_be_block_so
} else {
error = EINVAL;
snprintf(req-error_str, sizeof(req-error_str),
-%s is not a disk or file, be_lun-dev_path);
+%s is not a disk or plain file, be_lun-dev_path);
}
VOP_UNLOCK(be_lun-vn, 0);
VFS_UNLOCK_GIANT(vfs_is_locked);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265652 - stable/10/sbin/camcontrol

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:18:48 2014
New Revision: 265652
URL: http://svnweb.freebsd.org/changeset/base/265652

Log:
  MFC r264863
  
  Add information about supported NCQ functionality to camcontrol identify.
  
  Sponsored by: Multiplay

Modified:
  stable/10/sbin/camcontrol/camcontrol.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/camcontrol/camcontrol.c
==
--- stable/10/sbin/camcontrol/camcontrol.c  Thu May  8 08:18:46 2014
(r265651)
+++ stable/10/sbin/camcontrol/camcontrol.c  Thu May  8 08:18:48 2014
(r265652)
@@ -1214,6 +1214,18 @@ atahpa_print(struct ata_params *parm, u_
}
 }
 
+static int
+atasata(struct ata_params *parm)
+{
+
+
+   if (parm-satacapabilities != 0x 
+   parm-satacapabilities != 0x)
+   return 1;
+
+   return 0;
+}
+
 static void
 atacapprint(struct ata_params *parm)
 {
@@ -1370,6 +1382,17 @@ atacapprint(struct ata_params *parm)
ATA_QUEUE_LEN(parm-queue) + 1);
} else
printf(no\n);
+
+   printf(NCQ Queue Management   %s\n, atasata(parm) 
+   parm-satacapabilities2  ATA_SUPPORT_NCQ_QMANAGEMENT ?
+   yes : no);
+   printf(NCQ Streaming  %s\n, atasata(parm) 
+   parm-satacapabilities2  ATA_SUPPORT_NCQ_STREAM ?
+   yes : no);
+   printf(Receive  Send FPDMA Queued%s\n, atasata(parm) 
+   parm-satacapabilities2  ATA_SUPPORT_RCVSND_FPDMA_QUEUED ?
+   yes : no);
+
printf(SMART  %s   %s\n,
parm-support.command1  ATA_SUPPORT_SMART ? yes : no,
parm-enabled.command1  ATA_SUPPORT_SMART ? yes : no);
@@ -1418,6 +1441,9 @@ atacapprint(struct ata_params *parm)
printf(unload %s   %s\n,
parm-support.extension  ATA_SUPPORT_UNLOAD ? yes : no,
parm-enabled.extension  ATA_SUPPORT_UNLOAD ? yes : no);
+   printf(general purpose logging%s   %s\n,
+   parm-support.extension  ATA_SUPPORT_GENLOG ? yes : no,
+   parm-enabled.extension  ATA_SUPPORT_GENLOG ? yes : no);
printf(free-fall  %s   %s\n,
parm-support2  ATA_SUPPORT_FREEFALL ? yes : no,
parm-enabled2  ATA_SUPPORT_FREEFALL ? yes : no);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265651 - stable/9/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:18:46 2014
New Revision: 265651
URL: http://svnweb.freebsd.org/changeset/base/265651

Log:
  MFC r262782 (by trasz):
  Fix missing unlock in persistent reservations code, which resulted in panics
  with Hyper-V Failover Cluster.

Modified:
  stable/9/sys/cam/ctl/ctl.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl.c
==
--- stable/9/sys/cam/ctl/ctl.c  Thu May  8 08:17:12 2014(r265650)
+++ stable/9/sys/cam/ctl/ctl.c  Thu May  8 08:18:46 2014(r265651)
@@ -8043,6 +8043,7 @@ ctl_persistent_reserve_out(struct ctl_sc
ctl_done((union ctl_io *)ctsio);
return (CTL_RETVAL_COMPLETE);
}
+   mtx_unlock(softc-ctl_lock);
} else /* create a reservation */ {
/*
 * If it's not an all registrants type record
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265653 - stable/10/sys/dev/acpica

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:20:23 2014
New Revision: 265653
URL: http://svnweb.freebsd.org/changeset/base/265653

Log:
  MFC r264878
  
  Increase ACPI_MAX_TASKS to be 4 x the number of CPU's as 2 x was still
  insufficient on some machines
  
  Sponsored by: Multiplay

Modified:
  stable/10/sys/dev/acpica/acpivar.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/acpica/acpivar.h
==
--- stable/10/sys/dev/acpica/acpivar.h  Thu May  8 08:18:48 2014
(r265652)
+++ stable/10/sys/dev/acpica/acpivar.h  Thu May  8 08:20:23 2014
(r265653)
@@ -476,7 +476,7 @@ ACPI_HANDLE acpi_GetReference(ACPI_HANDL
 
 /* Default maximum number of tasks to enqueue. */
 #ifndef ACPI_MAX_TASKS
-#defineACPI_MAX_TASKS  MAX(32, MAXCPU * 2)
+#defineACPI_MAX_TASKS  MAX(32, MAXCPU * 4)
 #endif
 
 /* Default number of task queue threads to start. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265654 - in stable/9/sys: cam/ctl conf modules/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:21:52 2014
New Revision: 265654
URL: http://svnweb.freebsd.org/changeset/base/265654

Log:
  MFC r263811 (by trasz):
  Remove ctl_mem_pool.{c,h}.

Deleted:
  stable/9/sys/cam/ctl/ctl_mem_pool.c
  stable/9/sys/cam/ctl/ctl_mem_pool.h
Modified:
  stable/9/sys/cam/ctl/README.ctl.txt
  stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c
  stable/9/sys/cam/ctl/ctl_frontend_internal.c
  stable/9/sys/conf/files
  stable/9/sys/modules/ctl/Makefile
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/modules/   (props changed)

Modified: stable/9/sys/cam/ctl/README.ctl.txt
==
--- stable/9/sys/cam/ctl/README.ctl.txt Thu May  8 08:20:23 2014
(r265653)
+++ stable/9/sys/cam/ctl/README.ctl.txt Thu May  8 08:21:52 2014
(r265654)
@@ -394,14 +394,6 @@ ctl_ioctl.h:
 This defines all ioctls available through the CTL character device, and
 the data structures needed for those ioctls.
 
-ctl_mem_pool.c
-ctl_mem_pool.h:
---
-
-Generic memory pool implementation.  This is currently only used by the
-internal frontend.  The internal frontend can probably be rewritten to use
-UMA zones and this can be removed.
-
 ctl_private.h:
 -
 

Modified: stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c
==
--- stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c Thu May  8 08:20:23 2014
(r265653)
+++ stable/9/sys/cam/ctl/ctl_frontend_cam_sim.c Thu May  8 08:21:52 2014
(r265654)
@@ -65,7 +65,6 @@ __FBSDID($FreeBSD$);
 #include cam/ctl/ctl.h
 #include cam/ctl/ctl_frontend.h
 #include cam/ctl/ctl_frontend_internal.h
-#include cam/ctl/ctl_mem_pool.h
 #include cam/ctl/ctl_debug.h
 
 #defineio_ptr  spriv_ptr1

Modified: stable/9/sys/cam/ctl/ctl_frontend_internal.c
==
--- stable/9/sys/cam/ctl/ctl_frontend_internal.cThu May  8 08:20:23 
2014(r265653)
+++ stable/9/sys/cam/ctl/ctl_frontend_internal.cThu May  8 08:21:52 
2014(r265654)
@@ -62,6 +62,7 @@ __FBSDID($FreeBSD$);
 #include sys/queue.h
 #include sys/sbuf.h
 #include sys/sysctl.h
+#include vm/uma.h
 #include cam/scsi/scsi_all.h
 #include cam/scsi/scsi_da.h
 #include cam/ctl/ctl_io.h
@@ -73,7 +74,6 @@ __FBSDID($FreeBSD$);
 #include cam/ctl/ctl_util.h
 #include cam/ctl/ctl_ha.h
 #include cam/ctl/ctl_private.h
-#include cam/ctl/ctl_mem_pool.h
 #include cam/ctl/ctl_debug.h
 #include cam/ctl/ctl_scsi_all.h
 #include cam/ctl/ctl_error.h
@@ -118,7 +118,6 @@ struct cfi_metatask {
cfi_tasktypetasktype;
cfi_mt_status   status;
union cfi_taskinfo  taskinfo;
-   struct ctl_mem_element  *element;
void*cfi_context;
STAILQ_ENTRY(cfi_metatask) links;
 };
@@ -153,7 +152,6 @@ struct cfi_lun {
int blocksize_powerof2;
uint32_t cur_tag_num;
cfi_lun_state state;
-   struct ctl_mem_element *element;
struct cfi_softc *softc;
STAILQ_HEAD(, cfi_lun_io) io_list;
STAILQ_ENTRY(cfi_lun) links;
@@ -181,12 +179,13 @@ struct cfi_softc {
cfi_flags flags;
STAILQ_HEAD(, cfi_lun) lun_list;
STAILQ_HEAD(, cfi_metatask) metatask_list;
-   struct ctl_mem_pool lun_pool;
-   struct ctl_mem_pool metatask_pool;
 };
 
 MALLOC_DEFINE(M_CTL_CFI, ctlcfi, CTL CFI);
 
+static uma_zone_t cfi_lun_zone;
+static uma_zone_t cfi_metatask_zone;
+
 static struct cfi_softc fetd_internal_softc;
 extern int ctl_disable;
 
@@ -280,48 +279,15 @@ cfi_init(void)
if (ctl_frontend_register(fe, (softc-flags  CTL_FLAG_MASTER_SHELF)) 
!= 0) 
{
printf(%s: internal frontend registration failed\n, __func__);
-   retval = 1;
-   goto bailout;
+   return (0);
}
 
-   if (ctl_init_mem_pool(softc-lun_pool,
- sizeof(struct cfi_lun),
- CTL_MEM_POOL_PERM_GROW, /*grow_inc*/ 3,
- /* initial_pool_size */ CTL_MAX_LUNS) != 0) {
-   printf(%s: can't initialize LUN memory pool\n, __func__);
-   retval = 1;
-   goto bailout_error;
-   }
-
-   if (ctl_init_mem_pool(softc-metatask_pool,
- sizeof(struct cfi_metatask),
- CTL_MEM_POOL_PERM_GROW, /*grow_inc*/ 3,
- /*initial_pool_size*/ 10) != 0) {
-   printf(%s: can't initialize metatask memory pool\n, __func__);
-   retval = 2;
-   goto bailout_error;
-   }
-bailout:
+   cfi_lun_zone = uma_zcreate(cfi_lun, sizeof(struct cfi_lun),
+   NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
+   cfi_metatask_zone = 

svn commit: r265655 - stable/10/sys/dev/acpica/Osd

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:23:24 2014
New Revision: 265655
URL: http://svnweb.freebsd.org/changeset/base/265655

Log:
  MFC r264849  r264883
  
  Exposed debug.acpi.max_tasks and debug.acpi.max_threads via sysctls so their
  values can be viewed.
  
  Sponsored by: Multiplay

Modified:
  stable/10/sys/dev/acpica/Osd/OsdSchedule.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/dev/acpica/Osd/OsdSchedule.c
==
--- stable/10/sys/dev/acpica/Osd/OsdSchedule.c  Thu May  8 08:21:52 2014
(r265654)
+++ stable/10/sys/dev/acpica/Osd/OsdSchedule.c  Thu May  8 08:23:24 2014
(r265655)
@@ -57,6 +57,8 @@ ACPI_MODULE_NAME(SCHEDULE)
  */
 static int acpi_max_tasks = ACPI_MAX_TASKS;
 TUNABLE_INT(debug.acpi.max_tasks, acpi_max_tasks);
+SYSCTL_INT(_debug_acpi, OID_AUTO, max_tasks, CTLFLAG_RDTUN, acpi_max_tasks,
+0, Maximum acpi tasks);
 
 /*
  * Allow the user to tune the number of task threads we start.  It seems
@@ -64,6 +66,8 @@ TUNABLE_INT(debug.acpi.max_tasks, acp
  */
 static int acpi_max_threads = ACPI_MAX_THREADS;
 TUNABLE_INT(debug.acpi.max_threads, acpi_max_threads);
+SYSCTL_INT(_debug_acpi, OID_AUTO, max_threads, CTLFLAG_RDTUN, 
acpi_max_threads,
+0, Maximum acpi threads);
 
 static MALLOC_DEFINE(M_ACPITASK, acpitask, ACPI deferred task);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265656 - stable/9/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:24:08 2014
New Revision: 265656
URL: http://svnweb.freebsd.org/changeset/base/265656

Log:
  MFC r263979 (by trasz):
  Hide CTL messages about SCSI error responses.  Too many users take
  them for actual target errors.  They can be enabled back by setting
  kern.cam.ctl.verbose=1, or booting with bootverbose.

Modified:
  stable/9/sys/cam/ctl/ctl.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl.c
==
--- stable/9/sys/cam/ctl/ctl.c  Thu May  8 08:23:24 2014(r265655)
+++ stable/9/sys/cam/ctl/ctl.c  Thu May  8 08:24:08 2014(r265656)
@@ -324,6 +324,10 @@ SYSCTL_NODE(_kern_cam, OID_AUTO, ctl, CT
 SYSCTL_INT(_kern_cam_ctl, OID_AUTO, disable, CTLFLAG_RDTUN, ctl_disable, 0,
   Disable CTL);
 TUNABLE_INT(kern.cam.ctl.disable, ctl_disable);
+static int verbose = 0;
+TUNABLE_INT(kern.cam.ctl.verbose, verbose);
+SYSCTL_INT(_kern_cam_ctl, OID_AUTO, verbose, CTLFLAG_RWTUN,
+verbose, 0, Show SCSI errors returned to initiator);
 
 /*
  * Serial number (0x80), device id (0x83), and supported pages (0x00)
@@ -12264,7 +12268,8 @@ ctl_process_done(union ctl_io *io, int h
case CTL_IO_SCSI:
break;
case CTL_IO_TASK:
-   ctl_io_error_print(io, NULL);
+   if (bootverbose || verbose  0)
+   ctl_io_error_print(io, NULL);
if (io-io_hdr.flags  CTL_FLAG_FROM_OTHER_SC)
ctl_free_io(io);
else
@@ -12520,7 +12525,8 @@ ctl_process_done(union ctl_io *io, int h
skipped, skipped_prints);
 #endif
}
-   ctl_io_error_print(io, NULL);
+   if (bootverbose || verbose  0)
+   ctl_io_error_print(io, NULL);
}
} else {
if (have_lock == 0)
@@ -12531,7 +12537,8 @@ ctl_process_done(union ctl_io *io, int h
case CTL_IO_TASK:
if (have_lock == 0)
mtx_unlock(ctl_softc-ctl_lock);
-   ctl_io_error_print(io, NULL);
+   if (bootverbose || verbose  0)
+   ctl_io_error_print(io, NULL);
break;
default:
if (have_lock == 0)
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265657 - stable/9/sys/cam/ctl

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:25:27 2014
New Revision: 265657
URL: http://svnweb.freebsd.org/changeset/base/265657

Log:
  MFC r264020 (by trasz):
  Remove the homegrown ctl_be_block_io allocator, replacing it with UMA.
  There is no performance difference.

Modified:
  stable/9/sys/cam/ctl/ctl_backend_block.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/ctl/ctl_backend_block.c
==
--- stable/9/sys/cam/ctl/ctl_backend_block.cThu May  8 08:24:08 2014
(r265656)
+++ stable/9/sys/cam/ctl/ctl_backend_block.cThu May  8 08:25:27 2014
(r265657)
@@ -177,9 +177,7 @@ struct ctl_be_block_lun {
  * Overall softc structure for the block backend module.
  */
 struct ctl_be_block_softc {
-   STAILQ_HEAD(, ctl_be_block_io)   beio_free_queue;
struct mtx   lock;
-   int  prealloc_beio;
int  num_disks;
STAILQ_HEAD(, ctl_block_disk)disk_list;
int  num_luns;
@@ -209,7 +207,6 @@ struct ctl_be_block_io {
uint64_tio_offset;
struct ctl_be_block_softc   *softc;
struct ctl_be_block_lun *lun;
-   STAILQ_ENTRY(ctl_be_block_io)   links;
 };
 
 static int cbb_num_threads = 14;
@@ -221,10 +218,6 @@ SYSCTL_INT(_kern_cam_ctl_block, OID_AUTO
 
 static struct ctl_be_block_io *ctl_alloc_beio(struct ctl_be_block_softc 
*softc);
 static void ctl_free_beio(struct ctl_be_block_io *beio);
-static int ctl_grow_beio(struct ctl_be_block_softc *softc, int count);
-#if 0
-static void ctl_shrink_beio(struct ctl_be_block_softc *softc);
-#endif
 static void ctl_complete_beio(struct ctl_be_block_io *beio);
 static int ctl_be_block_move_done(union ctl_io *io);
 static void ctl_be_block_biodone(struct bio *bio);
@@ -286,68 +279,24 @@ static struct ctl_backend_driver ctl_be_
 MALLOC_DEFINE(M_CTLBLK, ctlblk, Memory used for CTL block backend);
 CTL_BACKEND_DECLARE(cbb, ctl_be_block_driver);
 
+static uma_zone_t beio_zone;
+
 static struct ctl_be_block_io *
 ctl_alloc_beio(struct ctl_be_block_softc *softc)
 {
struct ctl_be_block_io *beio;
-   int count;
-
-   mtx_lock(softc-lock);
-
-   beio = STAILQ_FIRST(softc-beio_free_queue);
-   if (beio != NULL) {
-   STAILQ_REMOVE(softc-beio_free_queue, beio,
- ctl_be_block_io, links);
-   }
-   mtx_unlock(softc-lock);
-
-   if (beio != NULL) {
-   bzero(beio, sizeof(*beio));
-   beio-softc = softc;
-   return (beio);
-   }
-
-   for (;;) {
-
-   count = ctl_grow_beio(softc, /*count*/ 10);
-
-   /*
-* This shouldn't be possible, since ctl_grow_beio() uses a
-* blocking malloc.
-*/
-   if (count == 0)
-   return (NULL);
-
-   /*
-* Since we have to drop the lock when we're allocating beio
-* structures, it's possible someone else can come along and
-* allocate the beio's we've just allocated.
-*/
-   mtx_lock(softc-lock);
-   beio = STAILQ_FIRST(softc-beio_free_queue);
-   if (beio != NULL) {
-   STAILQ_REMOVE(softc-beio_free_queue, beio,
- ctl_be_block_io, links);
-   }
-   mtx_unlock(softc-lock);
 
-   if (beio != NULL) {
-   bzero(beio, sizeof(*beio));
-   beio-softc = softc;
-   break;
-   }
-   }
+   beio = uma_zalloc(beio_zone, M_WAITOK | M_ZERO);
+   beio-softc = softc;
return (beio);
 }
 
 static void
 ctl_free_beio(struct ctl_be_block_io *beio)
 {
-   struct ctl_be_block_softc *softc;
int duplicate_free;
int i;
 
-   softc = beio-softc;
duplicate_free = 0;
 
for (i = 0; i  beio-num_segs; i++) {
@@ -362,47 +311,10 @@ ctl_free_beio(struct ctl_be_block_io *be
printf(%s: %d duplicate frees out of %d segments\n, __func__,
   duplicate_free, beio-num_segs);
}
-   mtx_lock(softc-lock);
-   STAILQ_INSERT_TAIL(softc-beio_free_queue, beio, links);
-   mtx_unlock(softc-lock);
-}
 
-static int
-ctl_grow_beio(struct ctl_be_block_softc *softc, int count)
-{
-   int i;
-
-   for (i = 0; i  count; i++) {
-   struct ctl_be_block_io *beio;
-
-   beio = (struct ctl_be_block_io *)malloc(sizeof(*beio),
-  M_CTLBLK,
-  M_WAITOK | M_ZERO);
-   beio-softc = softc;
-   mtx_lock(softc-lock);
-   

svn commit: r265658 - stable/9/cddl/contrib/opensolaris/cmd/zfs

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:26:20 2014
New Revision: 265658
URL: http://svnweb.freebsd.org/changeset/base/265658

Log:
  MFC r264851
  
  Eliminated optarg global being used outside of the function which called 
getopt
  
  Sponsored by: Multiplay

Modified:
  stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
Directory Properties:
  stable/9/cddl/contrib/opensolaris/   (props changed)
  stable/9/cddl/contrib/opensolaris/cmd/zfs/   (props changed)

Modified: stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==
--- stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cThu May  8 
08:25:27 2014(r265657)
+++ stable/9/cddl/contrib/opensolaris/cmd/zfs/zfs_main.cThu May  8 
08:26:20 2014(r265658)
@@ -493,9 +493,8 @@ usage(boolean_t requested)
 }
 
 static int
-parseprop(nvlist_t *props)
+parseprop(nvlist_t *props, char *propname)
 {
-   char *propname = optarg;
char *propval, *strval;
 
if ((propval = strchr(propname, '=')) == NULL) {
@@ -524,7 +523,7 @@ parse_depth(char *opt, int *flags)
depth = (int)strtol(opt, tmp, 0);
if (*tmp) {
(void) fprintf(stderr,
-   gettext(%s is not an integer\n), optarg);
+   gettext(%s is not an integer\n), opt);
usage(B_FALSE);
}
if (depth  0) {
@@ -615,7 +614,7 @@ zfs_do_clone(int argc, char **argv)
while ((c = getopt(argc, argv, o:p)) != -1) {
switch (c) {
case 'o':
-   if (parseprop(props))
+   if (parseprop(props, optarg))
return (1);
break;
case 'p':
@@ -762,7 +761,7 @@ zfs_do_create(int argc, char **argv)
nomem();
break;
case 'o':
-   if (parseprop(props))
+   if (parseprop(props, optarg))
goto error;
break;
case 's':
@@ -3623,7 +3622,7 @@ zfs_do_snapshot(int argc, char **argv)
while ((c = getopt(argc, argv, ro:)) != -1) {
switch (c) {
case 'o':
-   if (parseprop(props))
+   if (parseprop(props, optarg))
return (1);
break;
case 'r':
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265659 - stable/10/sys/sys

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:30:18 2014
New Revision: 265659
URL: http://svnweb.freebsd.org/changeset/base/265659

Log:
  MFC r264853
  
  Add some new ATA defines for SATA 3.1 spec
  
  Sponsored by: Multiplay

Modified:
  stable/10/sys/sys/ata.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/sys/ata.h
==
--- stable/10/sys/sys/ata.h Thu May  8 08:26:20 2014(r265658)
+++ stable/10/sys/sys/ata.h Thu May  8 08:30:18 2014(r265659)
@@ -130,6 +130,7 @@ struct ata_params {
 #define ATA_SATA_CURR_GEN_MASK  0x0006
 #define ATA_SUPPORT_NCQ_STREAM  0x0010
 #define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020
+#define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040
 /*78*/  u_int16_t   satasupport;
 #define ATA_SUPPORT_NONZERO 0x0002
 #define ATA_SUPPORT_AUTOACTIVATE0x0004
@@ -349,6 +350,7 @@ struct ata_params {
 #define ATA_READ_NATIVE_MAX_ADDRESS48   0x27/* read native max addr 48bit 
*/
 #define ATA_READ_MUL48  0x29/* read multi 48bit LBA */
 #define ATA_READ_STREAM_DMA48   0x2a/* read DMA stream 48bit LBA */
+#define ATA_READ_LOG_EXT0x2f/* read log ext - PIO Data-In 
*/
 #define ATA_READ_STREAM48   0x2b/* read stream 48bit LBA */
 #define ATA_WRITE   0x30/* write */
 #define ATA_WRITE48 0x34/* write 48bit LBA */
@@ -363,8 +365,11 @@ struct ata_params {
 #define ATA_WRITE_LOG_EXT   0x3f
 #define ATA_READ_VERIFY 0x40
 #define ATA_READ_VERIFY48   0x42
+#define ATA_READ_LOG_DMA_EXT0x47/* read log DMA ext - PIO 
Data-In */
 #define ATA_READ_FPDMA_QUEUED   0x60/* read DMA NCQ */
 #define ATA_WRITE_FPDMA_QUEUED  0x61/* write DMA NCQ */
+#define ATA_SEND_FPDMA_QUEUED   0x64/* send DMA NCQ */
+#define ATA_RECV_FPDMA_QUEUED   0x65/* recieve DMA NCQ */
 #define ATA_SEP_ATTN0x67/* SEP request */
 #define ATA_SEEK0x70/* seek */
 #define ATA_PACKET_CMD  0xa0/* packet command */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265660 - stable/9/sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:31:53 2014
New Revision: 265660
URL: http://svnweb.freebsd.org/changeset/base/265660

Log:
  MFC r265150:
  Do not reread SCSI disk VPD pages on every device open.
  
  Instead of rereading VPD pages on every device open, do it only on initial
  device probe, and in cases when device reported via UNIT ATTENTIONs that
  something has changed.  Capacity is still rereaded on every open because
  it is more critical for operation and more probable to change in run time.
  
  On my tests with Intel 530 SSDs on mps(4) HBA this change reduces time
  GEOM needs to retaste the device (that includes few open/close cycles)
  from ~150ms to ~30ms.

Modified:
  stable/9/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/scsi/scsi_da.c
==
--- stable/9/sys/cam/scsi/scsi_da.c Thu May  8 08:30:18 2014
(r265659)
+++ stable/9/sys/cam/scsi/scsi_da.c Thu May  8 08:31:53 2014
(r265660)
@@ -90,7 +90,8 @@ typedef enum {
DA_FLAG_SCTX_INIT   = 0x200,
DA_FLAG_CAN_RC16= 0x400,
DA_FLAG_PROBED  = 0x800,
-   DA_FLAG_DIRTY   = 0x1000
+   DA_FLAG_DIRTY   = 0x1000,
+   DA_FLAG_ANNOUNCED   = 0x2000
 } da_flags;
 
 typedef enum {
@@ -1675,10 +1676,18 @@ daasync(void *callback_arg, u_int32_t co
 error_code, sense_key, asc, ascq)) {
if (asc == 0x2A  ascq == 0x09) {
xpt_print(ccb-ccb_h.path,
-   capacity data has changed\n);
+   Capacity data has changed\n);
+   softc-flags = ~DA_FLAG_PROBED;
dareprobe(periph);
-   } else if (asc == 0x28  ascq == 0x00)
+   } else if (asc == 0x28  ascq == 0x00) {
+   softc-flags = ~DA_FLAG_PROBED;
disk_media_changed(softc-disk, M_NOWAIT);
+   } else if (asc == 0x3F  ascq == 0x03) {
+   xpt_print(ccb-ccb_h.path,
+   INQUIRY data has changed\n);
+   softc-flags = ~DA_FLAG_PROBED;
+   dareprobe(periph);
+   }
}
cam_periph_async(periph, code, path, arg);
break;
@@ -1908,7 +1917,7 @@ daprobedone(struct cam_periph *periph, u
 
dadeletemethodchoose(softc, DA_DELETE_NONE);
 
-   if (bootverbose  (softc-flags  DA_FLAG_PROBED) == 0) {
+   if (bootverbose  (softc-flags  DA_FLAG_ANNOUNCED) == 0) {
char buf[80];
int i, sep;
 
@@ -1949,10 +1958,11 @@ daprobedone(struct cam_periph *periph, u
 */
xpt_release_ccb(ccb);
softc-state = DA_STATE_NORMAL;
+   softc-flags |= DA_FLAG_PROBED;
daschedule(periph);
wakeup(softc-disk-d_mediasize);
-   if ((softc-flags  DA_FLAG_PROBED) == 0) {
-   softc-flags |= DA_FLAG_PROBED;
+   if ((softc-flags  DA_FLAG_ANNOUNCED) == 0) {
+   softc-flags |= DA_FLAG_ANNOUNCED;
cam_periph_unhold(periph);
} else
cam_periph_release_locked(periph);
@@ -3206,7 +3216,8 @@ dadone(struct cam_periph *periph, union 
}
}
free(csio-data_ptr, M_SCSIDA);
-   if (announce_buf[0] != '\0'  ((softc-flags  DA_FLAG_PROBED) 
== 0)) {
+   if (announce_buf[0] != '\0' 
+   ((softc-flags  DA_FLAG_ANNOUNCED) == 0)) {
/*
 * Create our sysctl variables, now that we know
 * we have successfully attached.
@@ -3224,6 +3235,12 @@ dadone(struct cam_periph *periph, union 
}
}
 
+   /* We already probed the device. */
+   if (softc-flags  DA_FLAG_PROBED) {
+   daprobedone(periph, done_ccb);
+   return;
+   }
+
/* Ensure re-probe doesn't see old delete. */
softc-delete_available = 0;
if (lbp  (softc-quirks  DA_Q_NO_UNMAP) == 0) {
@@ -3547,13 +3564,21 @@ daerror(union ccb *ccb, u_int32_t cam_fl
 */
else if (sense_key == SSD_KEY_UNIT_ATTENTION 
asc == 0x2A  ascq == 0x09) {
-   xpt_print(periph-path, capacity data has changed\n);
+   xpt_print(periph-path, Capacity data has changed\n);
+   softc-flags = ~DA_FLAG_PROBED;
dareprobe(periph);
sense_flags |= SF_NO_PRINT;
} else if (sense_key == 

svn commit: r265661 - stable/9/sys/sys

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:32:48 2014
New Revision: 265661
URL: http://svnweb.freebsd.org/changeset/base/265661

Log:
  MFC r264853
  
  Add some new ATA defines for SATA 3.1 spec
  
  Sponsored by: Multiplay

Modified:
  stable/9/sys/sys/ata.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/sys/ata.h
==
--- stable/9/sys/sys/ata.h  Thu May  8 08:31:53 2014(r265660)
+++ stable/9/sys/sys/ata.h  Thu May  8 08:32:48 2014(r265661)
@@ -130,6 +130,7 @@ struct ata_params {
 #define ATA_SATA_CURR_GEN_MASK  0x0006
 #define ATA_SUPPORT_NCQ_STREAM  0x0010
 #define ATA_SUPPORT_NCQ_QMANAGEMENT 0x0020
+#define ATA_SUPPORT_RCVSND_FPDMA_QUEUED 0x0040
 /*78*/  u_int16_t   satasupport;
 #define ATA_SUPPORT_NONZERO 0x0002
 #define ATA_SUPPORT_AUTOACTIVATE0x0004
@@ -349,6 +350,7 @@ struct ata_params {
 #define ATA_READ_NATIVE_MAX_ADDRESS48   0x27/* read native max addr 48bit 
*/
 #define ATA_READ_MUL48  0x29/* read multi 48bit LBA */
 #define ATA_READ_STREAM_DMA48   0x2a/* read DMA stream 48bit LBA */
+#define ATA_READ_LOG_EXT0x2f/* read log ext - PIO Data-In 
*/
 #define ATA_READ_STREAM48   0x2b/* read stream 48bit LBA */
 #define ATA_WRITE   0x30/* write */
 #define ATA_WRITE48 0x34/* write 48bit LBA */
@@ -363,8 +365,11 @@ struct ata_params {
 #define ATA_WRITE_LOG_EXT   0x3f
 #define ATA_READ_VERIFY 0x40
 #define ATA_READ_VERIFY48   0x42
+#define ATA_READ_LOG_DMA_EXT0x47/* read log DMA ext - PIO 
Data-In */
 #define ATA_READ_FPDMA_QUEUED   0x60/* read DMA NCQ */
 #define ATA_WRITE_FPDMA_QUEUED  0x61/* write DMA NCQ */
+#define ATA_SEND_FPDMA_QUEUED   0x64/* send DMA NCQ */
+#define ATA_RECV_FPDMA_QUEUED   0x65/* recieve DMA NCQ */
 #define ATA_SEP_ATTN0x67/* SEP request */
 #define ATA_SEEK0x70/* seek */
 #define ATA_PACKET_CMD  0xa0/* packet command */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265662 - stable/9/sbin/camcontrol

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:33:32 2014
New Revision: 265662
URL: http://svnweb.freebsd.org/changeset/base/265662

Log:
  MFC r264863
  
  Add information about supported NCQ functionality to camcontrol identify.
  
  Sponsored by: Multiplay

Modified:
  stable/9/sbin/camcontrol/camcontrol.c
Directory Properties:
  stable/9/sbin/camcontrol/   (props changed)

Modified: stable/9/sbin/camcontrol/camcontrol.c
==
--- stable/9/sbin/camcontrol/camcontrol.c   Thu May  8 08:32:48 2014
(r265661)
+++ stable/9/sbin/camcontrol/camcontrol.c   Thu May  8 08:33:32 2014
(r265662)
@@ -1196,6 +1196,18 @@ atahpa_print(struct ata_params *parm, u_
}
 }
 
+static int
+atasata(struct ata_params *parm)
+{
+
+
+   if (parm-satacapabilities != 0x 
+   parm-satacapabilities != 0x)
+   return 1;
+
+   return 0;
+}
+
 static void
 atacapprint(struct ata_params *parm)
 {
@@ -1352,6 +1364,17 @@ atacapprint(struct ata_params *parm)
ATA_QUEUE_LEN(parm-queue) + 1);
} else
printf(no\n);
+
+   printf(NCQ Queue Management   %s\n, atasata(parm) 
+   parm-satacapabilities2  ATA_SUPPORT_NCQ_QMANAGEMENT ?
+   yes : no);
+   printf(NCQ Streaming  %s\n, atasata(parm) 
+   parm-satacapabilities2  ATA_SUPPORT_NCQ_STREAM ?
+   yes : no);
+   printf(Receive  Send FPDMA Queued%s\n, atasata(parm) 
+   parm-satacapabilities2  ATA_SUPPORT_RCVSND_FPDMA_QUEUED ?
+   yes : no);
+
printf(SMART  %s   %s\n,
parm-support.command1  ATA_SUPPORT_SMART ? yes : no,
parm-enabled.command1  ATA_SUPPORT_SMART ? yes : no);
@@ -1400,6 +1423,9 @@ atacapprint(struct ata_params *parm)
printf(unload %s   %s\n,
parm-support.extension  ATA_SUPPORT_UNLOAD ? yes : no,
parm-enabled.extension  ATA_SUPPORT_UNLOAD ? yes : no);
+   printf(general purpose logging%s   %s\n,
+   parm-support.extension  ATA_SUPPORT_GENLOG ? yes : no,
+   parm-enabled.extension  ATA_SUPPORT_GENLOG ? yes : no);
printf(free-fall  %s   %s\n,
parm-support2  ATA_SUPPORT_FREEFALL ? yes : no,
parm-enabled2  ATA_SUPPORT_FREEFALL ? yes : no);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265663 - stable/9/sys/dev/acpica

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:34:49 2014
New Revision: 265663
URL: http://svnweb.freebsd.org/changeset/base/265663

Log:
  MFC r264878
  
  Increase ACPI_MAX_TASKS to be 4 x the number of CPU's as 2 x was still
  insufficient on some machines.
  
  Sponsored by: Multiplay

Modified:
  stable/9/sys/dev/acpica/acpivar.h
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/acpica/acpivar.h
==
--- stable/9/sys/dev/acpica/acpivar.h   Thu May  8 08:33:32 2014
(r265662)
+++ stable/9/sys/dev/acpica/acpivar.h   Thu May  8 08:34:49 2014
(r265663)
@@ -478,7 +478,7 @@ ACPI_HANDLE acpi_GetReference(ACPI_HANDL
 
 /* Default maximum number of tasks to enqueue. */
 #ifndef ACPI_MAX_TASKS
-#defineACPI_MAX_TASKS  MAX(32, MAXCPU * 2)
+#defineACPI_MAX_TASKS  MAX(32, MAXCPU * 4)
 #endif
 
 /* Default number of task queue threads to start. */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265664 - stable/9/sys/cam/scsi

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 08:35:24 2014
New Revision: 265664
URL: http://svnweb.freebsd.org/changeset/base/265664

Log:
  MFC r265159:
  Respect MAXIMUM TRANSFER LENGTH field of Block Limits VPD page.
  
  Nobody yet reported disk supporting I/Os less then our MAXPHYS value, but
  since we any way have code to read Block Limits VPD page, that is easy.

Modified:
  stable/9/sys/cam/scsi/scsi_da.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/cam/scsi/scsi_da.c
==
--- stable/9/sys/cam/scsi/scsi_da.c Thu May  8 08:34:49 2014
(r265663)
+++ stable/9/sys/cam/scsi/scsi_da.c Thu May  8 08:35:24 2014
(r265664)
@@ -213,6 +213,7 @@ struct da_softc {
int  trim_max_ranges;
int  delete_running;
int  delete_available;  /* Delete methods possibly available */
+   u_intmaxio;
uint32_tunmap_max_ranges;
uint32_tunmap_max_lba; /* Max LBAs in UNMAP req */
uint64_tws_max_blks;
@@ -2152,11 +2153,12 @@ daregister(struct cam_periph *periph, vo
softc-disk-d_name = da;
softc-disk-d_drv1 = periph;
if (cpi.maxio == 0)
-   softc-disk-d_maxsize = DFLTPHYS;  /* traditional default 
*/
+   softc-maxio = DFLTPHYS;/* traditional default */
else if (cpi.maxio  MAXPHYS)
-   softc-disk-d_maxsize = MAXPHYS;   /* for safety */
+   softc-maxio = MAXPHYS; /* for safety */
else
-   softc-disk-d_maxsize = cpi.maxio;
+   softc-maxio = cpi.maxio;
+   softc-disk-d_maxsize = softc-maxio;
softc-disk-d_unit = periph-unit_number;
softc-disk-d_flags = 0;
if ((softc-quirks  DA_Q_NO_SYNC_CACHE) == 0)
@@ -3292,14 +3294,6 @@ dadone(struct cam_periph *periph, union 
 (lbp-flags  SVPD_LBP_WS10));
dadeleteflag(softc, DA_DELETE_UNMAP,
 (lbp-flags  SVPD_LBP_UNMAP));
-
-   if (lbp-flags  SVPD_LBP_UNMAP) {
-   free(lbp, M_SCSIDA);
-   xpt_release_ccb(done_ccb);
-   softc-state = DA_STATE_PROBE_BLK_LIMITS;
-   xpt_schedule(periph, priority);
-   return;
-   }
} else {
int error;
error = daerror(done_ccb, CAM_RETRY_SELTO,
@@ -3325,7 +3319,7 @@ dadone(struct cam_periph *periph, union 
 
free(lbp, M_SCSIDA);
xpt_release_ccb(done_ccb);
-   softc-state = DA_STATE_PROBE_BDC;
+   softc-state = DA_STATE_PROBE_BLK_LIMITS;
xpt_schedule(periph, priority);
return;
}
@@ -3336,12 +3330,20 @@ dadone(struct cam_periph *periph, union 
block_limits = (struct scsi_vpd_block_limits *)csio-data_ptr;
 
if ((csio-ccb_h.status  CAM_STATUS_MASK) == CAM_REQ_CMP) {
+   uint32_t max_txfer_len = scsi_4btoul(
+   block_limits-max_txfer_len);
uint32_t max_unmap_lba_cnt = scsi_4btoul(
block_limits-max_unmap_lba_cnt);
uint32_t max_unmap_blk_cnt = scsi_4btoul(
block_limits-max_unmap_blk_cnt);
uint64_t ws_max_blks = scsi_8btou64(
block_limits-max_write_same_length);
+
+   if (max_txfer_len != 0) {
+   softc-disk-d_maxsize = MIN(softc-maxio,
+   (off_t)max_txfer_len * 
softc-params.secsize);
+   }
+
/*
 * We should already support UNMAP but we check lba
 * and block count to be sure
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265665 - stable/9/sys/dev/acpica/Osd

2014-05-08 Thread Steven Hartland
Author: smh
Date: Thu May  8 08:37:32 2014
New Revision: 265665
URL: http://svnweb.freebsd.org/changeset/base/265665

Log:
  MFC r264849  r264883
  
  Exposed debug.acpi.max_tasks and debug.acpi.max_threads via sysctls so their
  values can be viewed.
  
  Sponsored by: Multiplay

Modified:
  stable/9/sys/dev/acpica/Osd/OsdSchedule.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/dev/acpica/Osd/OsdSchedule.c
==
--- stable/9/sys/dev/acpica/Osd/OsdSchedule.c   Thu May  8 08:35:24 2014
(r265664)
+++ stable/9/sys/dev/acpica/Osd/OsdSchedule.c   Thu May  8 08:37:32 2014
(r265665)
@@ -57,6 +57,8 @@ ACPI_MODULE_NAME(SCHEDULE)
  */
 static int acpi_max_tasks = ACPI_MAX_TASKS;
 TUNABLE_INT(debug.acpi.max_tasks, acpi_max_tasks);
+SYSCTL_INT(_debug_acpi, OID_AUTO, max_tasks, CTLFLAG_RDTUN, acpi_max_tasks,
+0, Maximum acpi tasks);
 
 /*
  * Allow the user to tune the number of task threads we start.  It seems
@@ -64,6 +66,8 @@ TUNABLE_INT(debug.acpi.max_tasks, acp
  */
 static int acpi_max_threads = ACPI_MAX_THREADS;
 TUNABLE_INT(debug.acpi.max_threads, acpi_max_threads);
+SYSCTL_INT(_debug_acpi, OID_AUTO, max_threads, CTLFLAG_RDTUN, 
acpi_max_threads,
+0, Maximum acpi threads);
 
 static MALLOC_DEFINE(M_ACPITASK, acpitask, ACPI deferred task);
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265666 - in head: sbin/route sys/net

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 11:56:06 2014
New Revision: 265666
URL: http://svnweb.freebsd.org/changeset/base/265666

Log:
  Fix incorrect netmasks being passed via rtsock.
  
  Since radix has been ignoring sa_family in passed sockaddrs,
  no one ever has bothered filling valid sa_family in netmasks.
  Additionally, radix adjusts sa_len field in every netmask not to
  compare zero bytes at all.
  
  This leads us to rt_mask with sa_family of AF_UNSPEC (-1) and
  arbitrary sa_len field (0 for default route, for example).
  
  However, rtsock have been passing that rt_mask intact for ages,
  requiring all rtsock consumers to make ther own local hacks.
  We even have unfixed on in base:
  
  do `route -n monitor` in one window and issue `route -n get addr`
  for some directly-connected address. You will probably see the following:
  
  got message of size 304 on Thu May  8 15:06:06 2014
  RTM_GET: Report Metrics: len 304, pid: 30493, seq 1, errno 0, 
flags:UP,DONE,PINNED
  locks:  inits:
  sockaddrs: DST,GATEWAY,NETMASK,IFP,IFA
   10.0.0.0 link#1 (255)   ff em0:8.0.27.c5.29.d4 10.0.0.92
  _^^
  
  after the change:
  
  got message of size 312 on Thu May  8 15:44:07 2014
  RTM_GET: Report Metrics: len 312, pid: 2895, seq 1, errno 0, 
flags:UP,DONE,PINNED
  locks:  inits:
  sockaddrs: DST,GATEWAY,NETMASK,IFP,IFA
   10.0.0.0 link#1 255.255.255.0 em0:8.0.27.c5.29.d4 10.0.0.92
  _^^
  
  Sponsored by: Yandex LLC
  MFC after:1 month

Modified:
  head/sbin/route/route.c
  head/sys/net/rtsock.c

Modified: head/sbin/route/route.c
==
--- head/sbin/route/route.c Thu May  8 08:37:32 2014(r265665)
+++ head/sbin/route/route.c Thu May  8 11:56:06 2014(r265666)
@@ -1727,8 +1727,6 @@ print_getmsg(struct rt_msghdr *rtm, int 
(sp[RTAX_IFP]-sa_family != AF_LINK ||
 ((struct sockaddr_dl *)(void *)sp[RTAX_IFP])-sdl_nlen == 0))
sp[RTAX_IFP] = NULL;
-   if (sp[RTAX_DST]  sp[RTAX_NETMASK])
-   sp[RTAX_NETMASK]-sa_family = sp[RTAX_DST]-sa_family; /* XXX */
if (sp[RTAX_DST])
(void)printf(destination: %s\n, routename(sp[RTAX_DST]));
if (sp[RTAX_NETMASK])

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Thu May  8 08:37:32 2014(r265665)
+++ head/sys/net/rtsock.c   Thu May  8 11:56:06 2014(r265666)
@@ -162,6 +162,8 @@ static int  sysctl_ifmalist(int af, struc
 static int route_output(struct mbuf *m, struct socket *so);
 static voidrt_getmetrics(const struct rtentry *rt, struct rt_metrics *out);
 static voidrt_dispatch(struct mbuf *, sa_family_t);
+static struct sockaddr *rtsock_fix_netmask(struct sockaddr *dst,
+   struct sockaddr *smask, struct sockaddr_storage *dmask);
 
 static struct netisr_handler rtsock_nh = {
.nh_name = rtsock,
@@ -520,8 +522,8 @@ route_output(struct mbuf *m, struct sock
struct rtentry *rt = NULL;
struct radix_node_head *rnh;
struct rt_addrinfo info;
-#ifdef INET6
struct sockaddr_storage ss;
+#ifdef INET6
struct sockaddr_in6 *sin6;
int i, rti_need_deembed = 0;
 #endif
@@ -784,7 +786,8 @@ report:
}
info.rti_info[RTAX_DST] = rt_key(rt);
info.rti_info[RTAX_GATEWAY] = rt-rt_gateway;
-   info.rti_info[RTAX_NETMASK] = rt_mask(rt);
+   info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(rt_key(rt),
+   rt_mask(rt), ss);
info.rti_info[RTAX_GENMASK] = 0;
if (rtm-rtm_addrs  (RTA_IFP | RTA_IFA)) {
ifp = rt-rt_ifp;
@@ -967,6 +970,25 @@ rt_xaddrs(caddr_t cp, caddr_t cplim, str
 }
 
 /*
+ * Fill in @dmask with valid netmask leaving original @smask
+ * intact. Mostly used with radix netmasks.
+ */
+static struct sockaddr *
+rtsock_fix_netmask(struct sockaddr *dst, struct sockaddr *smask,
+struct sockaddr_storage *dmask)
+{
+   if (dst == NULL || smask == NULL)
+   return (NULL);
+
+   memset(dmask, 0, dst-sa_len);
+   memcpy(dmask, smask, smask-sa_len);
+   dmask-ss_len = dst-sa_len;
+   dmask-ss_family = dst-sa_family;
+
+   return ((struct sockaddr *)dmask);
+}
+
+/*
  * Used by the routing socket.
  */
 static struct mbuf *
@@ -1247,6 +1269,7 @@ rtsock_addrmsg(int cmd, struct ifaddr *i
struct mbuf *m;
struct ifa_msghdr *ifam;
struct ifnet *ifp = ifa-ifa_ifp;
+   struct sockaddr_storage ss;
 
if (V_route_cb.any_count == 0)
return (0);
@@ -1256,7 +1279,8 @@ rtsock_addrmsg(int cmd, struct ifaddr *i
bzero((caddr_t)info, sizeof(info));
info.rti_info[RTAX_IFA] = sa = ifa-ifa_addr;
info.rti_info[RTAX_IFP] = 

svn commit: r265667 - in stable/10/sys: fs/nfsserver nfsserver

2014-05-08 Thread Rick Macklem
Author: rmacklem
Date: Thu May  8 11:59:23 2014
New Revision: 265667
URL: http://svnweb.freebsd.org/changeset/base/265667

Log:
  MFC: r264888
  The PR reported that the old NFS server did not set uio_td == NULL
  for the VOP_READ() call. This patch fixes both the old and new
  server for this case.

Modified:
  stable/10/sys/fs/nfsserver/nfs_nfsdport.c
  stable/10/sys/nfsserver/nfs_serv.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Thu May  8 11:56:06 2014
(r265666)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Thu May  8 11:59:23 2014
(r265667)
@@ -673,6 +673,7 @@ nfsvno_read(struct vnode *vp, off_t off,
uiop-uio_resid = len;
uiop-uio_rw = UIO_READ;
uiop-uio_segflg = UIO_SYSSPACE;
+   uiop-uio_td = NULL;
nh = nfsrv_sequential_heuristic(uiop, vp);
ioflag |= nh-nh_seqcount  IO_SEQSHIFT;
error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred);

Modified: stable/10/sys/nfsserver/nfs_serv.c
==
--- stable/10/sys/nfsserver/nfs_serv.c  Thu May  8 11:56:06 2014
(r265666)
+++ stable/10/sys/nfsserver/nfs_serv.c  Thu May  8 11:59:23 2014
(r265667)
@@ -911,6 +911,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, 
uiop-uio_resid = len;
uiop-uio_rw = UIO_READ;
uiop-uio_segflg = UIO_SYSSPACE;
+   uiop-uio_td = NULL;
nh = nfsrv_sequential_heuristic(uiop, vp);
ioflag |= nh-nh_seqcount  IO_SEQSHIFT;
error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265668 - stable/10/sys/geom/stripe

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:04:40 2014
New Revision: 265668
URL: http://svnweb.freebsd.org/changeset/base/265668

Log:
  MFC r264313:
  Do not increment bio_data in case of BIO_DELETE.
  
  This fixes KASSERT() panic in g_io_request().

Modified:
  stable/10/sys/geom/stripe/g_stripe.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/geom/stripe/g_stripe.c
==
--- stable/10/sys/geom/stripe/g_stripe.cThu May  8 11:59:23 2014
(r265667)
+++ stable/10/sys/geom/stripe/g_stripe.cThu May  8 12:04:40 2014
(r265668)
@@ -472,9 +472,10 @@ g_stripe_start_economic(struct bio *bp, 
 
/* offset -= offset % stripesize; */
offset -= offset  (stripesize - 1);
-   addr += length;
+   if (bp-bio_cmd != BIO_DELETE)
+   addr += length;
length = bp-bio_length - length;
-   for (no++; length  0; no++, length -= stripesize, addr += stripesize) {
+   for (no++; length  0; no++, length -= stripesize) {
if (no  sc-sc_ndisks - 1) {
no = 0;
offset += stripesize;
@@ -506,6 +507,9 @@ g_stripe_start_economic(struct bio *bp, 
cbp-bio_data = addr;
 
cbp-bio_caller2 = sc-sc_disks[no];
+
+   if (bp-bio_cmd != BIO_DELETE)
+   addr += stripesize;
}
/*
 * Fire off all allocated requests!
@@ -632,10 +636,13 @@ g_stripe_start(struct bio *bp)
 *a provider, so there is nothing to optmize.
 * and
 * 4. Request is not unmapped.
+* and
+* 5. It is not a BIO_DELETE.
 */
if (g_stripe_fast  bp-bio_length = MAXPHYS 
bp-bio_length = stripesize * sc-sc_ndisks 
-   (bp-bio_flags  BIO_UNMAPPED) == 0) {
+   (bp-bio_flags  BIO_UNMAPPED) == 0 
+   bp-bio_cmd != BIO_DELETE) {
fast = 1;
}
error = 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265669 - stable/10/sys/geom/raid

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:07:40 2014
New Revision: 265669
URL: http://svnweb.freebsd.org/changeset/base/265669

Log:
  MFC r265054:
  Reduce number of opens by REOM RAID during provider taste.
  
  Instead opening/closing provider by each of metadata classes, do it only
  once in core code.  Since for SCSI disks open/close means sending some
  SCSI commands to the device, this change reduces taste time.
  
  Sponsored by: iXsystems, Inc.

Modified:
  stable/10/sys/geom/raid/g_raid.c
  stable/10/sys/geom/raid/md_ddf.c
  stable/10/sys/geom/raid/md_intel.c
  stable/10/sys/geom/raid/md_jmicron.c
  stable/10/sys/geom/raid/md_nvidia.c
  stable/10/sys/geom/raid/md_promise.c
  stable/10/sys/geom/raid/md_sii.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/geom/raid/g_raid.c
==
--- stable/10/sys/geom/raid/g_raid.cThu May  8 12:04:40 2014
(r265668)
+++ stable/10/sys/geom/raid/g_raid.cThu May  8 12:07:40 2014
(r265669)
@@ -2251,6 +2251,8 @@ g_raid_taste(struct g_class *mp, struct 
return (NULL);
G_RAID_DEBUG(2, Tasting provider %s., pp-name);
 
+   geom = NULL;
+   status = G_RAID_MD_TASTE_FAIL;
gp = g_new_geomf(mp, raid:taste);
/*
 * This orphan function should be never called.
@@ -2259,8 +2261,9 @@ g_raid_taste(struct g_class *mp, struct 
cp = g_new_consumer(gp);
cp-flags |= G_CF_DIRECT_RECEIVE;
g_attach(cp, pp);
+   if (g_access(cp, 1, 0, 0) != 0)
+   goto ofail;
 
-   geom = NULL;
LIST_FOREACH(class, g_raid_md_classes, mdc_list) {
if (!class-mdc_enable)
continue;
@@ -2276,6 +2279,9 @@ g_raid_taste(struct g_class *mp, struct 
break;
}
 
+   if (status == G_RAID_MD_TASTE_FAIL)
+   (void)g_access(cp, -1, 0, 0);
+ofail:
g_detach(cp);
g_destroy_consumer(cp);
g_destroy_geom(gp);

Modified: stable/10/sys/geom/raid/md_ddf.c
==
--- stable/10/sys/geom/raid/md_ddf.cThu May  8 12:04:40 2014
(r265668)
+++ stable/10/sys/geom/raid/md_ddf.cThu May  8 12:07:40 2014
(r265669)
@@ -2120,13 +2120,10 @@ g_raid_md_taste_ddf(struct g_raid_md_obj
pp = cp-provider;
 
/* Read metadata from device. */
-   if (g_access(cp, 1, 0, 0) != 0)
-   return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
bzero(meta, sizeof(meta));
error = ddf_meta_read(cp, meta);
g_topology_lock();
-   g_access(cp, -1, 0, 0);
if (error != 0)
return (G_RAID_MD_TASTE_FAIL);
be = meta.bigendian;
@@ -2164,6 +2161,9 @@ g_raid_md_taste_ddf(struct g_raid_md_obj
geom = sc-sc_geom;
}
 
+   /* There is no return after this point, so we close passed consumer. */
+   g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
rcp-flags |= G_CF_DIRECT_RECEIVE;
g_attach(rcp, pp);

Modified: stable/10/sys/geom/raid/md_intel.c
==
--- stable/10/sys/geom/raid/md_intel.c  Thu May  8 12:04:40 2014
(r265668)
+++ stable/10/sys/geom/raid/md_intel.c  Thu May  8 12:07:40 2014
(r265669)
@@ -1382,8 +1382,6 @@ g_raid_md_taste_intel(struct g_raid_md_o
meta = NULL;
vendor = 0x;
disk_pos = 0;
-   if (g_access(cp, 1, 0, 0) != 0)
-   return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
error = g_raid_md_get_label(cp, serial, sizeof(serial));
if (error != 0) {
@@ -1396,7 +1394,6 @@ g_raid_md_taste_intel(struct g_raid_md_o
g_io_getattr(GEOM::hba_vendor, cp, len, vendor);
meta = intel_meta_read(cp);
g_topology_lock();
-   g_access(cp, -1, 0, 0);
if (meta == NULL) {
if (g_raid_aggressive_spare) {
if (vendor != 0x8086) {
@@ -1476,6 +1473,9 @@ search:
G_RAID_DEBUG1(1, sc, root_mount_hold %p, mdi-mdio_rootmount);
}
 
+   /* There is no return after this point, so we close passed consumer. */
+   g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
rcp-flags |= G_CF_DIRECT_RECEIVE;
g_attach(rcp, pp);
@@ -1512,7 +1512,6 @@ search:
return (result);
 fail2:
g_topology_lock();
-   g_access(cp, -1, 0, 0);
 fail1:
free(meta, M_MD_INTEL);
return (G_RAID_MD_TASTE_FAIL);

Modified: stable/10/sys/geom/raid/md_jmicron.c
==
--- stable/10/sys/geom/raid/md_jmicron.cThu May  8 12:04:40 2014
(r265668)
+++ stable/10/sys/geom/raid/md_jmicron.cThu May  8 12:07:40 2014
(r265669)
@@ -837,15 +837,12 

svn commit: r265670 - stable/9/sys/geom/mirror

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:23:30 2014
New Revision: 265670
URL: http://svnweb.freebsd.org/changeset/base/265670

Log:
  MFC r254252:
  Fix the formatting of the error message.
  
  The G_MIRROR_DEBUG() macro already appends a newline. Also, most of the
  log messages emitted by gmirror start with an uppercase letter.

Modified:
  stable/9/sys/geom/mirror/g_mirror.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/mirror/g_mirror.c
==
--- stable/9/sys/geom/mirror/g_mirror.c Thu May  8 12:07:40 2014
(r265669)
+++ stable/9/sys/geom/mirror/g_mirror.c Thu May  8 12:23:30 2014
(r265670)
@@ -2054,8 +2054,8 @@ g_mirror_launch_provider(struct g_mirror
}
/* A provider underneath us doesn't support unmapped */
if ((dp-flags  G_PF_ACCEPT_UNMAPPED) == 0) {
-   G_MIRROR_DEBUG(0, cancelling unmapped 
-   because of %s\n, dp-name);
+   G_MIRROR_DEBUG(0, Cancelling unmapped 
+   because of %s., dp-name);
pp-flags = ~G_PF_ACCEPT_UNMAPPED;
}
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265671 - in stable/9/sys: geom kern sys

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:26:08 2014
New Revision: 265671
URL: http://svnweb.freebsd.org/changeset/base/265671

Log:
  MFC r256603:
  Introduce new function devstat_end_transaction_bio_bt(), adding new argument
  to specify present time.  Use this function to move binuptime() out of lock,
  substantially reducing lock congestion when slow timecounter is used.

Modified:
  stable/9/sys/geom/geom_disk.c
  stable/9/sys/geom/geom_io.c
  stable/9/sys/kern/subr_devstat.c
  stable/9/sys/sys/devicestat.h
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/sys/   (props changed)

Modified: stable/9/sys/geom/geom_disk.c
==
--- stable/9/sys/geom/geom_disk.c   Thu May  8 12:23:30 2014
(r265670)
+++ stable/9/sys/geom/geom_disk.c   Thu May  8 12:26:08 2014
(r265671)
@@ -233,6 +233,7 @@ g_disk_setstate(struct bio *bp, struct g
 static void
 g_disk_done(struct bio *bp)
 {
+   struct bintime now;
struct bio *bp2;
struct g_disk_softc *sc;
 
@@ -241,12 +242,13 @@ g_disk_done(struct bio *bp)
bp2 = bp-bio_parent;
sc = bp2-bio_to-private;
bp-bio_completed = bp-bio_length - bp-bio_resid;
+   binuptime(now);
mtx_lock(sc-done_mtx);
if (bp2-bio_error == 0)
bp2-bio_error = bp-bio_error;
bp2-bio_completed += bp-bio_completed;
if ((bp-bio_cmd  (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0)
-   devstat_end_transaction_bio(sc-dp-d_devstat, bp);
+   devstat_end_transaction_bio_bt(sc-dp-d_devstat, bp, now);
g_destroy_bio(bp);
bp2-bio_inbed++;
if (bp2-bio_children == bp2-bio_inbed) {

Modified: stable/9/sys/geom/geom_io.c
==
--- stable/9/sys/geom/geom_io.c Thu May  8 12:23:30 2014(r265670)
+++ stable/9/sys/geom/geom_io.c Thu May  8 12:26:08 2014(r265671)
@@ -510,6 +510,7 @@ g_io_request(struct bio *bp, struct g_co
 void
 g_io_deliver(struct bio *bp, int error)
 {
+   struct bintime now;
struct g_consumer *cp;
struct g_provider *pp;
int first;
@@ -563,11 +564,13 @@ g_io_deliver(struct bio *bp, int error)
 * can not update one instance of the statistics from more
 * than one thread at a time, so grab the lock first.
 */
+   if (g_collectstats)
+   binuptime(now);
g_bioq_lock(g_bio_run_up);
if (g_collectstats  1)
-   devstat_end_transaction_bio(pp-stat, bp);
+   devstat_end_transaction_bio_bt(pp-stat, bp, now);
if (g_collectstats  2)
-   devstat_end_transaction_bio(cp-stat, bp);
+   devstat_end_transaction_bio_bt(cp-stat, bp, now);
 
cp-nend++;
pp-nend++;

Modified: stable/9/sys/kern/subr_devstat.c
==
--- stable/9/sys/kern/subr_devstat.cThu May  8 12:23:30 2014
(r265670)
+++ stable/9/sys/kern/subr_devstat.cThu May  8 12:26:08 2014
(r265671)
@@ -339,6 +339,14 @@ devstat_end_transaction(struct devstat *
 void
 devstat_end_transaction_bio(struct devstat *ds, struct bio *bp)
 {
+
+   devstat_end_transaction_bio_bt(ds, bp, NULL);
+}
+
+void
+devstat_end_transaction_bio_bt(struct devstat *ds, struct bio *bp,
+struct bintime *now)
+{
devstat_trans_flags flg;
 
/* sanity check */
@@ -355,7 +363,7 @@ devstat_end_transaction_bio(struct devst
flg = DEVSTAT_NO_DATA;
 
devstat_end_transaction(ds, bp-bio_bcount - bp-bio_resid,
-   DEVSTAT_TAG_SIMPLE, flg, NULL, bp-bio_t0);
+   DEVSTAT_TAG_SIMPLE, flg, now, bp-bio_t0);
DTRACE_DEVSTAT_BIO_DONE();
 }
 

Modified: stable/9/sys/sys/devicestat.h
==
--- stable/9/sys/sys/devicestat.h   Thu May  8 12:23:30 2014
(r265670)
+++ stable/9/sys/sys/devicestat.h   Thu May  8 12:26:08 2014
(r265671)
@@ -199,6 +199,8 @@ void devstat_end_transaction(struct devs
 devstat_trans_flags flags,
 struct bintime *now, struct bintime *then);
 void devstat_end_transaction_bio(struct devstat *ds, struct bio *bp);
+void devstat_end_transaction_bio_bt(struct devstat *ds, struct bio *bp,
+struct bintime *now);
 #endif
 
 #endif /* _DEVICESTAT_H */
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265672 - stable/9/sys/geom

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:27:24 2014
New Revision: 265672
URL: http://svnweb.freebsd.org/changeset/base/265672

Log:
  MFC r256606:
  Move g_io_deliver() out of the lock, as required for direct dispatch.
  Move g_destroy_bio() out too to reduce lock scope even more.

Modified:
  stable/9/sys/geom/geom_disk.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/geom_disk.c
==
--- stable/9/sys/geom/geom_disk.c   Thu May  8 12:26:08 2014
(r265671)
+++ stable/9/sys/geom/geom_disk.c   Thu May  8 12:27:24 2014
(r265672)
@@ -249,13 +249,14 @@ g_disk_done(struct bio *bp)
bp2-bio_completed += bp-bio_completed;
if ((bp-bio_cmd  (BIO_READ|BIO_WRITE|BIO_DELETE)) != 0)
devstat_end_transaction_bio_bt(sc-dp-d_devstat, bp, now);
-   g_destroy_bio(bp);
bp2-bio_inbed++;
if (bp2-bio_children == bp2-bio_inbed) {
+   mtx_unlock(sc-done_mtx);
bp2-bio_resid = bp2-bio_bcount - bp2-bio_completed;
g_io_deliver(bp2, bp2-bio_error);
-   }
-   mtx_unlock(sc-done_mtx);
+   } else
+   mtx_unlock(sc-done_mtx);
+   g_destroy_bio(bp);
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265673 - stable/9/sys/geom/raid

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:28:24 2014
New Revision: 265673
URL: http://svnweb.freebsd.org/changeset/base/265673

Log:
  MFC r256610:
  Add unmapped I/O support to GEOM RAID.

Modified:
  stable/9/sys/geom/raid/g_raid.c
  stable/9/sys/geom/raid/g_raid.h
  stable/9/sys/geom/raid/tr_concat.c
  stable/9/sys/geom/raid/tr_raid0.c
  stable/9/sys/geom/raid/tr_raid1.c
  stable/9/sys/geom/raid/tr_raid1e.c
  stable/9/sys/geom/raid/tr_raid5.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/g_raid.c
==
--- stable/9/sys/geom/raid/g_raid.c Thu May  8 12:27:24 2014
(r265672)
+++ stable/9/sys/geom/raid/g_raid.c Thu May  8 12:28:24 2014
(r265673)
@@ -993,20 +993,15 @@ g_raid_tr_flush_common(struct g_raid_tr_
cbp-bio_caller1 = sd;
bioq_insert_tail(queue, cbp);
}
-   for (cbp = bioq_first(queue); cbp != NULL;
-   cbp = bioq_first(queue)) {
-   bioq_remove(queue, cbp);
+   while ((cbp = bioq_takefirst(queue)) != NULL) {
sd = cbp-bio_caller1;
cbp-bio_caller1 = NULL;
g_raid_subdisk_iostart(sd, cbp);
}
return;
 failure:
-   for (cbp = bioq_first(queue); cbp != NULL;
-   cbp = bioq_first(queue)) {
-   bioq_remove(queue, cbp);
+   while ((cbp = bioq_takefirst(queue)) != NULL)
g_destroy_bio(cbp);
-   }
if (bp-bio_error == 0)
bp-bio_error = ENOMEM;
g_raid_iodone(bp, bp-bio_error);
@@ -1639,11 +1634,13 @@ static void
 g_raid_launch_provider(struct g_raid_volume *vol)
 {
struct g_raid_disk *disk;
+   struct g_raid_subdisk *sd;
struct g_raid_softc *sc;
struct g_provider *pp;
char name[G_RAID_MAX_VOLUMENAME];
char   announce_buf[80], buf1[32];
off_t off;
+   int i;
 
sc = vol-v_softc;
sx_assert(sc-sc_lock, SX_LOCKED);
@@ -1673,6 +1670,17 @@ g_raid_launch_provider(struct g_raid_vol
 }
 
pp = g_new_providerf(sc-sc_geom, %s, name);
+   if (vol-v_tr-tro_class-trc_accept_unmapped) {
+   pp-flags |= G_PF_ACCEPT_UNMAPPED;
+   for (i = 0; i  vol-v_disks_count; i++) {
+   sd = vol-v_subdisks[i];
+   if (sd-sd_state == G_RAID_SUBDISK_S_NONE)
+   continue;
+   if ((sd-sd_disk-d_consumer-provider-flags 
+   G_PF_ACCEPT_UNMAPPED) == 0)
+   pp-flags = ~G_PF_ACCEPT_UNMAPPED;
+   }
+   }
pp-private = vol;
pp-mediasize = vol-v_mediasize;
pp-sectorsize = vol-v_sectorsize;

Modified: stable/9/sys/geom/raid/g_raid.h
==
--- stable/9/sys/geom/raid/g_raid.h Thu May  8 12:27:24 2014
(r265672)
+++ stable/9/sys/geom/raid/g_raid.h Thu May  8 12:28:24 2014
(r265673)
@@ -376,6 +376,7 @@ struct g_raid_tr_class {
KOBJ_CLASS_FIELDS;
int  trc_enable;
int  trc_priority;
+   int  trc_accept_unmapped;
LIST_ENTRY(g_raid_tr_class) trc_list;
 };
 

Modified: stable/9/sys/geom/raid/tr_concat.c
==
--- stable/9/sys/geom/raid/tr_concat.c  Thu May  8 12:27:24 2014
(r265672)
+++ stable/9/sys/geom/raid/tr_concat.c  Thu May  8 12:28:24 2014
(r265673)
@@ -74,7 +74,8 @@ static struct g_raid_tr_class g_raid_tr_
g_raid_tr_concat_methods,
sizeof(struct g_raid_tr_concat_object),
.trc_enable = 1,
-   .trc_priority = 50
+   .trc_priority = 50,
+   .trc_accept_unmapped = 1
 };
 
 static int
@@ -227,7 +228,10 @@ g_raid_tr_iostart_concat(struct g_raid_t
 
offset = bp-bio_offset;
remain = bp-bio_length;
-   addr = bp-bio_data;
+   if ((bp-bio_flags  BIO_UNMAPPED) != 0)
+   addr = NULL;
+   else
+   addr = bp-bio_data;
no = 0;
while (no  vol-v_disks_count 
offset = vol-v_subdisks[no].sd_size) {
@@ -244,8 +248,16 @@ g_raid_tr_iostart_concat(struct g_raid_t
if (cbp == NULL)
goto failure;
cbp-bio_offset = offset;
-   cbp-bio_data = addr;
cbp-bio_length = length;
+   if ((bp-bio_flags  BIO_UNMAPPED) != 0 
+   bp-bio_cmd != BIO_DELETE) {
+   cbp-bio_ma_offset += (uintptr_t)addr;
+   cbp-bio_ma += cbp-bio_ma_offset / PAGE_SIZE;
+   cbp-bio_ma_offset %= PAGE_SIZE;
+   cbp-bio_ma_n = round_page(cbp-bio_ma_offset +
+   cbp-bio_length) / PAGE_SIZE;

svn commit: r265674 - stable/9/sys/geom

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:35:37 2014
New Revision: 265674
URL: http://svnweb.freebsd.org/changeset/base/265674

Log:
  MFC r256607, r259247:
  Fix passing uninitialized bio_resid argument to g_trace().

Modified:
  stable/9/sys/geom/geom_dev.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/geom_dev.c
==
--- stable/9/sys/geom/geom_dev.cThu May  8 12:28:24 2014
(r265673)
+++ stable/9/sys/geom/geom_dev.cThu May  8 12:35:37 2014
(r265674)
@@ -489,16 +489,16 @@ g_dev_done(struct bio *bp2)
sc = cp-private;
bp = bp2-bio_parent;
bp-bio_error = bp2-bio_error;
-   if (bp-bio_error != 0) {
+   bp-bio_completed = bp2-bio_completed;
+   bp-bio_resid = bp-bio_length - bp2-bio_completed;
+   if (bp2-bio_error != 0) {
g_trace(G_T_BIO, g_dev_done(%p) had error %d,
-   bp2, bp-bio_error);
+   bp2, bp2-bio_error);
bp-bio_flags |= BIO_ERROR;
} else {
g_trace(G_T_BIO, g_dev_done(%p/%p) resid %ld completed %jd,
-   bp2, bp, bp-bio_resid, (intmax_t)bp2-bio_completed);
+   bp2, bp, bp2-bio_resid, (intmax_t)bp2-bio_completed);
}
-   bp-bio_resid = bp-bio_length - bp2-bio_completed;
-   bp-bio_completed = bp2-bio_completed;
g_destroy_bio(bp2);
destroy = 0;
mtx_lock(sc-sc_mtx);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265675 - stable/9/sys/geom/raid

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:39:07 2014
New Revision: 265675
URL: http://svnweb.freebsd.org/changeset/base/265675

Log:
  MFC r265054:
  Reduce number of opens by REOM RAID during provider taste.
  
  Instead opening/closing provider by each of metadata classes, do it only
  once in core code.  Since for SCSI disks open/close means sending some
  SCSI commands to the device, this change reduces taste time.

Modified:
  stable/9/sys/geom/raid/g_raid.c
  stable/9/sys/geom/raid/md_ddf.c
  stable/9/sys/geom/raid/md_intel.c
  stable/9/sys/geom/raid/md_jmicron.c
  stable/9/sys/geom/raid/md_nvidia.c
  stable/9/sys/geom/raid/md_promise.c
  stable/9/sys/geom/raid/md_sii.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/raid/g_raid.c
==
--- stable/9/sys/geom/raid/g_raid.c Thu May  8 12:35:37 2014
(r265674)
+++ stable/9/sys/geom/raid/g_raid.c Thu May  8 12:39:07 2014
(r265675)
@@ -2249,6 +2249,8 @@ g_raid_taste(struct g_class *mp, struct 
return (NULL);
G_RAID_DEBUG(2, Tasting provider %s., pp-name);
 
+   geom = NULL;
+   status = G_RAID_MD_TASTE_FAIL;
gp = g_new_geomf(mp, raid:taste);
/*
 * This orphan function should be never called.
@@ -2256,8 +2258,9 @@ g_raid_taste(struct g_class *mp, struct 
gp-orphan = g_raid_taste_orphan;
cp = g_new_consumer(gp);
g_attach(cp, pp);
+   if (g_access(cp, 1, 0, 0) != 0)
+   goto ofail;
 
-   geom = NULL;
LIST_FOREACH(class, g_raid_md_classes, mdc_list) {
if (!class-mdc_enable)
continue;
@@ -2273,6 +2276,9 @@ g_raid_taste(struct g_class *mp, struct 
break;
}
 
+   if (status == G_RAID_MD_TASTE_FAIL)
+   (void)g_access(cp, -1, 0, 0);
+ofail:
g_detach(cp);
g_destroy_consumer(cp);
g_destroy_geom(gp);

Modified: stable/9/sys/geom/raid/md_ddf.c
==
--- stable/9/sys/geom/raid/md_ddf.c Thu May  8 12:35:37 2014
(r265674)
+++ stable/9/sys/geom/raid/md_ddf.c Thu May  8 12:39:07 2014
(r265675)
@@ -2120,13 +2120,10 @@ g_raid_md_taste_ddf(struct g_raid_md_obj
pp = cp-provider;
 
/* Read metadata from device. */
-   if (g_access(cp, 1, 0, 0) != 0)
-   return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
bzero(meta, sizeof(meta));
error = ddf_meta_read(cp, meta);
g_topology_lock();
-   g_access(cp, -1, 0, 0);
if (error != 0)
return (G_RAID_MD_TASTE_FAIL);
be = meta.bigendian;
@@ -2164,6 +2161,9 @@ g_raid_md_taste_ddf(struct g_raid_md_obj
geom = sc-sc_geom;
}
 
+   /* There is no return after this point, so we close passed consumer. */
+   g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
g_attach(rcp, pp);
if (g_access(rcp, 1, 1, 1) != 0)

Modified: stable/9/sys/geom/raid/md_intel.c
==
--- stable/9/sys/geom/raid/md_intel.c   Thu May  8 12:35:37 2014
(r265674)
+++ stable/9/sys/geom/raid/md_intel.c   Thu May  8 12:39:07 2014
(r265675)
@@ -1382,8 +1382,6 @@ g_raid_md_taste_intel(struct g_raid_md_o
meta = NULL;
vendor = 0x;
disk_pos = 0;
-   if (g_access(cp, 1, 0, 0) != 0)
-   return (G_RAID_MD_TASTE_FAIL);
g_topology_unlock();
error = g_raid_md_get_label(cp, serial, sizeof(serial));
if (error != 0) {
@@ -1396,7 +1394,6 @@ g_raid_md_taste_intel(struct g_raid_md_o
g_io_getattr(GEOM::hba_vendor, cp, len, vendor);
meta = intel_meta_read(cp);
g_topology_lock();
-   g_access(cp, -1, 0, 0);
if (meta == NULL) {
if (g_raid_aggressive_spare) {
if (vendor != 0x8086) {
@@ -1476,6 +1473,9 @@ search:
G_RAID_DEBUG1(1, sc, root_mount_hold %p, mdi-mdio_rootmount);
}
 
+   /* There is no return after this point, so we close passed consumer. */
+   g_access(cp, -1, 0, 0);
+
rcp = g_new_consumer(geom);
g_attach(rcp, pp);
if (g_access(rcp, 1, 1, 1) != 0)
@@ -1511,7 +1511,6 @@ search:
return (result);
 fail2:
g_topology_lock();
-   g_access(cp, -1, 0, 0);
 fail1:
free(meta, M_MD_INTEL);
return (G_RAID_MD_TASTE_FAIL);

Modified: stable/9/sys/geom/raid/md_jmicron.c
==
--- stable/9/sys/geom/raid/md_jmicron.c Thu May  8 12:35:37 2014
(r265674)
+++ stable/9/sys/geom/raid/md_jmicron.c Thu May  8 12:39:07 2014
(r265675)
@@ -837,15 +837,12 @@ 

svn commit: r265676 - stable/9/sys/geom/stripe

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 12:50:31 2014
New Revision: 265676
URL: http://svnweb.freebsd.org/changeset/base/265676

Log:
  MFC r264313:
  Do not increment bio_data in case of BIO_DELETE.
  
  This fixes KASSERT() panic in g_io_request().

Modified:
  stable/9/sys/geom/stripe/g_stripe.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/geom/stripe/g_stripe.c
==
--- stable/9/sys/geom/stripe/g_stripe.c Thu May  8 12:39:07 2014
(r265675)
+++ stable/9/sys/geom/stripe/g_stripe.c Thu May  8 12:50:31 2014
(r265676)
@@ -462,9 +462,10 @@ g_stripe_start_economic(struct bio *bp, 
 
/* offset -= offset % stripesize; */
offset -= offset  (stripesize - 1);
-   addr += length;
+   if (bp-bio_cmd != BIO_DELETE)
+   addr += length;
length = bp-bio_length - length;
-   for (no++; length  0; no++, length -= stripesize, addr += stripesize) {
+   for (no++; length  0; no++, length -= stripesize) {
if (no  sc-sc_ndisks - 1) {
no = 0;
offset += stripesize;
@@ -489,6 +490,9 @@ g_stripe_start_economic(struct bio *bp, 
cbp-bio_length = MIN(stripesize, length);
 
cbp-bio_caller2 = sc-sc_disks[no];
+
+   if (bp-bio_cmd != BIO_DELETE)
+   addr += stripesize;
}
/*
 * Fire off all allocated requests!
@@ -613,9 +617,12 @@ g_stripe_start(struct bio *bp)
 * 3. Request size is bigger than stripesize * ndisks. If it isn't,
 *there will be no need to send more than one I/O request to
 *a provider, so there is nothing to optmize.
+* and
+* 5. It is not a BIO_DELETE.
 */
if (g_stripe_fast  bp-bio_length = MAXPHYS 
-   bp-bio_length = stripesize * sc-sc_ndisks) {
+   bp-bio_length = stripesize * sc-sc_ndisks 
+   bp-bio_cmd != BIO_DELETE) {
fast = 1;
}
error = 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 13:10:39 2014
New Revision: 265677
URL: http://svnweb.freebsd.org/changeset/base/265677

Log:
  MFC r264086:
  3580 Want zvols to return volblocksize when queried for physical block size
  
  illumos/illumos-gate@a0b60564dfc644f4bfaef1ce26d343b44cf68bc5
  
  It is irrelevant for FreeBSD, just reducing diff.

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

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu May 
 8 12:50:31 2014(r265676)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu May 
 8 13:10:39 2014(r265677)
@@ -1723,8 +1723,6 @@ int
 zvol_ioctl(dev_t dev, int cmd, intptr_t arg, int flag, cred_t *cr, int *rvalp)
 {
zvol_state_t *zv;
-   struct dk_cinfo dki;
-   struct dk_minfo dkm;
struct dk_callback *dkc;
int error = 0;
rl_t *rl;
@@ -1742,6 +1740,9 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t 
switch (cmd) {
 
case DKIOCINFO:
+   {
+   struct dk_cinfo dki;
+
bzero(dki, sizeof (dki));
(void) strcpy(dki.dki_cname, zvol);
(void) strcpy(dki.dki_dname, zvol);
@@ -1752,8 +1753,12 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t 
if (ddi_copyout(dki, (void *)arg, sizeof (dki), flag))
error = SET_ERROR(EFAULT);
return (error);
+   }
 
case DKIOCGMEDIAINFO:
+   {
+   struct dk_minfo dkm;
+
bzero(dkm, sizeof (dkm));
dkm.dki_lbsize = 1U  zv-zv_min_bs;
dkm.dki_capacity = zv-zv_volsize  zv-zv_min_bs;
@@ -1762,16 +1767,32 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t 
if (ddi_copyout(dkm, (void *)arg, sizeof (dkm), flag))
error = SET_ERROR(EFAULT);
return (error);
+   }
+
+   case DKIOCGMEDIAINFOEXT:
+   {
+   struct dk_minfo_ext dkmext;
+
+   bzero(dkmext, sizeof (dkmext));
+   dkmext.dki_lbsize = 1U  zv-zv_min_bs;
+   dkmext.dki_pbsize = zv-zv_volblocksize;
+   dkmext.dki_capacity = zv-zv_volsize  zv-zv_min_bs;
+   dkmext.dki_media_type = DK_UNKNOWN;
+   mutex_exit(spa_namespace_lock);
+   if (ddi_copyout(dkmext, (void *)arg, sizeof (dkmext), flag))
+   error = SET_ERROR(EFAULT);
+   return (error);
+   }
 
case DKIOCGETEFI:
-   {
-   uint64_t vs = zv-zv_volsize;
-   uint8_t bs = zv-zv_min_bs;
+   {
+   uint64_t vs = zv-zv_volsize;
+   uint8_t bs = zv-zv_min_bs;
 
-   mutex_exit(spa_namespace_lock);
-   error = zvol_getefi((void *)arg, flag, vs, bs);
-   return (error);
-   }
+   mutex_exit(spa_namespace_lock);
+   error = zvol_getefi((void *)arg, flag, vs, bs);
+   return (error);
+   }
 
case DKIOCFLUSHWRITECACHE:
dkc = (struct dk_callback *)arg;
@@ -1784,31 +1805,31 @@ zvol_ioctl(dev_t dev, int cmd, intptr_t 
return (error);
 
case DKIOCGETWCE:
-   {
-   int wce = (zv-zv_flags  ZVOL_WCE) ? 1 : 0;
-   if (ddi_copyout(wce, (void *)arg, sizeof (int),
-   flag))
-   error = SET_ERROR(EFAULT);
+   {
+   int wce = (zv-zv_flags  ZVOL_WCE) ? 1 : 0;
+   if (ddi_copyout(wce, (void *)arg, sizeof (int),
+   flag))
+   error = SET_ERROR(EFAULT);
+   break;
+   }
+   case DKIOCSETWCE:
+   {
+   int wce;
+   if (ddi_copyin((void *)arg, wce, sizeof (int),
+   flag)) {
+   error = SET_ERROR(EFAULT);
break;
}
-   case DKIOCSETWCE:
-   {
-   int wce;
-   if (ddi_copyin((void *)arg, wce, sizeof (int),
-   flag)) {
-   error = SET_ERROR(EFAULT);
-   break;
-   }
-   if (wce) {
-   zv-zv_flags |= ZVOL_WCE;
-   mutex_exit(spa_namespace_lock);
-   } else {
-   zv-zv_flags = ~ZVOL_WCE;
-   mutex_exit(spa_namespace_lock);
-   zil_commit(zv-zv_zilog, ZVOL_OBJ);
-   }
-   return 

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

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 13:12:24 2014
New Revision: 265678
URL: http://svnweb.freebsd.org/changeset/base/265678

Log:
  MFC r264145:
  Add property and sysctl to control how ZVOLs are exposed to OS.
  
  New ZFS property volmode and sysctl vfs.zfs.vol.mode allow switching ZVOL
  between three modes:
   geom -- existing fully functional behavior (default);
   dev -- exposing volumes only as raw disk device file in devfs;
   none -- not exposing volumes outside ZFS.
  
  The dev mode is less functional (can't be partitioned, mounted, etc),
  but it is faster, and in some scenarios with untrusted consumers safer.
  It can be useful for NAS, VM block storages, etc.
  The none mode may be convenient for backup servers, etc. that don't
  need direct data access.
  
  Due to the way ZVOL is integrated with main ZFS code, those property
  and sysctl are checked only during pool import and volume creation.

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

Modified: stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8
==
--- stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8Thu May  8 13:10:39 
2014(r265677)
+++ stable/10/cddl/contrib/opensolaris/cmd/zfs/zfs.8Thu May  8 13:12:24 
2014(r265678)
@@ -30,7 +30,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd March 20, 2014
+.Dd April 5, 2014
 .Dt ZFS 8
 .Os
 .Sh NAME
@@ -1306,6 +1306,38 @@ Consequently, writes to a sparse volume 
 when the pool is low on space. For a sparse volume, changes to
 .Sy volsize
 are not reflected in the reservation.
+.It Sy volmode Ns = Ns Cm default | geom | dev | none
+This property specifies how volumes should be exposed to the OS.
+Setting it to
+.Sy geom
+exposes volumes as
+.Xr geom 4
+providers, providing maximal functionality.
+Setting it to
+.Sy dev
+exposes volumes only as cdev device in devfs.
+Such volumes can be accessed only as raw disk device files, i.e. they
+can not be partitioned, mounted, participate in RAIDs, etc, but they
+are faster, and in some use scenarios with untrusted consumer, such as
+NAS or VM storage, can be more safe.
+Volumes with property set to
+.Sy none
+are not exposed outside ZFS, but can be snapshoted, cloned, replicated, etc,
+that can be suitable for backup purposes.
+Value
+.Sy default
+means that volumes exposition is controlled by system-wide sysctl/tunable
+.Va vfs.zfs.vol.mode ,
+where
+.Sy geom ,
+.Sy dev
+and
+.Sy none
+are encoded as 1, 2 and 3 respectively.
+The default values is
+.Sy geom .
+This property can be changed any time, but so far it is processed only
+during volume creation and pool import.
 .It Sy vscan Ns = Ns Cm off | on
 The
 .Sy vscan

Modified: stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c
==
--- stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.cThu May 
 8 13:10:39 2014(r265677)
+++ stable/10/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.cThu May 
 8 13:12:24 2014(r265678)
@@ -198,6 +198,14 @@ zfs_prop_init(void)
{ NULL }
};
 
+   static zprop_index_t volmode_table[] = {
+   { default,ZFS_VOLMODE_DEFAULT },
+   { geom,   ZFS_VOLMODE_GEOM },
+   { dev,ZFS_VOLMODE_DEV },
+   { none,   ZFS_VOLMODE_NONE },
+   { NULL }
+   };
+
/* inherit index properties */
zprop_register_index(ZFS_PROP_SYNC, sync, ZFS_SYNC_STANDARD,
PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
@@ -242,6 +250,10 @@ zfs_prop_init(void)
zprop_register_index(ZFS_PROP_LOGBIAS, logbias, ZFS_LOGBIAS_LATENCY,
PROP_INHERIT, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME,
latency | throughput, LOGBIAS, logbias_table);
+   zprop_register_index(ZFS_PROP_VOLMODE, volmode,
+   ZFS_VOLMODE_DEFAULT, PROP_INHERIT,
+   ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT | ZFS_TYPE_VOLUME,
+   default | geom | dev | none, VOLMODE, volmode_table);
 
/* inherit index (boolean) properties */
zprop_register_index(ZFS_PROP_ATIME, atime, 1, PROP_INHERIT,

Modified: stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c
==
--- stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu May 
 8 13:10:39 2014(r265677)
+++ stable/10/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Thu May 
 8 13:12:24 2014(r265678)
@@ -66,6 +66,7 @@
 #include sys/spa.h
 #include sys/spa_impl.h
 #include sys/zio.h
+#include sys/disk.h
 #include sys/dmu_traverse.h
 

svn commit: r265679 - stable/10/sys/cddl/compat/opensolaris/sys

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 13:31:01 2014
New Revision: 265679
URL: http://svnweb.freebsd.org/changeset/base/265679

Log:
  MFC r260234, r260328:
  Remove extra conversion to nanoseconds from ddi_get_lbolt64().
  
  As result this uses one multiplication and shifts instead of one division
  and two multiplications.

Modified:
  stable/10/sys/cddl/compat/opensolaris/sys/time.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cddl/compat/opensolaris/sys/time.h
==
--- stable/10/sys/cddl/compat/opensolaris/sys/time.hThu May  8 13:12:24 
2014(r265678)
+++ stable/10/sys/cddl/compat/opensolaris/sys/time.hThu May  8 13:31:01 
2014(r265679)
@@ -71,19 +71,9 @@ gethrtime(void) {
 
 extern int nsec_per_tick;  /* nanoseconds per clock tick */
 
-static __inline int64_t
-ddi_get_lbolt64(void)
-{
-
-   return (gethrtime() / nsec_per_tick);
-}
-
-static __inline clock_t
-ddi_get_lbolt(void)
-{
-
-   return (ddi_get_lbolt64());
-}
+#define ddi_get_lbolt64()  \
+(int64_t)(((getsbinuptime()  16) * hz)  16)
+#define ddi_get_lbolt()(clock_t)ddi_get_lbolt64()
 
 #else
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265680 - head/sys/dev/vt/hw/fb

2014-05-08 Thread Aleksandr Rybalko
Author: ray
Date: Thu May  8 13:38:29 2014
New Revision: 265680
URL: http://svnweb.freebsd.org/changeset/base/265680

Log:
  No need to assign fields required and checked on probe.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/hw/fb/vt_early_fb.c

Modified: head/sys/dev/vt/hw/fb/vt_early_fb.c
==
--- head/sys/dev/vt/hw/fb/vt_early_fb.c Thu May  8 13:31:01 2014
(r265679)
+++ head/sys/dev/vt/hw/fb/vt_early_fb.c Thu May  8 13:38:29 2014
(r265680)
@@ -291,13 +291,6 @@ vt_efb_init(struct vt_device *vd)
/* Get pixel storage size. */
info-fb_bpp = info-fb_stride / info-fb_width * 8;
 
-   /*
-* Early FB driver work with static window buffer 80x25, so reduce
-* size to 640x480.
-*/
-   info-fb_width = VT_FB_DEFAULT_WIDTH;
-   info-fb_height = VT_FB_DEFAULT_HEIGHT;
-
 #ifdef FDT
vt_efb_initialize(info, node);
 #else
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265681 - head/sys/dev/vt

2014-05-08 Thread Aleksandr Rybalko
Author: ray
Date: Thu May  8 13:46:36 2014
New Revision: 265681
URL: http://svnweb.freebsd.org/changeset/base/265681

Log:
  Fix scrollback.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_buf.c
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_buf.c
==
--- head/sys/dev/vt/vt_buf.cThu May  8 13:38:29 2014(r265680)
+++ head/sys/dev/vt/vt_buf.cThu May  8 13:46:36 2014(r265681)
@@ -448,8 +448,9 @@ vtbuf_grow(struct vt_buf *vb, const term
 
history_size = MAX(history_size, p-tp_row);
 
-   if (history_size  vb-vb_history_size || p-tp_col 
-   vb-vb_scr_size.tp_col) {
+   /* If new screen/history size bigger or buffer is VBF_STATIC. */
+   if ((history_size  vb-vb_history_size) || (p-tp_col 
+   vb-vb_scr_size.tp_col) || (vb-vb_flags  VBF_STATIC)) {
/* Allocate new buffer. */
bufsize = history_size * p-tp_col * sizeof(term_char_t);
new = malloc(bufsize, M_VTBUF, M_WAITOK | M_ZERO);

Modified: head/sys/dev/vt/vt_core.c
==
--- head/sys/dev/vt/vt_core.c   Thu May  8 13:38:29 2014(r265680)
+++ head/sys/dev/vt/vt_core.c   Thu May  8 13:46:36 2014(r265681)
@@ -2016,6 +2016,10 @@ vt_upgrade(struct vt_device *vd)
/* Start timer when everything ready. */
callout_reset(vd-vd_timer, hz / VT_TIMERFREQ, vt_timer, vd);
VT_UNLOCK(vd);
+
+   /* Refill settings with new sizes. */
+   vt_resize(vd);
+
 }
 
 static void
@@ -2090,9 +2094,6 @@ vt_allocate(struct vt_driver *drv, void 
 
vt_upgrade(vd);
 
-   /* Refill settings with new sizes. */
-   vt_resize(vd);
-
 #ifdef DEV_SPLASH
if (vd-vd_flags  VDF_SPLASH)
vtterm_splash(vd);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265682 - head/sys/net

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 13:54:57 2014
New Revision: 265682
URL: http://svnweb.freebsd.org/changeset/base/265682

Log:
  Rename rt_msg1() to more handy rtsock_msg_mbuf().
  (Just for history purposes: rt_msg2() was renamed
   to rtsock_msg_buffer() in r265019).
  
  Sponsored by: Yandex LLC
  MFC after:1 month

Modified:
  head/sys/net/rtsock.c

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Thu May  8 13:46:36 2014(r265681)
+++ head/sys/net/rtsock.c   Thu May  8 13:54:57 2014(r265682)
@@ -151,7 +151,7 @@ struct walkarg {
 };
 
 static voidrts_input(struct mbuf *m);
-static struct mbuf *rt_msg1(int type, struct rt_addrinfo *rtinfo);
+static struct mbuf *rtsock_msg_mbuf(int type, struct rt_addrinfo *rtinfo);
 static int rtsock_msg_buffer(int type, struct rt_addrinfo *rtinfo,
struct walkarg *w, int *plen);
 static int rt_xaddrs(caddr_t cp, caddr_t cplim,
@@ -989,10 +989,14 @@ rtsock_fix_netmask(struct sockaddr *dst,
 }
 
 /*
- * Used by the routing socket.
+ * Writes information related to @rtinfo object to newly-allocated mbuf.
+ * Assumes MCLBYTES is enough to construct any message.
+ * Used for OS notifications of vaious events (if/ifa announces,etc)
+ *
+ * Returns allocated mbuf or NULL on failure.
  */
 static struct mbuf *
-rt_msg1(int type, struct rt_addrinfo *rtinfo)
+rtsock_msg_mbuf(int type, struct rt_addrinfo *rtinfo)
 {
struct rt_msghdr *rtm;
struct mbuf *m;
@@ -1204,7 +1208,7 @@ rt_missmsg_fib(int type, struct rt_addri
 
if (V_route_cb.any_count == 0)
return;
-   m = rt_msg1(type, rtinfo);
+   m = rtsock_msg_mbuf(type, rtinfo);
if (m == NULL)
return;
 
@@ -1243,7 +1247,7 @@ rt_ifmsg(struct ifnet *ifp)
if (V_route_cb.any_count == 0)
return;
bzero((caddr_t)info, sizeof(info));
-   m = rt_msg1(RTM_IFINFO, info);
+   m = rtsock_msg_mbuf(RTM_IFINFO, info);
if (m == NULL)
return;
ifm = mtod(m, struct if_msghdr *);
@@ -1282,7 +1286,7 @@ rtsock_addrmsg(int cmd, struct ifaddr *i
info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(
info.rti_info[RTAX_IFP], ifa-ifa_netmask, ss);
info.rti_info[RTAX_BRD] = ifa-ifa_dstaddr;
-   if ((m = rt_msg1(ncmd, info)) == NULL)
+   if ((m = rtsock_msg_mbuf(ncmd, info)) == NULL)
return (ENOBUFS);
ifam = mtod(m, struct ifa_msghdr *);
ifam-ifam_index = ifp-if_index;
@@ -1328,7 +1332,7 @@ rtsock_routemsg(int cmd, struct ifnet *i
info.rti_info[RTAX_DST] = sa = rt_key(rt);
info.rti_info[RTAX_NETMASK] = rtsock_fix_netmask(sa, rt_mask(rt), ss);
info.rti_info[RTAX_GATEWAY] = rt-rt_gateway;
-   if ((m = rt_msg1(cmd, info)) == NULL)
+   if ((m = rtsock_msg_mbuf(cmd, info)) == NULL)
return (ENOBUFS);
rtm = mtod(m, struct rt_msghdr *);
rtm-rtm_index = ifp-if_index;
@@ -1370,7 +1374,7 @@ rt_newmaddrmsg(int cmd, struct ifmultiad
 * (similarly to how ARP entries, e.g., are presented).
 */
info.rti_info[RTAX_GATEWAY] = ifma-ifma_lladdr;
-   m = rt_msg1(cmd, info);
+   m = rtsock_msg_mbuf(cmd, info);
if (m == NULL)
return;
ifmam = mtod(m, struct ifma_msghdr *);
@@ -1391,7 +1395,7 @@ rt_makeifannouncemsg(struct ifnet *ifp, 
if (V_route_cb.any_count == 0)
return NULL;
bzero((caddr_t)info, sizeof(*info));
-   m = rt_msg1(type, info);
+   m = rtsock_msg_mbuf(type, info);
if (m != NULL) {
ifan = mtod(m, struct if_announcemsghdr *);
ifan-ifan_index = ifp-if_index;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265683 - stable/8/sys/dev/sym

2014-05-08 Thread Marius Strobl
Author: marius
Date: Thu May  8 14:28:51 2014
New Revision: 265683
URL: http://svnweb.freebsd.org/changeset/base/265683

Log:
  MFC: r251394
  
  CAM_DEV_QFREEZE handling should only be done on request submission but
  neither on completion nor by SIM drivers in the first place. This issue
  has been revealed by r249466 (MFC'ed to stable/8 in r265147).

Modified:
  stable/8/sys/dev/sym/sym_hipd.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/dev/   (props changed)
  stable/8/sys/dev/sym/   (props changed)

Modified: stable/8/sys/dev/sym/sym_hipd.c
==
--- stable/8/sys/dev/sym/sym_hipd.c Thu May  8 13:54:57 2014
(r265682)
+++ stable/8/sys/dev/sym/sym_hipd.c Thu May  8 14:28:51 2014
(r265683)
@@ -2349,17 +2349,6 @@ static void sym_enqueue_cam_ccb(ccb_p cp
 /*
  *  Complete a pending CAM CCB.
  */
-static void _sym_xpt_done(hcb_p np, union ccb *ccb)
-{
-   SYM_LOCK_ASSERT(MA_OWNED);
-
-   KASSERT((ccb-ccb_h.status  CAM_SIM_QUEUED) == 0,
-   (%s: status=CAM_SIM_QUEUED, __func__));
-
-   if (ccb-ccb_h.flags  CAM_DEV_QFREEZE)
-   sym_freeze_cam_ccb(ccb);
-   xpt_done(ccb);
-}
 
 static void sym_xpt_done(hcb_p np, union ccb *ccb, ccb_p cp)
 {
@@ -2371,7 +2360,7 @@ static void sym_xpt_done(hcb_p np, union
ccb-ccb_h.status = ~CAM_SIM_QUEUED;
ccb-ccb_h.sym_hcb_ptr = NULL;
}
-   _sym_xpt_done(np, ccb);
+   xpt_done(ccb);
 }
 
 static void sym_xpt_done2(hcb_p np, union ccb *ccb, int cam_status)
@@ -2379,7 +2368,7 @@ static void sym_xpt_done2(hcb_p np, unio
SYM_LOCK_ASSERT(MA_OWNED);
 
sym_set_cam_status(ccb, cam_status);
-   _sym_xpt_done(np, ccb);
+   xpt_done(ccb);
 }
 
 /*
@@ -8962,7 +8951,7 @@ static int sym_cam_attach(hcb_p np)
goto fail;
np-sim = sim;
 
-   if (xpt_create_path(path, 0,
+   if (xpt_create_path(path, NULL,
cam_sim_path(np-sim), CAM_TARGET_WILDCARD,
CAM_LUN_WILDCARD) != CAM_REQ_CMP) {
goto fail;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265472 - head/bin/dd

2014-05-08 Thread Alan Somers
On Wed, May 7, 2014 at 9:39 PM, Bruce Evans b...@optusnet.com.au wrote:
 On Wed, 7 May 2014, Jilles Tjoelker wrote:

 On Wed, May 07, 2014 at 12:10:31PM -0600, Alan Somers wrote:

 On Tue, May 6, 2014 at 9:47 PM, Bruce Evans b...@optusnet.com.au wrote:

 On Tue, 6 May 2014, Alan Somers wrote:

 ...

  The solution is to use clock_gettime(2) with CLOCK_MONOTONIC_PRECISE
 as
 the
  clock_id.  That clock advances steadily, regardless of changes to the
 system
  clock.
 ...
 +#include sysexits.h


 Use of sysexits.h is a style bug.  It is not used in BSD or KNF code
 like dd used to be.


 sysexits.h is recommended by the err(3) man page.  Is that
 recommendation meant to apply selectively, or is it obsolete, or is
 some sort of edit war being waged by man page authors?


 Bug in the err(3) man page.  Sort of an edit war.  Just 2 FreeBSD
 committers liked sysexits and used it in their code and added a
 recommendation to use it in some man pages.  But it has negative
 advantages, and normal BSD programs don't use it.  It has been
 edited in and out of style(9).


 The recommendation for sysexits.h was incompletely removed, yes.


 It is still in err(3), and sysexits(3) still justifies itself by
 pointing to partly-removed words in style(9).

 err(3) is the last place that should recommend using sysexits.  err()
 gives a nice way of encouraging text descriptions for all exits.
 With text descriptions, there is almost no need for cryptic numeric
 exit codes.  Only sets of programs that communicate a little status
 in the exit code should use sysexits (or perhaps their own exit
 codes, or certain standard exit codes like 126 or 127 for xargs and
 some other utilities).  Some of the uses of the standard exit codes
 are even.  I don't know of any utility except possibly sendmail that
 documents that it uses sysexits enough for its exit codes to be
 useful for more than a binary success/fail decision.  Certainly not
 dd after these changes.  If its use of sysexits were documented,
 then the documentation would say dd uses sysexits to report 3 errors
 that can't happen; otherwise, it uses the normal 2-state exit codes
 (there is a macro for them.  It expands to the concise but
 grammatically challenged exits 0 on success, and 0 if an error
 occurs.  Here 0 standardises the usual sloppiness of not
 distinguishing codes between 1 and 127).

 sysexits(3) now says:

 % DESCRIPTION
 %  According to style(9), it is not a good practice to call exit(3) with
 %  arbitrary values to indicate a failure condition when ending a
 program.
 %  Instead, the pre-defined exit codes from sysexits should be used, so
 the
 %  caller of the process can get a rough estimation about the failure
 class
 %  without looking up the source code.

 but style(9) now says:

 %  Exits should be 0 on success, or 1 on failure.
 % %  exit(0);/*
 %   * Avoid obvious comments such as
 %   * Exit 0 on success.
 %   */
 %  }

 The latter is not what I asked for either.  In previous discussion
 of this, I think we agreed to at least mention EXIT_SUCCESS and
 EXIT_FAILURE, and possibly deprecate sysexits.

 This is a weakened version of the 4.4BSD style rules, which say:

 %   /*
 %* Exits should be 0 on success, and 1 on failure.  Don't denote
 %* all the possible exit points, using the integers 1 through 300.
 %*/
 %   exit(0);/* Avoid obvious comments such as Exit 0 on success.
 */

 The main point of this is to disallow cryptic undocumented exit statuses.
 Recommending sysexits almost reverses this.  It gives cryptic undocumented
 error statuses that are not even easy to decrypt for programs.  Programs
 can look up sysexits, but without documentation there is no guarantee that
 the encoding is according to sysexits.  Actually documenting use of
 sysexits would make it even more painful to use.


 [snip]

 -   st.start = tv.tv_sec + tv.tv_usec * 1e-6;
 +   if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv))
 +   err(EX_OSERR, clock_gettime);

 [snip]

 +   st.start = tv.tv_sec + tv.tv_nsec * 1.0e-9;
 }


 The floating point addition starts losing precision after 8388608
 seconds (slightly more than 97 days, a plausible uptime for a server).
 It is better to subtract the timespecs to avoid this issue.


 No, it is better to use floating point for results that only need to
 be approximate.  Especially when the inputs are approximate and the
 final approximation doesn't need to be very accurate.

 Floating point is good for all timespec and timeval calculations,
 except in the kernel where it is unavailable.  timespecs and timevals
 are mostly used for timeouts, and the kernel isn't very careful about
 exact timeouts.  Short timeouts have inherent large inaccuracy due
 to interrupt granularity and latency.  Long timeouts can be relatively
 more accurate, but only if the 

svn commit: r265686 - head

2014-05-08 Thread Warner Losh
Author: imp
Date: Thu May  8 15:58:34 2014
New Revision: 265686
URL: http://svnweb.freebsd.org/changeset/base/265686

Log:
  Add usr/share/mk/src.opts.mk to obsolete files. It never should have
  been installed in the first place, and it must be removed ASAP or
  weird build errors may start happening in the future if this file is
  ever taken from the installed system. Add note to UPDATING.

Modified:
  head/ObsoleteFiles.inc
  head/UPDATING

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Thu May  8 15:33:52 2014(r265685)
+++ head/ObsoleteFiles.inc  Thu May  8 15:58:34 2014(r265686)
@@ -38,6 +38,8 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20140505: Bogusly installing src.opts.mk
+OLD_FILES+=usr/share/mk/src.opts.mk
 # 20140505: Reject PR kern/187551
 OLD_DIRS+=usr/tests/sbin/ifconfig
 OLD_FILES+=usr/tests/sbin/ifconfig/Kyuafile

Modified: head/UPDATING
==
--- head/UPDATING   Thu May  8 15:33:52 2014(r265685)
+++ head/UPDATING   Thu May  8 15:58:34 2014(r265686)
@@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
disable the most expensive debugging functionality run
ln -s 'abort:false,junk:false' /etc/malloc.conf.)
 
+20140508:
+   We bogusly installed src.opts.mk in /usr/share/mk. This file should
+   be removed to avoid issues in the future (and has been added to
+   ObsoleteFiles.inc).
+
 20140505:
/etc/src.conf now affects only builds of the FreeBSD src tree. In the
past, it affected all builds that used the bsd.*.mk files. The old
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


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

2014-05-08 Thread Brooks Davis
Author: brooks
Date: Thu May  8 16:12:38 2014
New Revision: 265687
URL: http://svnweb.freebsd.org/changeset/base/265687

Log:
  MFC r265201
  
  Fix a 2038 bug.
  
  If time_t is 64-bit (i.e. isn't 32-bit) allow any value of year, not
  just years less than 2038.
  
  Don't bother fixing the underflow in the case of years before 1903.
  
  MFC after:1 week
  Sponsored by: DARPA, AFRL

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

Modified: stable/10/sys/kern/subr_clock.c
==
--- stable/10/sys/kern/subr_clock.c Thu May  8 15:58:34 2014
(r265686)
+++ stable/10/sys/kern/subr_clock.c Thu May  8 16:12:38 2014
(r265687)
@@ -46,6 +46,7 @@ __FBSDID($FreeBSD$);
 #include sys/kernel.h
 #include sys/bus.h
 #include sys/clock.h
+#include sys/limits.h
 #include sys/sysctl.h
 #include sys/timetc.h
 
@@ -147,7 +148,7 @@ clock_ct_to_ts(struct clocktime *ct, str
if (ct-mon  1 || ct-mon  12 || ct-day  1 ||
ct-day  days_in_month(year, ct-mon) ||
ct-hour  23 ||  ct-min  59 || ct-sec  59 ||
-   ct-year  2037) {  /* time_t overflow */
+   (sizeof(time_t) == 4  year  2037)) { /* time_t overflow */
if (ct_debug)
printf( = EINVAL\n);
return (EINVAL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265688 - stable/9/sys/kern

2014-05-08 Thread Brooks Davis
Author: brooks
Date: Thu May  8 16:26:36 2014
New Revision: 265688
URL: http://svnweb.freebsd.org/changeset/base/265688

Log:
  MFC r265201
  
  Fix a 2038 bug.
  
  If time_t is 64-bit (i.e. isn't 32-bit) allow any value of year, not
  just years less than 2038.
  
  Don't bother fixing the underflow in the case of years before 1903.
  
  Sponsored by: DARPA, AFRL

Modified:
  stable/9/sys/kern/subr_clock.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/subr_clock.c
==
--- stable/9/sys/kern/subr_clock.c  Thu May  8 16:12:38 2014
(r265687)
+++ stable/9/sys/kern/subr_clock.c  Thu May  8 16:26:36 2014
(r265688)
@@ -46,6 +46,7 @@ __FBSDID($FreeBSD$);
 #include sys/kernel.h
 #include sys/bus.h
 #include sys/clock.h
+#include sys/limits.h
 #include sys/sysctl.h
 #include sys/timetc.h
 
@@ -147,7 +148,7 @@ clock_ct_to_ts(struct clocktime *ct, str
if (ct-mon  1 || ct-mon  12 || ct-day  1 ||
ct-day  days_in_month(year, ct-mon) ||
ct-hour  23 ||  ct-min  59 || ct-sec  59 ||
-   ct-year  2037) {  /* time_t overflow */
+   (sizeof(time_t) == 4  year  2037)) { /* time_t overflow */
if (ct_debug)
printf( = EINVAL\n);
return (EINVAL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265689 - in head/cddl: compat/opensolaris/include compat/opensolaris/misc lib/libzfs

2014-05-08 Thread Alexander Motin
Author: mav
Date: Thu May  8 16:59:36 2014
New Revision: 265689
URL: http://svnweb.freebsd.org/changeset/base/265689

Log:
  Import adapted OpenSolaris' thread pool API implementation.
  
  The thread pool is used by libzfs to implement parallel disk scanning.
  Without this change our dummy wrapper made `zpool import ZZZ` command to
  scan all disks sequentially from the single thread when searching for pools.
  This change makes it use two threads per CPU, same as in OpenSolaris.
  
  On system with 200 HDDs this change reduces ZFS pool import time from 35
  to 22 seconds.

Added:
  head/cddl/compat/opensolaris/misc/thread_pool.c   (contents, props changed)
  head/cddl/compat/opensolaris/misc/thread_pool_impl.h   (contents, props 
changed)
Modified:
  head/cddl/compat/opensolaris/include/thread_pool.h
  head/cddl/lib/libzfs/Makefile

Modified: head/cddl/compat/opensolaris/include/thread_pool.h
==
--- head/cddl/compat/opensolaris/include/thread_pool.h  Thu May  8 16:26:36 
2014(r265688)
+++ head/cddl/compat/opensolaris/include/thread_pool.h  Thu May  8 16:59:36 
2014(r265689)
@@ -1,39 +1,78 @@
-/*-
- * Copyright (c) 2010 Pawel Jakub Dawidek p...@freebsd.org
- * All rights reserved.
+/*
+ * CDDL HEADER START
  *
- * 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.
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the License).
+ * You may not use this file except in compliance with the License.
  *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHORS 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 AUTHORS 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.
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
  *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets [] replaced with your own identifying
+ * information: Portions Copyright [] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+
+/*
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+/*
  * $FreeBSD$
  */
 
-#ifndef _OPENSOLARIS_THREAD_POOL_H_
-#define _OPENSOLARIS_THREAD_POOL_H_
+#ifndef_THREAD_POOL_H_
+#define_THREAD_POOL_H_
+
+#pragma ident  %Z%%M% %I% %E% SMI
+
+#include sys/types.h
+#include thread.h
+#include pthread.h
+
+#ifdef __cplusplus
+extern C {
+#endif
+
+typedefstruct tpool tpool_t;   /* opaque thread pool descriptor */
+
+#if defined(__STDC__)
+
+extern tpool_t *tpool_create(uint_t min_threads, uint_t max_threads,
+   uint_t linger, pthread_attr_t *attr);
+extern int tpool_dispatch(tpool_t *tpool,
+   void (*func)(void *), void *arg);
+extern voidtpool_destroy(tpool_t *tpool);
+extern voidtpool_abandon(tpool_t *tpool);
+extern voidtpool_wait(tpool_t *tpool);
+extern voidtpool_suspend(tpool_t *tpool);
+extern int tpool_suspended(tpool_t *tpool);
+extern voidtpool_resume(tpool_t *tpool);
+extern int tpool_member(tpool_t *tpool);
+
+#else  /* Non ANSI */
+
+extern tpool_t *tpool_create();
+extern int tpool_dispatch();
+extern voidtpool_destroy();
+extern voidtpool_abandon();
+extern voidtpool_wait();
+extern voidtpool_suspend();
+extern int tpool_suspended();
+extern voidtpool_resume();
+extern int tpool_member();
 
-typedef int tpool_t;
+#endif /* __STDC__ */
 
-#definetpool_create(a, b, c, d)(0)
-#definetpool_dispatch(pool, func, arg) 

svn commit: r265690 - head/sys/arm/xilinx

2014-05-08 Thread Ian Lepore
Author: ian
Date: Thu May  8 17:20:45 2014
New Revision: 265690
URL: http://svnweb.freebsd.org/changeset/base/265690

Log:
  Use edge-triggered interrupts rather than polling loops to avoid missing
  transitions of the INIT_B line.  Also, release the mutex during uiomove().
  
  Submitted by: Thomas Skibo thomassk...@sbcglobal.net

Modified:
  head/sys/arm/xilinx/zy7_devcfg.c

Modified: head/sys/arm/xilinx/zy7_devcfg.c
==
--- head/sys/arm/xilinx/zy7_devcfg.cThu May  8 16:59:36 2014
(r265689)
+++ head/sys/arm/xilinx/zy7_devcfg.cThu May  8 17:20:45 2014
(r265690)
@@ -267,24 +267,35 @@ zy7_devcfg_reset_pl(struct zy7_devcfg_so
 
devcfg_ctl = RD4(sc, ZY7_DEVCFG_CTRL);
 
+   /* Clear sticky bits and set up INIT signal positive edge interrupt. */
+   WR4(sc, ZY7_DEVCFG_INT_STATUS, ZY7_DEVCFG_INT_ALL);
+   WR4(sc, ZY7_DEVCFG_INT_MASK, ~ZY7_DEVCFG_INT_PCFG_INIT_PE);
+
/* Deassert PROG_B (active low). */
devcfg_ctl |= ZY7_DEVCFG_CTRL_PCFG_PROG_B;
WR4(sc, ZY7_DEVCFG_CTRL, devcfg_ctl);
 
-   /* Wait for INIT_B deasserted (active low). */
-   tries = 0;
-   while ((RD4(sc, ZY7_DEVCFG_STATUS) 
-   ZY7_DEVCFG_STATUS_PCFG_INIT) == 0) {
-   if (++tries = 100)
-   return (EIO);
-   DELAY(5);
+   /*
+* Wait for INIT to assert.  If it is already asserted, we may not get
+* an edge interrupt so cancel it and continue.
+*/
+   if ((RD4(sc, ZY7_DEVCFG_STATUS) 
+ZY7_DEVCFG_STATUS_PCFG_INIT) != 0) {
+   /* Already asserted.  Cancel interrupt. */
+   WR4(sc, ZY7_DEVCFG_INT_MASK, ~0);
+   }
+   else {
+   /* Wait for positive edge interrupt. */
+   err = mtx_sleep(sc, sc-sc_mtx, PCATCH, zy7i1, hz);
+   if (err != 0)
+   return (err);
}
-
-   /* Reassert PROG_B. */
+   
+   /* Reassert PROG_B (active low). */
devcfg_ctl = ~ZY7_DEVCFG_CTRL_PCFG_PROG_B;
WR4(sc, ZY7_DEVCFG_CTRL, devcfg_ctl);
 
-   /* Wait for INIT_B asserted. */
+   /* Wait for INIT deasserted.  This happens almost instantly. */
tries = 0;
while ((RD4(sc, ZY7_DEVCFG_STATUS) 
ZY7_DEVCFG_STATUS_PCFG_INIT) != 0) {
@@ -293,7 +304,7 @@ zy7_devcfg_reset_pl(struct zy7_devcfg_so
DELAY(5);
}
 
-   /* Clear sticky bits and set up INIT_B positive edge interrupt. */
+   /* Clear sticky bits and set up INIT positive edge interrupt. */
WR4(sc, ZY7_DEVCFG_INT_STATUS, ZY7_DEVCFG_INT_ALL);
WR4(sc, ZY7_DEVCFG_INT_MASK, ~ZY7_DEVCFG_INT_PCFG_INIT_PE);
 
@@ -301,11 +312,11 @@ zy7_devcfg_reset_pl(struct zy7_devcfg_so
devcfg_ctl |= ZY7_DEVCFG_CTRL_PCFG_PROG_B;
WR4(sc, ZY7_DEVCFG_CTRL, devcfg_ctl);
 
-   /* Wait for INIT_B deasserted indicating FPGA internal initialization
-* is complete.  This takes much longer than the previous waits for
-* INIT_B transition (on the order of 700us).
+   /*
+* Wait for INIT asserted indicating FPGA internal initialization
+* is complete.
 */
-   err = mtx_sleep(sc, sc-sc_mtx, PCATCH, zy7in, hz);
+   err = mtx_sleep(sc, sc-sc_mtx, PCATCH, zy7i2, hz);
if (err != 0)
return (err);
 
@@ -404,7 +415,9 @@ zy7_devcfg_write(struct cdev *dev, struc
 
/* uiomove the data from user buffer to our dma map. */
segsz = MIN(PAGE_SIZE, uio-uio_resid);
+   DEVCFG_SC_UNLOCK(sc);
err = uiomove(dma_mem, segsz, uio);
+   DEVCFG_SC_LOCK(sc);
if (err != 0)
break;
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265691 - head/sys/netinet

2014-05-08 Thread Michael Tuexen
Author: tuexen
Date: Thu May  8 17:27:46 2014
New Revision: 265691
URL: http://svnweb.freebsd.org/changeset/base/265691

Log:
  For some UDP packets (for example with 200 byte payload) and IP options,
  the IP header and the UDP header are not in the same mbuf.
  Add code to in_delayed_cksum() to deal with this case.
  
  MFC after: 3 days

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cThu May  8 17:20:45 2014
(r265690)
+++ head/sys/netinet/ip_output.cThu May  8 17:27:46 2014
(r265691)
@@ -887,15 +887,23 @@ in_delayed_cksum(struct mbuf *m)
csum = 0x;
offset += m-m_pkthdr.csum_data;/* checksum offset */
 
+   /* find the mbuf in the chain where the checksum starts*/
+   while ((m != NULL)  (offset = m-m_len)) {
+   offset -= m-m_len;
+   m = m-m_next;
+   }
+   if (m == NULL) {
+   /* This should not happen. */
+   printf(in_delayed_cksum(): checksum outside mbuf chain.\n);
+   return;
+   }
if (offset + sizeof(u_short)  m-m_len) {
-   printf(delayed m_pullup, m-len: %d  off: %d  p: %d\n,
-   m-m_len, offset, ip-ip_p);
/*
 * XXX
-* this shouldn't happen, but if it does, the
-* correct behavior may be to insert the checksum
-* in the appropriate next mbuf in the chain.
+* This should not happen, but if it does, it might make more
+* sense to fix the caller than to add code to split it here.
 */
+   printf(in_delayed_cksum(): checksum split between mbufs.\n);
return;
}
*(u_short *)(m-m_data + offset) = csum;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265472 - head/bin/dd

2014-05-08 Thread Bruce Evans

On Thu, 8 May 2014, Alan Somers wrote:


On Wed, May 7, 2014 at 9:39 PM, Bruce Evans b...@optusnet.com.au wrote:

On Wed, 7 May 2014, Jilles Tjoelker wrote:


On Wed, May 07, 2014 at 12:10:31PM -0600, Alan Somers wrote:


On Tue, May 6, 2014 at 9:47 PM, Bruce Evans b...@optusnet.com.au wrote:


On Tue, 6 May 2014, Alan Somers wrote:

[snip]


+   st.start = tv.tv_sec + tv.tv_nsec * 1.0e-9;
}



The floating point addition starts losing precision after 8388608
seconds (slightly more than 97 days, a plausible uptime for a server).
It is better to subtract the timespecs to avoid this issue.


No, it is better to use floating point for results that only need to
be approximate.  Especially when the inputs are approximate and the
final approximation doesn't need to be very accurate.

Floating point is good for all timespec and timeval calculations,
except in the kernel where it is unavailable.  timespecs and timevals
are mostly used for timeouts, and the kernel isn't very careful about
exact timeouts.  Short timeouts have inherent large inaccuracy due
to interrupt granularity and latency.  Long timeouts can be relatively
more accurate, but only if the kernel is careful about them.  It is
only careful in some places.


No, Jilles is right.  The problem isn't that dd uses doubles; it's
that dd converts longs to doubles _before_ subtracting the values.
That causes rounding if the tv_sec values are large.  If the
implementation of CLOCK_MONOTONIC ever changed to measure time since
the Epoch, or something similar, then the rounding error would be
extremely significant.  Better to subtract the timespecs, then convert
to double.


Nowhere near a problem.  Conversion from long to double is exact up
to 2**53 seconds or 285 megayears.  So it works for seconds since the
POSIX Epoch although not for seconds since the big bang.  It would be
a problem for floats.

Actually, I didn't notice the fragile conversion order.


With microseconds, the precision of a double is sufficient for 272
years, so that calculation is probably acceptable.


Actually 285 years.  A measly 0.285 years in nanoseconds before exactness
is lost.  The subtraction problem also affects tv_nsec, but is not
very serious since it wouldn't hurt to ignore the nanoseconds part of
a runtime of 0.285 years.  We are 54 years from the Epoch now.  That is
a bit more than 0.285, so we lose a significant part of the nanoseconds
precision.  But we get microseconds precision for 285 years since the
Epoch.  About 5 times that now.


...
Bugs in the boot time can be fixed more easily than by micro-adjusting
the monotonic clock.  Just keep the initial boot time (except adjust it
when it was initially local instead of UTC) and frob the real time
using a different variable.  Export both variables so that applications
can compensate for the frobbing at the cost of some complexity.  E.g.,
in uptime(1):

clock_gettime(CLOCK_UPTIME, ts);
/*
 * Actually, do the compensations in the kernel for CLOCK_UPTIME.
 * It doesn't need to be monotonic.  But suppose it is the same
 * as the unfixed CLOCK_MONOTONIC and compensate here.
 *
 * Also fix the bogus variable name 'tp'.
 */
sysctl_mumble(boottime);
sysctl_mumble(frobbed_boottime);
uptime = ts.tv_sec +- (boottime.tv_sec - frobbed_boottime.tv_sec);

Note that the compensation may go backwards, so this method doesn't work
in general for monotonic times.  However, it can be used if the compensation
is non-negative or relatively small negative.  dd could use this method.
It already has to fix up for zero times and still has parts of the old
method that fixes up for negative times.  Note that the compensation may
be very large across a suspension.  You might start dd, SIGSTOP it, suspend
the system and restart everything a day later.  The compensation would be
about 1 day.  The average from this wouldn't be very useful, but it would
be the same as if dd was stopped for a day but the system was not suspended.


Wouldn't it be simpler just for the kernel to adjust CLOCK_MONOTONIC
to add suspension time?


That works for forward jumps like ones for suspension.

BTW, I do a similar adjustment for suspension that is actually sitting
in ddb.  I only step the real time.  My accuracy is better than 10
ppm.  Good enough for an ntp server.  The stepping is done in rtcintr()
on seconds rollover interrupts 3 seconds after ddb has exited and
remained inactive, occurding to measurements made every 64 seconds
rollover interrupt (the delay is to prevent adjustments while single
stepping).

Nothing much notices this stepping, but for monotonic time you have
to do something about scheduled timeouts.  Strictly, stepping the
monotonic clock forward by a lot should cause many timeouts to expire.
This is the correct behaviour, but it won't happen automatially, and
it would cause thundering herds.  Cron should have similar scheduling
problems after the realtime clock 

svn commit: r265692 - stable/9/sbin/ipfw

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 18:06:44 2014
New Revision: 265692
URL: http://svnweb.freebsd.org/changeset/base/265692

Log:
  Merge r258677.
  
  Fix key lookup in ipfw(8) broken since r232865.
  Print warning for IPv4 address strings which are valid in
  inet_aton() but not valid in inet_pton(). (1)
  
  Found by: Özkan KIRIK ozkan.ki...@gmail.com
  Submitted by: Ian Smith smi...@nimnet.asn.au (1)

Modified:
  stable/9/sbin/ipfw/ipfw2.c
Directory Properties:
  stable/9/sbin/   (props changed)
  stable/9/sbin/ipfw/   (props changed)

Modified: stable/9/sbin/ipfw/ipfw2.c
==
--- stable/9/sbin/ipfw/ipfw2.c  Thu May  8 17:27:46 2014(r265691)
+++ stable/9/sbin/ipfw/ipfw2.c  Thu May  8 18:06:44 2014(r265692)
@@ -4263,13 +4263,24 @@ table_fill_xentry(char *arg, ipfw_table_
addrlen = sizeof(struct in6_addr);
} else {
/* Port or any other key */
-   key = strtol(arg, p, 10);
/* Skip non-base 10 entries like 'fa1' */
-   if (p != arg) {
+   key = strtol(arg, p, 10);
+   if (*p == '\0') {
pkey = (uint32_t *)paddr;
*pkey = htonl(key);
type = IPFW_TABLE_CIDR;
+   masklen = 32;
addrlen = sizeof(uint32_t);
+   } else if ((p != arg)  (*p == '.')) {
+   /*
+* Warn on IPv4 address strings
+* which are valid for inet_aton() but not
+* in inet_pton().
+*
+* Typical examples: '10.5' or '10.0.0.05'
+*/
+   errx(EX_DATAERR,
+   Invalid IPv4 address: %s, arg);
}
}
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

svn commit: r265693 - stable/10/sbin/ipfw

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 18:09:32 2014
New Revision: 265693
URL: http://svnweb.freebsd.org/changeset/base/265693

Log:
  Merge r258677.
  
  Fix key lookup in ipfw(8) broken since r232865.
  Print warning for IPv4 address strings which are valid in
  inet_aton() but not valid in inet_pton(). (1)
  
  Found by:   Özkan KIRIK ozkan.ki...@gmail.com
  Submitted by:   Ian Smith smi...@nimnet.asn.au (1)

Modified:
  stable/10/sbin/ipfw/ipfw2.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/ipfw/ipfw2.c
==
--- stable/10/sbin/ipfw/ipfw2.c Thu May  8 18:06:44 2014(r265692)
+++ stable/10/sbin/ipfw/ipfw2.c Thu May  8 18:09:32 2014(r265693)
@@ -4274,13 +4274,24 @@ table_fill_xentry(char *arg, ipfw_table_
addrlen = sizeof(struct in6_addr);
} else {
/* Port or any other key */
-   key = strtol(arg, p, 10);
/* Skip non-base 10 entries like 'fa1' */
-   if (p != arg) {
+   key = strtol(arg, p, 10);
+   if (*p == '\0') {
pkey = (uint32_t *)paddr;
*pkey = htonl(key);
type = IPFW_TABLE_CIDR;
+   masklen = 32;
addrlen = sizeof(uint32_t);
+   } else if ((p != arg)  (*p == '.')) {
+   /*
+* Warn on IPv4 address strings
+* which are valid for inet_aton() but not
+* in inet_pton().
+*
+* Typical examples: '10.5' or '10.0.0.05'
+*/
+   errx(EX_DATAERR,
+   Invalid IPv4 address: %s, arg);
}
}
}
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org

svn commit: r265694 - in head/sys/arm: arm mv/armadaxp

2014-05-08 Thread Ian Lepore
Author: ian
Date: Thu May  8 18:36:42 2014
New Revision: 265694
URL: http://svnweb.freebsd.org/changeset/base/265694

Log:
  Move the mptramp code which is specific to the Marvell ArmadaXP SoC out of
  the common locore.S file and into the mv/armadaxp directory.

Added:
  head/sys/arm/mv/armadaxp/mptramp.S   (contents, props changed)
Modified:
  head/sys/arm/arm/locore.S
  head/sys/arm/mv/armadaxp/files.armadaxp

Modified: head/sys/arm/arm/locore.S
==
--- head/sys/arm/arm/locore.S   Thu May  8 18:09:32 2014(r265693)
+++ head/sys/arm/arm/locore.S   Thu May  8 18:36:42 2014(r265694)
@@ -349,52 +349,9 @@ pagetable:
.word   _C_LABEL(cpufuncs)
 
 #if defined(SMP)
-Lsramaddr:
-   .word   0x0080
-
-#if 0
-#defineAP_DEBUG(tmp)   \
-   mrc p15, 0, r1, c0, c0, 5;  \
-   ldr r0, Lsramaddr;  \
-   add r0, r1, lsl #2; \
-   mov r1, tmp;\
-   str r1, [r0], #0x;
-#else
-#define AP_DEBUG(tmp)
-#endif
-
-
-ASENTRY_NP(mptramp)
-   mov r0, #0
-   mcr p15, 0, r0, c7, c7, 0
-
-   AP_DEBUG(#1)
-
-   mrs r3, cpsr
-   bic r3, r3, #(PSR_MODE)
-   orr r3, r3, #(PSR_SVC32_MODE)
-msrcpsr_fsxc, r3
-
-   mrc p15, 0, r0, c0, c0, 5
-   and r0, #0x0f   /* Get CPU ID */
-
-   /* Read boot address for CPU */
-   mov r1, #0x100
-   mul r2, r0, r1
-   ldr r1, Lpmureg
-   add r0, r2, r1
-   ldr r1, [r0], #0x00
-
-   mov pc, r1
-
-Lpmureg:
-.word   0xd0022124
-END(mptramp)
 
 ASENTRY_NP(mpentry)
 
-   AP_DEBUG(#2)
-
/* Make sure interrupts are disabled. */
mrs r7, cpsr
orr r7, r7, #(I32_bit|F32_bit)
@@ -417,8 +374,6 @@ ASENTRY_NP(mpentry)
nop
nop
 
-   AP_DEBUG(#3)
-
 Ltag:
ldr r0, Lstartup_pagetable_secondary
bic r0, r0, #0xf000
@@ -435,8 +390,6 @@ Ltag:
mcr p15, 0, r0, c13, c0, 1  /* Set ASID to 0 */
 #endif
 
-   AP_DEBUG(#4)
-
/* Set the Domain Access register.  Very important! */
mov r0, #((DOMAIN_CLIENT  (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
mcr p15, 0, r0, c3, c0, 0

Modified: head/sys/arm/mv/armadaxp/files.armadaxp
==
--- head/sys/arm/mv/armadaxp/files.armadaxp Thu May  8 18:09:32 2014
(r265693)
+++ head/sys/arm/mv/armadaxp/files.armadaxp Thu May  8 18:36:42 2014
(r265694)
@@ -4,3 +4,5 @@ arm/mv/armadaxp/armadaxp.c  standard
 arm/mv/mpic.c  standard
 arm/mv/rtc.c   standard
 arm/mv/armadaxp/armadaxp_mp.c  optional smp
+arm/mv/armadaxp/mptramp.S  optional smp
+

Added: head/sys/arm/mv/armadaxp/mptramp.S
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/mv/armadaxp/mptramp.S  Thu May  8 18:36:42 2014
(r265694)
@@ -0,0 +1,56 @@
+/*-
+ * Copyright 2011 Semihalf
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include machine/asm.h
+#include machine/armreg.h
+
+__FBSDID($FreeBSD$);
+
+ASENTRY_NP(mptramp)
+   mov r0, #0
+   mcr p15, 0, r0, c7, c7, 0
+
+   mrs r3, cpsr
+   bic r3, r3, #(PSR_MODE)
+   orr r3, r3, #(PSR_SVC32_MODE)
+msrcpsr_fsxc, r3
+
+   mrc p15, 0, r0, c0, c0, 5
+   and r0, #0x0f   /* Get CPU ID */
+
+   /* Read boot address for CPU */
+   

svn commit: r265695 - stable/10/share/man/man4

2014-05-08 Thread Christian Brueffer
Author: brueffer
Date: Thu May  8 19:03:04 2014
New Revision: 265695
URL: http://svnweb.freebsd.org/changeset/base/265695

Log:
  MFC: r265360
  
  Remove stray comma.

Modified:
  stable/10/share/man/man4/tnt4882.4
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/share/man/man4/tnt4882.4
==
--- stable/10/share/man/man4/tnt4882.4  Thu May  8 18:36:42 2014
(r265694)
+++ stable/10/share/man/man4/tnt4882.4  Thu May  8 19:03:04 2014
(r265695)
@@ -44,7 +44,7 @@ This chip emulates a NEC \(mcPD7210 cont
 interface between the host computer and the instrument bus.
 .Sh SEE ALSO
 .Xr gpib 3 ,
-.Xr gpib 4 ,
+.Xr gpib 4
 .Sh HISTORY
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265696 - stable/9/share/man/man4

2014-05-08 Thread Christian Brueffer
Author: brueffer
Date: Thu May  8 19:04:54 2014
New Revision: 265696
URL: http://svnweb.freebsd.org/changeset/base/265696

Log:
  MFC: r265360
  
  Remove stray comma.

Modified:
  stable/9/share/man/man4/tnt4882.4
Directory Properties:
  stable/9/share/man/man4/   (props changed)

Modified: stable/9/share/man/man4/tnt4882.4
==
--- stable/9/share/man/man4/tnt4882.4   Thu May  8 19:03:04 2014
(r265695)
+++ stable/9/share/man/man4/tnt4882.4   Thu May  8 19:04:54 2014
(r265696)
@@ -44,7 +44,7 @@ This chip emulates a NEC \(mcPD7210 cont
 interface between the host computer and the instrument bus.
 .Sh SEE ALSO
 .Xr gpib 3 ,
-.Xr gpib 4 ,
+.Xr gpib 4
 .Sh HISTORY
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265697 - stable/8/share/man/man4

2014-05-08 Thread Christian Brueffer
Author: brueffer
Date: Thu May  8 19:08:07 2014
New Revision: 265697
URL: http://svnweb.freebsd.org/changeset/base/265697

Log:
  MFC: r265360
  
  Remove stray comma.

Modified:
  stable/8/share/man/man4/tnt4882.4
Directory Properties:
  stable/8/share/man/man4/   (props changed)

Modified: stable/8/share/man/man4/tnt4882.4
==
--- stable/8/share/man/man4/tnt4882.4   Thu May  8 19:04:54 2014
(r265696)
+++ stable/8/share/man/man4/tnt4882.4   Thu May  8 19:08:07 2014
(r265697)
@@ -44,7 +44,7 @@ This chip emulates a NEC \(mcPD7210 cont
 interface between the host computer and the instrument bus.
 .Sh SEE ALSO
 .Xr gpib 3 ,
-.Xr gpib 4 ,
+.Xr gpib 4
 .Sh HISTORY
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265698 - head/bin/dd

2014-05-08 Thread Alan Somers
Author: asomers
Date: Thu May  8 19:10:04 2014
New Revision: 265698
URL: http://svnweb.freebsd.org/changeset/base/265698

Log:
  Incorporate feedback from bde and jilles regarding r265472 to dd(1).
  
  * Don't use sysexits.h.  Just exit 1 on error and 0 otherwise.
  * Don't sacrifice precision by converting the output of clock_gettime() to a
double and then comparing the results.  Instead, subtract the values of
the two clock_gettime() calls, then convert to double.
  * Don't use CLOCK_MONOTONIC_PRECISE.  It's an unportable synonym for
CLOCK_MONOTONIC.
  * Use more appropriate names for some local variables.
  * In the summary message, round elapsed time to the nearest microsecond.
  
  Reported by:  bde, jilles
  MFC after:3 days
  X-MFC-With:   265472

Modified:
  head/bin/dd/dd.c
  head/bin/dd/dd.h
  head/bin/dd/misc.c

Modified: head/bin/dd/dd.c
==
--- head/bin/dd/dd.cThu May  8 19:08:07 2014(r265697)
+++ head/bin/dd/dd.cThu May  8 19:10:04 2014(r265698)
@@ -61,7 +61,6 @@ __FBSDID($FreeBSD$);
 #include stdio.h
 #include stdlib.h
 #include string.h
-#include sysexits.h
 #include time.h
 #include unistd.h
 
@@ -126,7 +125,6 @@ static void
 setup(void)
 {
u_int cnt;
-   struct timespec tv;
 
if (in.name == NULL) {
in.name = stdin;
@@ -245,9 +243,8 @@ setup(void)
ctab = casetab;
}
 
-   if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv))
-   err(EX_OSERR, clock_gettime);
-   st.start = tv.tv_sec + tv.tv_nsec * 1.0e-9;
+   if (clock_gettime(CLOCK_MONOTONIC, st.start))
+   err(1, clock_gettime);
 }
 
 static void

Modified: head/bin/dd/dd.h
==
--- head/bin/dd/dd.hThu May  8 19:08:07 2014(r265697)
+++ head/bin/dd/dd.hThu May  8 19:10:04 2014(r265698)
@@ -64,7 +64,7 @@ typedef struct {
uintmax_t   trunc;  /* # of truncated records */
uintmax_t   swab;   /* # of odd-length swab blocks */
uintmax_t   bytes;  /* # of bytes written */
-   double  start;  /* start time of dd */
+   struct timespec start;  /* start time of dd */
 } STAT;
 
 /* Flags (in ddflags). */

Modified: head/bin/dd/misc.c
==
--- head/bin/dd/misc.c  Thu May  8 19:08:07 2014(r265697)
+++ head/bin/dd/misc.c  Thu May  8 19:10:04 2014(r265698)
@@ -48,7 +48,6 @@ __FBSDID($FreeBSD$);
 #include stdio.h
 #include stdlib.h
 #include string.h
-#include sysexits.h
 #include time.h
 #include unistd.h
 
@@ -58,18 +57,19 @@ __FBSDID($FreeBSD$);
 void
 summary(void)
 {
-   struct timespec tv, tv_res;
+   struct timespec end, ts_res;
double secs, res;
 
if (ddflags  C_NOINFO)
return;
 
-   if (clock_gettime(CLOCK_MONOTONIC_PRECISE, tv))
-   err(EX_OSERR, clock_gettime);
-   if (clock_getres(CLOCK_MONOTONIC_PRECISE, tv_res))
-   err(EX_OSERR, clock_getres);
-   secs = tv.tv_sec + tv.tv_nsec * 1.0e-9 - st.start;
-   res = tv_res.tv_sec + tv_res.tv_nsec * 1.0e-9;
+   if (clock_gettime(CLOCK_MONOTONIC, end))
+   err(1, clock_gettime);
+   if (clock_getres(CLOCK_MONOTONIC, ts_res))
+   err(1, clock_getres);
+   secs = (end.tv_sec - st.start.tv_sec) + \
+  (end.tv_nsec - st.start.tv_nsec) * 1e-9;
+   res = ts_res.tv_sec + ts_res.tv_nsec * 1e-9;
if (secs  res)
secs = res;
(void)fprintf(stderr,
@@ -83,7 +83,7 @@ summary(void)
 st.trunc, (st.trunc == 1) ? block : blocks);
if (!(ddflags  C_NOXFER)) {
(void)fprintf(stderr,
-   %ju bytes transferred in %.9f secs (%.0f bytes/sec)\n,
+   %ju bytes transferred in %.6f secs (%.0f bytes/sec)\n,
st.bytes, secs, st.bytes / secs);
}
need_summary = 0;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265699 - in stable/9: sbin/ipfw sys/netpfil/ipfw

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 19:11:14 2014
New Revision: 265699
URL: http://svnweb.freebsd.org/changeset/base/265699

Log:
  Merge r258708, r258711, r260247, r261117.
  
  r258708:
  Check ipfw table numbers in both user and kernel space before rule addition.
  Found by:   Saychik Pavel u...@localka.net
  
  r258711:
  Simplify O_NAT opcode handling.
  
  r260247:
  Use rnh_matchaddr instead of rnh_lookup for longest-prefix match.
  rnh_lookup is effectively the same as rnh_matchaddr if called with
  empy network mask.
  
  r261117:
  Reorder struct ip_fw_chain:
  * move rarely-used fields down
  * move uh_lock to different cacheline
  * remove some usused fields

Modified:
  stable/9/sbin/ipfw/ipfw2.c
  stable/9/sbin/ipfw/ipfw2.h
  stable/9/sys/netpfil/ipfw/ip_fw2.c
  stable/9/sys/netpfil/ipfw/ip_fw_private.h
  stable/9/sys/netpfil/ipfw/ip_fw_sockopt.c
  stable/9/sys/netpfil/ipfw/ip_fw_table.c
Directory Properties:
  stable/9/sbin/   (props changed)
  stable/9/sbin/ipfw/   (props changed)
  stable/9/sys/   (props changed)
  stable/9/sys/netpfil/   (props changed)

Modified: stable/9/sbin/ipfw/ipfw2.c
==
--- stable/9/sbin/ipfw/ipfw2.c  Thu May  8 19:10:04 2014(r265698)
+++ stable/9/sbin/ipfw/ipfw2.c  Thu May  8 19:11:14 2014(r265699)
@@ -60,6 +60,8 @@ int resvd_set_number = RESVD_SET;
 
 int ipfw_socket = -1;
 
+uint32_t ipfw_tables_max = 0; /* Number of tables supported by kernel */
+
 #ifndef s6_addr32
 #define s6_addr32 __u6_addr.__u6_addr32
 #endif
@@ -2202,6 +2204,7 @@ fill_ip(ipfw_insn_ip *cmd, char *av, int
 {
int len = 0;
uint32_t *d = ((ipfw_insn_u32 *)cmd)-d;
+   uint32_t tables_max;
 
cmd-o.len = ~F_LEN_MASK;  /* zero len */
 
@@ -2220,6 +2223,10 @@ fill_ip(ipfw_insn_ip *cmd, char *av, int
*p++ = '\0';
cmd-o.opcode = O_IP_DST_LOOKUP;
cmd-o.arg1 = strtoul(av + 6, NULL, 0);
+   tables_max = ipfw_get_tables_max();
+   if (cmd-o.arg1  tables_max)
+   errx(EX_USAGE, The table number exceeds the maximum 
+   allowed value (%u), tables_max - 1);
if (p) {
cmd-o.len |= F_INSN_SIZE(ipfw_insn_u32);
d[0] = strtoul(p, NULL, 0);
@@ -4108,6 +4115,33 @@ static void table_list(uint16_t num, int
 static void table_fill_xentry(char *arg, ipfw_table_xentry *xent);
 
 /*
+ * Retrieve maximum number of tables supported by ipfw(4) module.
+ */
+uint32_t
+ipfw_get_tables_max()
+{
+   size_t len;
+   uint32_t tables_max;
+
+   if (ipfw_tables_max != 0)
+   return (ipfw_tables_max);
+
+   len = sizeof(tables_max);
+   if (sysctlbyname(net.inet.ip.fw.tables_max, tables_max, len,
+   NULL, 0) == -1) {
+   if (co.test_only)
+   tables_max = 128; /* Old conservative default */
+   else
+   errx(1, Can't determine maximum number of ipfw tables.
+Perhaps you forgot to load ipfw module?);
+   }
+
+   ipfw_tables_max = tables_max;
+
+   return (ipfw_tables_max);
+}
+
+/*
  * This one handles all table-related commands
  * ipfw table N add addr[/masklen] [value]
  * ipfw table N delete addr[/masklen]
@@ -4120,19 +4154,10 @@ ipfw_table_handler(int ac, char *av[])
ipfw_table_xentry xent;
int do_add;
int is_all;
-   size_t len;
uint32_t a;
uint32_t tables_max;
 
-   len = sizeof(tables_max);
-   if (sysctlbyname(net.inet.ip.fw.tables_max, tables_max, len,
-   NULL, 0) == -1) {
-   if (co.test_only)
-   tables_max = 128; /* Old conservative default */
-   else
-   errx(1, Can't determine maximum number of ipfw tables.
-Perhaps you forgot to load ipfw module?);
-   }
+   tables_max = ipfw_get_tables_max();
 
memset(xent, 0, sizeof(xent));
 

Modified: stable/9/sbin/ipfw/ipfw2.h
==
--- stable/9/sbin/ipfw/ipfw2.h  Thu May  8 19:10:04 2014(r265698)
+++ stable/9/sbin/ipfw/ipfw2.h  Thu May  8 19:11:14 2014(r265699)
@@ -228,6 +228,8 @@ char const *match_value(struct _s_x *p, 
 
 int do_cmd(int optname, void *optval, uintptr_t optlen);
 
+uint32_t ipfw_get_tables_max(void);
+
 struct in6_addr;
 void n2mask(struct in6_addr *mask, int n);
 int contigmask(uint8_t *p, int len);

Modified: stable/9/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/9/sys/netpfil/ipfw/ip_fw2.c  Thu May  8 19:10:04 2014
(r265698)
+++ stable/9/sys/netpfil/ipfw/ip_fw2.c  Thu May  8 19:11:14 2014
(r265699)
@@ -2395,38 +2395,35 @@ do {

svn commit: r265700 - in stable/10: sbin/ipfw sys/netpfil/ipfw

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 19:11:41 2014
New Revision: 265700
URL: http://svnweb.freebsd.org/changeset/base/265700

Log:
  Merge r258708, r258711, r260247, r261117.
  
  r258708:
  Check ipfw table numbers in both user and kernel space before rule addition.
  Found by:   Saychik Pavel u...@localka.net
  
  r258711:
  Simplify O_NAT opcode handling.
  
  r260247:
  Use rnh_matchaddr instead of rnh_lookup for longest-prefix match.
  rnh_lookup is effectively the same as rnh_matchaddr if called with
  empy network mask.
  
  r261117:
  Reorder struct ip_fw_chain:
  * move rarely-used fields down
  * move uh_lock to different cacheline
  * remove some usused fields

Modified:
  stable/10/sbin/ipfw/ipfw2.c
  stable/10/sbin/ipfw/ipfw2.h
  stable/10/sys/netpfil/ipfw/ip_fw2.c
  stable/10/sys/netpfil/ipfw/ip_fw_private.h
  stable/10/sys/netpfil/ipfw/ip_fw_sockopt.c
  stable/10/sys/netpfil/ipfw/ip_fw_table.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/ipfw/ipfw2.c
==
--- stable/10/sbin/ipfw/ipfw2.c Thu May  8 19:11:14 2014(r265699)
+++ stable/10/sbin/ipfw/ipfw2.c Thu May  8 19:11:41 2014(r265700)
@@ -60,6 +60,8 @@ int resvd_set_number = RESVD_SET;
 
 int ipfw_socket = -1;
 
+uint32_t ipfw_tables_max = 0; /* Number of tables supported by kernel */
+
 #ifndef s6_addr32
 #define s6_addr32 __u6_addr.__u6_addr32
 #endif
@@ -2203,6 +2205,7 @@ fill_ip(ipfw_insn_ip *cmd, char *av, int
 {
int len = 0;
uint32_t *d = ((ipfw_insn_u32 *)cmd)-d;
+   uint32_t tables_max;
 
cmd-o.len = ~F_LEN_MASK;  /* zero len */
 
@@ -2221,6 +2224,10 @@ fill_ip(ipfw_insn_ip *cmd, char *av, int
*p++ = '\0';
cmd-o.opcode = O_IP_DST_LOOKUP;
cmd-o.arg1 = strtoul(av + 6, NULL, 0);
+   tables_max = ipfw_get_tables_max();
+   if (cmd-o.arg1  tables_max)
+   errx(EX_USAGE, The table number exceeds the maximum 
+   allowed value (%u), tables_max - 1);
if (p) {
cmd-o.len |= F_INSN_SIZE(ipfw_insn_u32);
d[0] = strtoul(p, NULL, 0);
@@ -4119,6 +4126,33 @@ static void table_list(uint16_t num, int
 static void table_fill_xentry(char *arg, ipfw_table_xentry *xent);
 
 /*
+ * Retrieve maximum number of tables supported by ipfw(4) module.
+ */
+uint32_t
+ipfw_get_tables_max()
+{
+   size_t len;
+   uint32_t tables_max;
+
+   if (ipfw_tables_max != 0)
+   return (ipfw_tables_max);
+
+   len = sizeof(tables_max);
+   if (sysctlbyname(net.inet.ip.fw.tables_max, tables_max, len,
+   NULL, 0) == -1) {
+   if (co.test_only)
+   tables_max = 128; /* Old conservative default */
+   else
+   errx(1, Can't determine maximum number of ipfw tables.
+Perhaps you forgot to load ipfw module?);
+   }
+
+   ipfw_tables_max = tables_max;
+
+   return (ipfw_tables_max);
+}
+
+/*
  * This one handles all table-related commands
  * ipfw table N add addr[/masklen] [value]
  * ipfw table N delete addr[/masklen]
@@ -4131,19 +4165,10 @@ ipfw_table_handler(int ac, char *av[])
ipfw_table_xentry xent;
int do_add;
int is_all;
-   size_t len;
uint32_t a;
uint32_t tables_max;
 
-   len = sizeof(tables_max);
-   if (sysctlbyname(net.inet.ip.fw.tables_max, tables_max, len,
-   NULL, 0) == -1) {
-   if (co.test_only)
-   tables_max = 128; /* Old conservative default */
-   else
-   errx(1, Can't determine maximum number of ipfw tables.
-Perhaps you forgot to load ipfw module?);
-   }
+   tables_max = ipfw_get_tables_max();
 
memset(xent, 0, sizeof(xent));
 

Modified: stable/10/sbin/ipfw/ipfw2.h
==
--- stable/10/sbin/ipfw/ipfw2.h Thu May  8 19:11:14 2014(r265699)
+++ stable/10/sbin/ipfw/ipfw2.h Thu May  8 19:11:41 2014(r265700)
@@ -228,6 +228,8 @@ char const *match_value(struct _s_x *p, 
 
 int do_cmd(int optname, void *optval, uintptr_t optlen);
 
+uint32_t ipfw_get_tables_max(void);
+
 struct in6_addr;
 void n2mask(struct in6_addr *mask, int n);
 int contigmask(uint8_t *p, int len);

Modified: stable/10/sys/netpfil/ipfw/ip_fw2.c
==
--- stable/10/sys/netpfil/ipfw/ip_fw2.c Thu May  8 19:11:14 2014
(r265699)
+++ stable/10/sys/netpfil/ipfw/ip_fw2.c Thu May  8 19:11:41 2014
(r265700)
@@ -2404,38 +2404,35 @@ do {
\
}
 
case O_NAT:
+   

svn commit: r265701 - in stable/10: sbin/route usr.bin/netstat

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 19:35:12 2014
New Revision: 265701
URL: http://svnweb.freebsd.org/changeset/base/265701

Log:
  Merge r260524,r260540
  
  r260524:
Add -4/-6 shorthand for -finet/-finet6 in route(8) and netstat(8).
  
  r260540:
Bump dates in nestat(1) and route(8) man pages.
Fix several small errors introduced by r260524.
  
Suggested by: glebius

Modified:
  stable/10/sbin/route/keywords
  stable/10/sbin/route/route.8
  stable/10/sbin/route/route.c
  stable/10/usr.bin/netstat/main.c
  stable/10/usr.bin/netstat/netstat.1
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/route/keywords
==
--- stable/10/sbin/route/keywords   Thu May  8 19:11:41 2014
(r265700)
+++ stable/10/sbin/route/keywords   Thu May  8 19:35:12 2014
(r265701)
@@ -1,6 +1,8 @@
 #  @(#)keywords8.2 (Berkeley) 3/19/94
 # $FreeBSD$
 
+4
+6
 add
 atalk
 blackhole

Modified: stable/10/sbin/route/route.8
==
--- stable/10/sbin/route/route.8Thu May  8 19:11:41 2014
(r265700)
+++ stable/10/sbin/route/route.8Thu May  8 19:35:12 2014
(r265701)
@@ -28,7 +28,7 @@
 .\ @(#)route.88.3 (Berkeley) 3/19/94
 .\ $FreeBSD$
 .\
-.Dd November 17, 2012
+.Dd May 8, 2014
 .Dt ROUTE 8
 .Os
 .Sh NAME
@@ -62,6 +62,14 @@ programmatic interface discussed in
 .Pp
 The following options are available:
 .Bl -tag -width indent
+.It Fl 4
+Specify
+.Cm inet
+address family as family hint for subcommands.
+.It Fl 6
+Specify
+.Cm inet
+address family as family hint for subcommands.
 .It Fl d
 Run in debug-only mode, i.e., do not actually modify the routing table.
 .It Fl n
@@ -142,6 +150,15 @@ or
 .Fl inet
 modifiers, only routes having destinations with addresses in the
 delineated family will be deleted.
+Additionally,
+.Fl 4
+or
+.Fl 6
+can be used as aliases for
+.Fl inet
+and
+.Fl inet6
+modifiers.
 When a
 .Fl fib
 option is specified, the operation will be applied to

Modified: stable/10/sbin/route/route.c
==
--- stable/10/sbin/route/route.cThu May  8 19:11:41 2014
(r265700)
+++ stable/10/sbin/route/route.cThu May  8 19:35:12 2014
(r265701)
@@ -140,7 +140,7 @@ usage(const char *cp)
 {
if (cp != NULL)
warnx(bad keyword: %s, cp);
-   errx(EX_USAGE, usage: route [-dnqtv] command [[modifiers] args]);
+   errx(EX_USAGE, usage: route [-46dnqtv] command [[modifiers] args]);
/* NOTREACHED */
 }
 
@@ -153,8 +153,24 @@ main(int argc, char **argv)
if (argc  2)
usage(NULL);
 
-   while ((ch = getopt(argc, argv, nqdtv)) != -1)
+   while ((ch = getopt(argc, argv, 46nqdtv)) != -1)
switch(ch) {
+   case '4':
+#ifdef INET
+   af = AF_INET;
+   aflen = sizeof(struct sockaddr_in);
+#else
+   errx(1, IPv4 support is not compiled in);
+#endif
+   break;
+   case '6':
+#ifdef INET6
+   af = AF_INET6;
+   aflen = sizeof(struct sockaddr_in6);
+#else
+   errx(1, IPv6 support is not compiled in);
+#endif
+   break;
case 'n':
nflag = 1;
break;
@@ -368,11 +384,13 @@ flushroutes(int argc, char *argv[])
usage(*argv);
switch (keyword(*argv + 1)) {
 #ifdef INET
+   case K_4:
case K_INET:
af = AF_INET;
break;
 #endif
 #ifdef INET6
+   case K_6:
case K_INET6:
af = AF_INET6;
break;
@@ -780,12 +798,14 @@ newroute(int argc, char **argv)
aflen = sizeof(struct sockaddr_dl);
break;
 #ifdef INET
+   case K_4:
case K_INET:
af = AF_INET;
aflen = sizeof(struct sockaddr_in);
break;
 #endif
 #ifdef INET6
+   case K_6:
case K_INET6:
af = AF_INET6;
aflen = sizeof(struct sockaddr_in6);

Modified: stable/10/usr.bin/netstat/main.c
==
--- stable/10/usr.bin/netstat/main.cThu May  8 19:11:41 2014
(r265700)
+++ stable/10/usr.bin/netstat/main.cThu May  8 19:35:12 2014
(r265701)
@@ -350,9 +350,23 @@ main(int argc, char *argv[])
 
af = AF_UNSPEC;
 
-   while ((ch = getopt(argc, argv, 

svn commit: r265702 - in stable/9: sbin/route usr.bin/netstat

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 19:35:29 2014
New Revision: 265702
URL: http://svnweb.freebsd.org/changeset/base/265702

Log:
  Merge r260524,r260540
  
  r260524:
Add -4/-6 shorthand for -finet/-finet6 in route(8) and netstat(8).
  
  r260540:
Bump dates in nestat(1) and route(8) man pages.
Fix several small errors introduced by r260524.
  
Suggested by: glebius

Modified:
  stable/9/sbin/route/keywords
  stable/9/sbin/route/route.8
  stable/9/sbin/route/route.c
  stable/9/usr.bin/netstat/main.c
  stable/9/usr.bin/netstat/netstat.1
Directory Properties:
  stable/9/sbin/   (props changed)
  stable/9/sbin/route/   (props changed)
  stable/9/usr.bin/   (props changed)
  stable/9/usr.bin/netstat/   (props changed)

Modified: stable/9/sbin/route/keywords
==
--- stable/9/sbin/route/keywordsThu May  8 19:35:12 2014
(r265701)
+++ stable/9/sbin/route/keywordsThu May  8 19:35:29 2014
(r265702)
@@ -1,6 +1,8 @@
 #  @(#)keywords8.2 (Berkeley) 3/19/94
 # $FreeBSD$
 
+4
+6
 add
 atalk
 blackhole

Modified: stable/9/sbin/route/route.8
==
--- stable/9/sbin/route/route.8 Thu May  8 19:35:12 2014(r265701)
+++ stable/9/sbin/route/route.8 Thu May  8 19:35:29 2014(r265702)
@@ -62,6 +62,14 @@ programmatic interface discussed in
 .Pp
 The following options are available:
 .Bl -tag -width indent
+.It Fl 4
+Specify
+.Cm inet
+address family as family hint for subcommands.
+.It Fl 6
+Specify
+.Cm inet
+address family as family hint for subcommands.
 .It Fl d
 Run in debug-only mode, i.e., do not actually modify the routing table.
 .It Fl n
@@ -134,10 +142,20 @@ When the address family may is specified
 .Fl xns ,
 .Fl atalk ,
 .Fl inet6 ,
+.Fl 6,
+.Fl inet,
 or
-.Fl inet
+.Fl 4
 modifiers, only routes having destinations with addresses in the
-delineated family will be deleted.
+delineated family will be deleted. Additionally,
+.Fl 4
+or
+.Fl 6
+can be used as aliases for
+.Fl inet
+and
+.Fl inet6
+modifiers.
 When a
 .Fl fib
 option is specified, the operation will be applied to

Modified: stable/9/sbin/route/route.c
==
--- stable/9/sbin/route/route.c Thu May  8 19:35:12 2014(r265701)
+++ stable/9/sbin/route/route.c Thu May  8 19:35:29 2014(r265702)
@@ -153,7 +153,7 @@ usage(const char *cp)
if (cp != NULL)
warnx(bad keyword: %s, cp);
(void) fprintf(stderr,
-   usage: route [-dnqtv] command [[modifiers] args]\n);
+   usage: route [-46dnqtv] command [[modifiers] args]\n);
exit(EX_USAGE);
/* NOTREACHED */
 }
@@ -167,8 +167,24 @@ main(int argc, char **argv)
if (argc  2)
usage(NULL);
 
-   while ((ch = getopt(argc, argv, nqdtv)) != -1)
+   while ((ch = getopt(argc, argv, 46nqdtv)) != -1)
switch(ch) {
+   case '4':
+#ifdef INET
+   af = AF_INET;
+   aflen = sizeof(struct sockaddr_in);
+#else
+   errx(1, IPv4 support is not compiled in);
+#endif
+   break;
+   case '6':
+#ifdef INET6
+   af = AF_INET6;
+   aflen = sizeof(struct sockaddr_in6);
+#else
+   errx(1, IPv6 support is not compiled in);
+#endif
+   break;
case 'n':
nflag = 1;
break;
@@ -389,10 +405,12 @@ flushroutes(int argc, char *argv[])
if (**argv != '-')
usage(*argv);
switch (keyword(*argv + 1)) {
+   case K_4:
case K_INET:
af = AF_INET;
break;
 #ifdef INET6
+   case K_6:
case K_INET6:
af = AF_INET6;
break;
@@ -807,11 +825,13 @@ newroute(int argc, char **argv)
af = AF_LINK;
aflen = sizeof(struct sockaddr_dl);
break;
+   case K_4:
case K_INET:
af = AF_INET;
aflen = sizeof(struct sockaddr_in);
break;
 #ifdef INET6
+   case K_6:
case K_INET6:
af = AF_INET6;
aflen = sizeof(struct sockaddr_in6);

Modified: stable/9/usr.bin/netstat/main.c
==
--- stable/9/usr.bin/netstat/main.c Thu May  8 19:35:12 2014
(r265701)
+++ stable/9/usr.bin/netstat/main.c Thu May  8 19:35:29 2014

svn commit: r265703 - in head: share/man/man4 sys/dev/bce sys/dev/bxe sys/modules/bce

2014-05-08 Thread David C Somayajulu
Author: davidcs
Date: Thu May  8 19:40:37 2014
New Revision: 265703
URL: http://svnweb.freebsd.org/changeset/base/265703

Log:
  Modify Copyright information and other strings to reflect Qlogic 
Corporation's purchase of Broadcom's NetXtreme business.
  Added clean option to Makefile
  
  Submitted by:David C Somayajulu (davi...@freebsd.org) QLogic Corporation
  MFC after:5 days

Modified:
  head/share/man/man4/bce.4
  head/share/man/man4/bxe.4
  head/sys/dev/bce/if_bce.c
  head/sys/dev/bce/if_bcefw.h
  head/sys/dev/bce/if_bcereg.h
  head/sys/dev/bxe/bxe.c
  head/sys/modules/bce/Makefile

Modified: head/share/man/man4/bce.4
==
--- head/share/man/man4/bce.4   Thu May  8 19:35:29 2014(r265702)
+++ head/share/man/man4/bce.4   Thu May  8 19:40:37 2014(r265703)
@@ -1,5 +1,4 @@
-.\ Copyright (c) 2006 Broadcom Corporation
-.\  David Christensen davi...@broadcom.com.  All rights reserved.
+.\ Copyright (c) 2006-2014 QLogic Corporation
 .\
 .\ Redistribution and use in source and binary forms, with or without
 .\ modification, are permitted provided that the following conditions
@@ -10,9 +9,6 @@
 .\ 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.
-.\ 3. Neither the name of Broadcom Corporation nor the name of its 
contributors
-.\may be used to endorse or promote products derived from this software
-.\without specific prior written consent.
 .\
 .\ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS'
 .\ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -33,7 +29,7 @@
 .Os
 .Sh NAME
 .Nm bce
-.Nd Broadcom NetXtreme II (BCM5706/5708/5709/5716) PCI/PCIe Gigabit Ethernet 
adapter driver
+.Nd QLogic NetXtreme II (BCM5706/5708/5709/5716) PCI/PCIe Gigabit Ethernet 
adapter driver
 .Sh SYNOPSIS
 To compile this driver into the kernel,
 place the following lines in your
@@ -52,7 +48,7 @@ if_bce_load=YES
 .Sh DESCRIPTION
 The
 .Nm
-driver supports Broadcom's NetXtreme II product family, including the
+driver supports QLogic's NetXtreme II product family, including the
 BCM5706, BCM5708, BCM5709 and BCM5716 Ethernet controllers.
 .Pp
 The NetXtreme II product family is composed of various Converged NIC (or CNIC)
@@ -141,25 +137,25 @@ For more information on configuring this
 .Sh HARDWARE
 The
 .Nm
-driver provides support for various NICs based on the Broadcom NetXtreme II
+driver provides support for various NICs based on the QLogic NetXtreme II
 family of Gigabit Ethernet controllers, including the
 following:
 .Pp
 .Bl -bullet -compact
 .It
-Broadcom NetXtreme II BCM5706 1000Base-SX
+QLogic NetXtreme II BCM5706 1000Base-SX
 .It
-Broadcom NetXtreme II BCM5706 1000Base-T
+QLogic NetXtreme II BCM5706 1000Base-T
 .It
-Broadcom NetXtreme II BCM5708 1000Base-SX
+QLogic NetXtreme II BCM5708 1000Base-SX
 .It
-Broadcom NetXtreme II BCM5708 1000Base-T
+QLogic NetXtreme II BCM5708 1000Base-T
 .It
-Broadcom NetXtreme II BCM5709 1000Base-SX
+QLogic NetXtreme II BCM5709 1000Base-SX
 .It
-Broadcom NetXtreme II BCM5709 1000Base-T
+QLogic NetXtreme II BCM5709 1000Base-T
 .It
-Broadcom NetXtreme II BCM5716 1000Base-T
+QLogic NetXtreme II BCM5716 1000Base-T
 .It
 Dell PowerEdge 1950 integrated BCM5708 NIC
 .It
@@ -411,9 +407,11 @@ A controller hardware failure has occurr
 If the problem continues replace the controller.
 .El
 .Sh SUPPORT
-For general information and support,
-go to the Broadcom NIC Open Source Developer Resource Site:
-.Pa http://www.broadcom.com/support/ethernet_nic/open_source.php .
+For support questions please contact your QLogic approved reseller or
+QLogic Technical Support at
+.Pa http://support.qlogic.com ,
+or by E-mail at
+.Aq supp...@qlogic.com .
 .Sh SEE ALSO
 .Xr altq 4 ,
 .Xr arp 4 ,

Modified: head/share/man/man4/bxe.4
==
--- head/share/man/man4/bxe.4   Thu May  8 19:35:29 2014(r265702)
+++ head/share/man/man4/bxe.4   Thu May  8 19:40:37 2014(r265703)
@@ -1,4 +1,4 @@
-.\ Copyright (c) 2013 Broadcom Corporation. All rights reserved.
+.\ Copyright (c) 2014 Qlogic Corporation. All rights reserved.
 .\
 .\ Redistribution and use in source and binary forms, with or without
 .\ modification, are permitted provided that the following conditions
@@ -9,9 +9,6 @@
 .\ 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.
-.\ 3. Neither the name of Broadcom Corporation nor the name of its 
contributors
-.\may be used to endorse or promote products derived from this software
-.\without specific prior written consent.
 .\
 .\ THIS SOFTWARE IS 

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

2014-05-08 Thread Ian Lepore
Author: ian
Date: Thu May  8 20:02:38 2014
New Revision: 265705
URL: http://svnweb.freebsd.org/changeset/base/265705

Log:
  Consolitate all the AP core startup stuff under a single #ifdef SMP block.
  Remove some other ifdefs that came in with a copy/paste that mean basically
  if this processor supports multicore stuff, because if you're starting up
  an AP core... it does.

Modified:
  head/sys/arm/arm/locore.S

Modified: head/sys/arm/arm/locore.S
==
--- head/sys/arm/arm/locore.S   Thu May  8 19:45:31 2014(r265704)
+++ head/sys/arm/arm/locore.S   Thu May  8 20:02:38 2014(r265705)
@@ -308,11 +308,6 @@ Lreal_start:
 Lend:
.word   _edata
 
-#ifdef SMP
-Lstartup_pagetable_secondary:
-   .word   temp_pagetable
-#endif
-
 .Lstart:
.word   _edata
.word   _ebss
@@ -320,10 +315,6 @@ Lstartup_pagetable_secondary:
 
 .Lvirt_done:
.word   virt_done
-#if defined(SMP)
-.Lmpvirt_done:
-   .word   mpvirt_done
-#endif
 
 .Lmainreturned:
.asciz  main() returned
@@ -350,6 +341,11 @@ pagetable:
 
 #if defined(SMP)
 
+.Lmpvirt_done:
+   .word   mpvirt_done
+Lstartup_pagetable_secondary:
+   .word   temp_pagetable
+
 ASENTRY_NP(mpentry)
 
/* Make sure interrupts are disabled. */
@@ -379,26 +375,20 @@ Ltag:
bic r0, r0, #0xf000
orr r0, r0, #PHYSADDR
ldr r0, [r0]
-#if defined(SMP)
orr r0, r0, #2  /* Set TTB shared memory flag */
-#endif
mcr p15, 0, r0, c2, c0, 0   /* Set TTB */
mcr p15, 0, r0, c8, c7, 0   /* Flush TLB */
 
-#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_MV_PJ4B) || 
defined(CPU_CORTEXA) || defined(CPU_KRAIT)
mov r0, #0
mcr p15, 0, r0, c13, c0, 1  /* Set ASID to 0 */
-#endif
 
/* Set the Domain Access register.  Very important! */
mov r0, #((DOMAIN_CLIENT  (PMAP_DOMAIN_KERNEL*2)) | DOMAIN_CLIENT)
mcr p15, 0, r0, c3, c0, 0
/* Enable MMU */
mrc p15, 0, r0, c1, c0, 0
-#if defined(CPU_ARM1136) || defined(CPU_ARM1176) || defined(CPU_MV_PJ4B) || 
defined(CPU_CORTEXA) || defined(CPU_KRAIT)
orr r0, r0, #CPU_CONTROL_V6_EXTPAGE
orr r0, r0, #CPU_CONTROL_AF_ENABLE
-#endif
orr r0, r0, #(CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_DC_ENABLE)
mcr p15, 0, r0, c1, c0, 0
nop
@@ -426,7 +416,7 @@ mpvirt_done:
/* NOTREACHED */
 
 .Lmpreturned:
-   .asciz  main() returned
+   .asciz  init_secondary() returned
.align  0
 END(mpentry)
 #endif
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265706 - head/usr.bin/printf

2014-05-08 Thread Pedro F. Giffuni
Author: pfg
Date: Thu May  8 20:20:59 2014
New Revision: 265706
URL: http://svnweb.freebsd.org/changeset/base/265706

Log:
  Fix the incorrect handling of %b and \c in printf(1)
  
  This is required for POSIX compliance.
  
  Obtained from:Garrett D'Amore (Illumos)
  MFC after:4 days

Modified:
  head/usr.bin/printf/printf.c

Modified: head/usr.bin/printf/printf.c
==
--- head/usr.bin/printf/printf.cThu May  8 20:02:38 2014
(r265705)
+++ head/usr.bin/printf/printf.cThu May  8 20:20:59 2014
(r265706)
@@ -110,7 +110,7 @@ int
 main(int argc, char *argv[])
 {
size_t len;
-   int chopped, end, rval;
+   int end, rval;
char *format, *fmt, *start;
 #ifndef SHELL
int ch;
@@ -151,7 +151,7 @@ main(int argc, char *argv[])
 * up the format string.
 */
fmt = format = *argv;
-   chopped = escape(fmt, 1, len); /* backslash interpretation */
+   escape(fmt, 1, len);   /* backslash interpretation */
rval = end = 0;
gargv = ++argv;
 
@@ -195,7 +195,7 @@ main(int argc, char *argv[])
return (1);
}
fwrite(start, 1, fmt - start, stdout);
-   if (chopped || !*gargv) {
+   if (!*gargv) {
 #ifdef SHELL
INTON;
 #endif
@@ -241,8 +241,8 @@ printf_doformat(char *fmt, int *rval)
maxargv = gargv;
fmt += l + 1;
 
-   /* save format argument */
-   fargv = gargv;
+   /* save format argument */
+   fargv = gargv;
} else {
fargv = NULL;
}
@@ -352,7 +352,7 @@ printf_doformat(char *fmt, int *rval)
 
/* save the current arg offset, and set to the format arg */
if (fargv != NULL) {
-   gargv = fargv;
+   gargv = fargv;
}
 
convch = *fmt;
@@ -371,12 +371,10 @@ printf_doformat(char *fmt, int *rval)
return (NULL);
}
getout = escape(p, 0, len);
-   *(fmt - 1) = 's';
-   PF(start, p);
-   *(fmt - 1) = 'b';
+   fputs(p, stdout);
free(p);
if (getout)
-   return (fmt);
+   exit(*rval);
break;
}
case 'c': {
@@ -488,9 +486,13 @@ escape(char *fmt, int percent, size_t *l
*store = '\b';
break;
case 'c':
-   *store = '\0';
-   *len = store - save;
-   return (1);
+   if (!percent) {
+   *store = '\0';
+   *len = store - save;
+   return (1);
+   }
+   *store = 'c';
+   break;
case 'f':   /* form-feed */
*store = '\f';
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265691 - head/sys/netinet

2014-05-08 Thread Gleb Smirnoff
On Thu, May 08, 2014 at 05:27:46PM +, Michael Tuexen wrote:
M Author: tuexen
M Date: Thu May  8 17:27:46 2014
M New Revision: 265691
M URL: http://svnweb.freebsd.org/changeset/base/265691
M 
M Log:
M   For some UDP packets (for example with 200 byte payload) and IP options,
M   the IP header and the UDP header are not in the same mbuf.
M   Add code to in_delayed_cksum() to deal with this case.
M   
M   MFC after: 3 days
M 
M Modified:
M   head/sys/netinet/ip_output.c
M 
M Modified: head/sys/netinet/ip_output.c
M 
==
M --- head/sys/netinet/ip_output.c Thu May  8 17:20:45 2014
(r265690)
M +++ head/sys/netinet/ip_output.c Thu May  8 17:27:46 2014
(r265691)
M @@ -887,15 +887,23 @@ in_delayed_cksum(struct mbuf *m)
M  csum = 0x;
M  offset += m-m_pkthdr.csum_data;/* checksum offset */
M  
M +/* find the mbuf in the chain where the checksum starts*/
M +while ((m != NULL)  (offset = m-m_len)) {
M +offset -= m-m_len;
M +m = m-m_next;
M +}
M +if (m == NULL) {
M +/* This should not happen. */
M +printf(in_delayed_cksum(): checksum outside mbuf chain.\n);
M +return;
M +}
M  if (offset + sizeof(u_short)  m-m_len) {
M -printf(delayed m_pullup, m-len: %d  off: %d  p: %d\n,
M -m-m_len, offset, ip-ip_p);
M  /*
M   * XXX
M - * this shouldn't happen, but if it does, the
M - * correct behavior may be to insert the checksum
M - * in the appropriate next mbuf in the chain.
M + * This should not happen, but if it does, it might make more
M + * sense to fix the caller than to add code to split it here.
M   */
M +printf(in_delayed_cksum(): checksum split between mbufs.\n);
M  return;
M  }
M  *(u_short *)(m-m_data + offset) = csum;

If this should not happen really means that we do not expect this issue
at all, assuming we are coding correctly, then all these comments and printfs
should be converted to KASSERTs.

If this should not happen means 'such packets shouldn't arrrive from
network, then we need to remove printfs, because having a remotely
triggerable printf(9) is a DDoS vulnerability.

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


svn commit: r265707 - stable/9/sys/net

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 20:24:13 2014
New Revision: 265707
URL: http://svnweb.freebsd.org/changeset/base/265707

Log:
  Merge r259528, r259528, r260295.
  
  r259528:
Simplify contiguous mask checking.
  
Suggested by: glebius
  
  r260228:
Remove useless register variable modifiers.
Do some more style(9).
  
  r260295:
Change semantics for rnh_lookup() function: now
it performs exact match search, regardless of netmask existance.
This simplifies most of rnh_lookup() consumers.
  
Fix panic triggered by deleting non-existent host route.
  
PR:   kern/185092
Submitted by: Nikolay Denev ndenev at gmail.com

Modified:
  stable/9/sys/net/radix.c
  stable/9/sys/net/radix.h
  stable/9/sys/net/radix_mpath.c
  stable/9/sys/net/route.c
  stable/9/sys/net/rtsock.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/net/   (props changed)

Modified: stable/9/sys/net/radix.c
==
--- stable/9/sys/net/radix.cThu May  8 20:20:59 2014(r265706)
+++ stable/9/sys/net/radix.cThu May  8 20:24:13 2014(r265707)
@@ -156,12 +156,10 @@ static intrn_satisfies_leaf(char *trial
  * Search a node in the tree matching the key.
  */
 static struct radix_node *
-rn_search(v_arg, head)
-   void *v_arg;
-   struct radix_node *head;
+rn_search(void *v_arg, struct radix_node *head)
 {
-   register struct radix_node *x;
-   register caddr_t v;
+   struct radix_node *x;
+   caddr_t v;
 
for (x = head, v = v_arg; x-rn_bit = 0;) {
if (x-rn_bmask  v[x-rn_offset])
@@ -177,12 +175,10 @@ rn_search(v_arg, head)
  * XXX note this function is used only once.
  */
 static struct radix_node *
-rn_search_m(v_arg, head, m_arg)
-   struct radix_node *head;
-   void *v_arg, *m_arg;
+rn_search_m(void *v_arg, struct radix_node *head, void *m_arg)
 {
-   register struct radix_node *x;
-   register caddr_t v = v_arg, m = m_arg;
+   struct radix_node *x;
+   caddr_t v = v_arg, m = m_arg;
 
for (x = head; x-rn_bit = 0;) {
if ((x-rn_bmask  m[x-rn_offset]) 
@@ -191,15 +187,14 @@ rn_search_m(v_arg, head, m_arg)
else
x = x-rn_left;
}
-   return x;
+   return (x);
 }
 
 int
-rn_refines(m_arg, n_arg)
-   void *m_arg, *n_arg;
+rn_refines(void *m_arg, void *n_arg)
 {
-   register caddr_t m = m_arg, n = n_arg;
-   register caddr_t lim, lim2 = lim = n + LEN(n);
+   caddr_t m = m_arg, n = n_arg;
+   caddr_t lim, lim2 = lim = n + LEN(n);
int longer = LEN(n++) - LEN(m++);
int masks_are_equal = 1;
 
@@ -207,50 +202,71 @@ rn_refines(m_arg, n_arg)
lim -= longer;
while (n  lim) {
if (*n  ~(*m))
-   return 0;
+   return (0);
if (*n++ != *m++)
masks_are_equal = 0;
}
while (n  lim2)
if (*n++)
-   return 0;
+   return (0);
if (masks_are_equal  (longer  0))
for (lim2 = m - longer; m  lim2; )
if (*m++)
-   return 1;
+   return (1);
return (!masks_are_equal);
 }
 
+/*
+ * Search for exact match in given @head.
+ * Assume host bits are cleared in @v_arg if @m_arg is not NULL
+ * Note that prefixes with /32 or /128 masks are treated differently
+ * from host routes.
+ */
 struct radix_node *
-rn_lookup(v_arg, m_arg, head)
-   void *v_arg, *m_arg;
-   struct radix_node_head *head;
+rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
 {
-   register struct radix_node *x;
-   caddr_t netmask = 0;
+   struct radix_node *x;
+   caddr_t netmask;
 
-   if (m_arg) {
+   if (m_arg != NULL) {
+   /*
+* Most common case: search exact prefix/mask
+*/
x = rn_addmask_r(m_arg, head-rnh_masks, 1,
head-rnh_treetop-rn_offset);
-   if (x == 0)
-   return (0);
+   if (x == NULL)
+   return (NULL);
netmask = x-rn_key;
-   }
-   x = rn_match(v_arg, head);
-   if (x  netmask) {
-   while (x  x-rn_mask != netmask)
+
+   x = rn_match(v_arg, head);
+
+   while (x != NULL  x-rn_mask != netmask)
x = x-rn_dupedkey;
+
+   return (x);
}
-   return x;
+
+   /*
+* Search for host address.
+*/
+   if ((x = rn_match(v_arg, head)) == NULL)
+   return (NULL);
+
+   /* Check if found key is the same */
+   if (LEN(x-rn_key) != LEN(v_arg) || bcmp(x-rn_key, v_arg, LEN(v_arg)))
+   return (NULL);
+
+   /* Check 

svn commit: r265708 - stable/10/sys/net

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 20:27:06 2014
New Revision: 265708
URL: http://svnweb.freebsd.org/changeset/base/265708

Log:
  Merge r259528, r259528, r260295.
  
  r259528:
Simplify contiguous mask checking.
  
Suggested by: glebius
  
  r260228:
Remove useless register variable modifiers.
Do some more style(9).
  
  r260295:
Change semantics for rnh_lookup() function: now
it performs exact match search, regardless of netmask existance.
This simplifies most of rnh_lookup() consumers.
  
Fix panic triggered by deleting non-existent host route.
  
PR:   kern/185092
Submitted by: Nikolay Denev ndenev at gmail.com

Modified:
  stable/10/sys/net/radix.c
  stable/10/sys/net/radix.h
  stable/10/sys/net/radix_mpath.c
  stable/10/sys/net/route.c
  stable/10/sys/net/rtsock.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/radix.c
==
--- stable/10/sys/net/radix.c   Thu May  8 20:24:13 2014(r265707)
+++ stable/10/sys/net/radix.c   Thu May  8 20:27:06 2014(r265708)
@@ -156,12 +156,10 @@ static intrn_satisfies_leaf(char *trial
  * Search a node in the tree matching the key.
  */
 static struct radix_node *
-rn_search(v_arg, head)
-   void *v_arg;
-   struct radix_node *head;
+rn_search(void *v_arg, struct radix_node *head)
 {
-   register struct radix_node *x;
-   register caddr_t v;
+   struct radix_node *x;
+   caddr_t v;
 
for (x = head, v = v_arg; x-rn_bit = 0;) {
if (x-rn_bmask  v[x-rn_offset])
@@ -177,12 +175,10 @@ rn_search(v_arg, head)
  * XXX note this function is used only once.
  */
 static struct radix_node *
-rn_search_m(v_arg, head, m_arg)
-   struct radix_node *head;
-   void *v_arg, *m_arg;
+rn_search_m(void *v_arg, struct radix_node *head, void *m_arg)
 {
-   register struct radix_node *x;
-   register caddr_t v = v_arg, m = m_arg;
+   struct radix_node *x;
+   caddr_t v = v_arg, m = m_arg;
 
for (x = head; x-rn_bit = 0;) {
if ((x-rn_bmask  m[x-rn_offset]) 
@@ -191,15 +187,14 @@ rn_search_m(v_arg, head, m_arg)
else
x = x-rn_left;
}
-   return x;
+   return (x);
 }
 
 int
-rn_refines(m_arg, n_arg)
-   void *m_arg, *n_arg;
+rn_refines(void *m_arg, void *n_arg)
 {
-   register caddr_t m = m_arg, n = n_arg;
-   register caddr_t lim, lim2 = lim = n + LEN(n);
+   caddr_t m = m_arg, n = n_arg;
+   caddr_t lim, lim2 = lim = n + LEN(n);
int longer = LEN(n++) - LEN(m++);
int masks_are_equal = 1;
 
@@ -207,50 +202,71 @@ rn_refines(m_arg, n_arg)
lim -= longer;
while (n  lim) {
if (*n  ~(*m))
-   return 0;
+   return (0);
if (*n++ != *m++)
masks_are_equal = 0;
}
while (n  lim2)
if (*n++)
-   return 0;
+   return (0);
if (masks_are_equal  (longer  0))
for (lim2 = m - longer; m  lim2; )
if (*m++)
-   return 1;
+   return (1);
return (!masks_are_equal);
 }
 
+/*
+ * Search for exact match in given @head.
+ * Assume host bits are cleared in @v_arg if @m_arg is not NULL
+ * Note that prefixes with /32 or /128 masks are treated differently
+ * from host routes.
+ */
 struct radix_node *
-rn_lookup(v_arg, m_arg, head)
-   void *v_arg, *m_arg;
-   struct radix_node_head *head;
+rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
 {
-   register struct radix_node *x;
-   caddr_t netmask = 0;
+   struct radix_node *x;
+   caddr_t netmask;
 
-   if (m_arg) {
+   if (m_arg != NULL) {
+   /*
+* Most common case: search exact prefix/mask
+*/
x = rn_addmask_r(m_arg, head-rnh_masks, 1,
head-rnh_treetop-rn_offset);
-   if (x == 0)
-   return (0);
+   if (x == NULL)
+   return (NULL);
netmask = x-rn_key;
-   }
-   x = rn_match(v_arg, head);
-   if (x  netmask) {
-   while (x  x-rn_mask != netmask)
+
+   x = rn_match(v_arg, head);
+
+   while (x != NULL  x-rn_mask != netmask)
x = x-rn_dupedkey;
+
+   return (x);
}
-   return x;
+
+   /*
+* Search for host address.
+*/
+   if ((x = rn_match(v_arg, head)) == NULL)
+   return (NULL);
+
+   /* Check if found key is the same */
+   if (LEN(x-rn_key) != LEN(v_arg) || bcmp(x-rn_key, v_arg, LEN(v_arg)))
+   return (NULL);
+
+   /* Check if this is not host route */
+  

svn commit: r265709 - in head/sys/dev: mpr mps

2014-05-08 Thread Kenneth D. Merry
Author: ken
Date: Thu May  8 20:28:22 2014
New Revision: 265709
URL: http://svnweb.freebsd.org/changeset/base/265709

Log:
  Fix TLR (Transport Layer Retry) support in the mps(4) and mpr(4) drivers.
  
  TLR is necessary for reliable communication with SAS tape drives.
  
  This was broken by change 246713 in the mps(4) driver.  It changed the
  cm_data field for SCSI I/O requests to point to the CCB instead of the data
  buffer.  So, instead, look at the CCB's data pointer to determine whether
  or not we're talking to a tape drive.
  
  Also, take the residual into account to make sure that we don't go off the
  end of the request.
  
  MFC after:3 days
  Sponsored by: Spectra Logic Corporation

Modified:
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mps/mps_sas.c

Modified: head/sys/dev/mpr/mpr_sas.c
==
--- head/sys/dev/mpr/mpr_sas.c  Thu May  8 20:27:06 2014(r265708)
+++ head/sys/dev/mpr/mpr_sas.c  Thu May  8 20:28:22 2014(r265709)
@@ -2355,8 +2355,9 @@ mprsas_scsiio_complete(struct mpr_softc 
(csio-cdb_io.cdb_bytes[1]  SI_EVPD) 
(csio-cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) 
((csio-ccb_h.flags  CAM_DATA_MASK) == CAM_DATA_VADDR) 
-   (csio-data_ptr != NULL)  (((uint8_t *)cm-cm_data)[0] ==
-   T_SEQUENTIAL)  (sc-control_TLR) 
+   (csio-data_ptr != NULL) 
+   ((csio-data_ptr[0]  0x1f) == T_SEQUENTIAL) 
+   (sc-control_TLR) 
(sc-mapping_table[csio-ccb_h.target_id].device_info 
MPI2_SAS_DEVICE_INFO_SSP_TARGET)) {
vpd_list = (struct scsi_vpd_supported_page_list *)
@@ -2367,6 +2368,7 @@ mprsas_scsiio_complete(struct mpr_softc 
TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
alloc_len = ((u16)csio-cdb_io.cdb_bytes[3]  8) +
csio-cdb_io.cdb_bytes[4];
+   alloc_len -= csio-resid;
for (i = 0; i  MIN(vpd_list-length, alloc_len); i++) {
if (vpd_list-list[i] == 0x90) {
*TLR_bits = TLR_on;

Modified: head/sys/dev/mps/mps_sas.c
==
--- head/sys/dev/mps/mps_sas.c  Thu May  8 20:27:06 2014(r265708)
+++ head/sys/dev/mps/mps_sas.c  Thu May  8 20:28:22 2014(r265709)
@@ -2316,8 +2316,9 @@ mpssas_scsiio_complete(struct mps_softc 
(csio-cdb_io.cdb_bytes[1]  SI_EVPD) 
(csio-cdb_io.cdb_bytes[2] == SVPD_SUPPORTED_PAGE_LIST) 
((csio-ccb_h.flags  CAM_DATA_MASK) == CAM_DATA_VADDR) 
-   (csio-data_ptr != NULL)  (((uint8_t *)cm-cm_data)[0] ==
-   T_SEQUENTIAL)  (sc-control_TLR) 
+   (csio-data_ptr != NULL) 
+   ((csio-data_ptr[0]  0x1f) == T_SEQUENTIAL) 
+   (sc-control_TLR) 
(sc-mapping_table[csio-ccb_h.target_id].device_info 
MPI2_SAS_DEVICE_INFO_SSP_TARGET)) {
vpd_list = (struct scsi_vpd_supported_page_list *)
@@ -2328,6 +2329,7 @@ mpssas_scsiio_complete(struct mps_softc 
TLR_on = (u8)MPI2_SCSIIO_CONTROL_TLR_ON;
alloc_len = ((u16)csio-cdb_io.cdb_bytes[3]  8) +
csio-cdb_io.cdb_bytes[4];
+   alloc_len -= csio-resid;
for (i = 0; i  MIN(vpd_list-length, alloc_len); i++) {
if (vpd_list-list[i] == 0x90) {
*TLR_bits = TLR_on;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265710 - stable/9/sys/net

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 20:33:47 2014
New Revision: 265710
URL: http://svnweb.freebsd.org/changeset/base/265710

Log:
  Merge r260379, r260460.
  
  r260379:
Partially fix IPv4 interface routes deletion in RADIX_MPATH.
  
Noticed by:   Nikolay Denev ndenev at gmail.com
  
  r260460:
Constanly use RT_ALL_FIBS everywhere instead of -1.

Modified:
  stable/9/sys/net/radix_mpath.c
  stable/9/sys/net/route.c
  stable/9/sys/net/route.h
  stable/9/sys/net/rtsock.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/net/   (props changed)

Modified: stable/9/sys/net/radix_mpath.c
==
--- stable/9/sys/net/radix_mpath.c  Thu May  8 20:28:22 2014
(r265709)
+++ stable/9/sys/net/radix_mpath.c  Thu May  8 20:33:47 2014
(r265710)
@@ -112,11 +112,16 @@ rt_mpath_matchgate(struct rtentry *rt, s
if (rt-rt_gateway-sa_family == AF_LINK) {
if (!memcmp(rt-rt_ifa-ifa_addr, gate, gate-sa_len))
break;
-   } else {
-   if (rt-rt_gateway-sa_len == gate-sa_len 
-   !memcmp(rt-rt_gateway, gate, gate-sa_len))
-   break;
}
+
+   /*
+* Check for other options:
+* 1) Routes with 'real' IPv4/IPv6 gateway
+* 2) Loopback host routes (another AF_LINK/sockadd_dl check)
+* */
+   if (rt-rt_gateway-sa_len == gate-sa_len 
+   !memcmp(rt-rt_gateway, gate, gate-sa_len))
+   break;
} while ((rn = rn_mpath_next(rn)) != NULL);
 
return (struct rtentry *)rn;

Modified: stable/9/sys/net/route.c
==
--- stable/9/sys/net/route.cThu May  8 20:28:22 2014(r265709)
+++ stable/9/sys/net/route.cThu May  8 20:33:47 2014(r265710)
@@ -1515,7 +1515,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int
fibnum = RT_DEFAULT_FIB;
break;
}
-   if (fibnum == -1) {
+   if (fibnum == RT_ALL_FIBS) {
if (rt_add_addr_allfibs == 0  cmd == (int)RTM_ADD) {
startfib = endfib = curthread-td_proc-p_fibnum;
} else {
@@ -1564,10 +1564,10 @@ rtinit1(struct ifaddr *ifa, int cmd, int
/* this table doesn't exist but others might */
continue;
RADIX_NODE_HEAD_RLOCK(rnh);
+   rn = rnh-rnh_lookup(dst, netmask, rnh);
 #ifdef RADIX_MPATH
if (rn_mpath_capable(rnh)) {
 
-   rn = rnh-rnh_matchaddr(dst, rnh);
if (rn == NULL) 
error = ESRCH;
else {
@@ -1581,13 +1581,11 @@ rtinit1(struct ifaddr *ifa, int cmd, int
 */
rt = rt_mpath_matchgate(rt,
ifa-ifa_addr);
-   if (!rt) 
+   if (rt == NULL) 
error = ESRCH;
}
}
-   else
 #endif
-   rn = rnh-rnh_lookup(dst, netmask, rnh);
error = (rn == NULL ||
(rn-rn_flags  RNF_ROOT) ||
RNTORT(rn)-rt_ifa != ifa);
@@ -1721,7 +1719,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int
 int
 rtinit_fib(struct ifaddr *ifa, int cmd, int flags)
 {
-   return (rtinit1(ifa, cmd, flags, -1));
+   return (rtinit1(ifa, cmd, flags, RT_ALL_FIBS));
 }
 #endif
 
@@ -1745,7 +1743,7 @@ rtinit(struct ifaddr *ifa, int cmd, int 
case AF_INET6:
case AF_INET:
/* We do support multiple FIBs. */
-   fib = -1;
+   fib = RT_ALL_FIBS;
break;
}
return (rtinit1(ifa, cmd, flags, fib));

Modified: stable/9/sys/net/route.h
==
--- stable/9/sys/net/route.hThu May  8 20:28:22 2014(r265709)
+++ stable/9/sys/net/route.hThu May  8 20:33:47 2014(r265710)
@@ -92,7 +92,8 @@ struct rt_metrics {
 #defineRTTTOPRHZ(r)((r) / (RTM_RTTUNIT / PR_SLOWHZ))
 
 #defineRT_DEFAULT_FIB  0   /* Explicitly mark fib=0 restricted 
cases */
-extern u_int rt_numfibs;   /* number fo usable routing tables */
+#defineRT_ALL_FIBS -1  /* Announce event for every fib */
+extern u_int rt_numfibs;   /* number of usable routing tables */
 /*
  * XXX kernel function pointer `rt_output' is visible to 

svn commit: r265711 - stable/10/sys/net

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 20:41:39 2014
New Revision: 265711
URL: http://svnweb.freebsd.org/changeset/base/265711

Log:
  Merge r260379, r260460.
  
  r260379:
Partially fix IPv4 interface routes deletion in RADIX_MPATH.
  
Noticed by:   Nikolay Denev ndenev at gmail.com
  
  r260460:
Constanly use RT_ALL_FIBS everywhere instead of -1.

Modified:
  stable/10/sys/net/radix_mpath.c
  stable/10/sys/net/route.c
  stable/10/sys/net/route.h
  stable/10/sys/net/rtsock.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/radix_mpath.c
==
--- stable/10/sys/net/radix_mpath.c Thu May  8 20:33:47 2014
(r265710)
+++ stable/10/sys/net/radix_mpath.c Thu May  8 20:41:39 2014
(r265711)
@@ -112,11 +112,16 @@ rt_mpath_matchgate(struct rtentry *rt, s
if (rt-rt_gateway-sa_family == AF_LINK) {
if (!memcmp(rt-rt_ifa-ifa_addr, gate, gate-sa_len))
break;
-   } else {
-   if (rt-rt_gateway-sa_len == gate-sa_len 
-   !memcmp(rt-rt_gateway, gate, gate-sa_len))
-   break;
}
+
+   /*
+* Check for other options:
+* 1) Routes with 'real' IPv4/IPv6 gateway
+* 2) Loopback host routes (another AF_LINK/sockadd_dl check)
+* */
+   if (rt-rt_gateway-sa_len == gate-sa_len 
+   !memcmp(rt-rt_gateway, gate, gate-sa_len))
+   break;
} while ((rn = rn_mpath_next(rn)) != NULL);
 
return (struct rtentry *)rn;

Modified: stable/10/sys/net/route.c
==
--- stable/10/sys/net/route.c   Thu May  8 20:33:47 2014(r265710)
+++ stable/10/sys/net/route.c   Thu May  8 20:41:39 2014(r265711)
@@ -1532,7 +1532,7 @@ rtinit1(struct ifaddr *ifa, int cmd, int
fibnum = RT_DEFAULT_FIB;
break;
}
-   if (fibnum == -1) {
+   if (fibnum == RT_ALL_FIBS) {
if (rt_add_addr_allfibs == 0  cmd == (int)RTM_ADD) {
startfib = endfib = curthread-td_proc-p_fibnum;
} else {
@@ -1581,10 +1581,10 @@ rtinit1(struct ifaddr *ifa, int cmd, int
/* this table doesn't exist but others might */
continue;
RADIX_NODE_HEAD_RLOCK(rnh);
+   rn = rnh-rnh_lookup(dst, netmask, rnh);
 #ifdef RADIX_MPATH
if (rn_mpath_capable(rnh)) {
 
-   rn = rnh-rnh_matchaddr(dst, rnh);
if (rn == NULL) 
error = ESRCH;
else {
@@ -1598,13 +1598,11 @@ rtinit1(struct ifaddr *ifa, int cmd, int
 */
rt = rt_mpath_matchgate(rt,
ifa-ifa_addr);
-   if (!rt) 
+   if (rt == NULL) 
error = ESRCH;
}
}
-   else
 #endif
-   rn = rnh-rnh_lookup(dst, netmask, rnh);
error = (rn == NULL ||
(rn-rn_flags  RNF_ROOT) ||
RNTORT(rn)-rt_ifa != ifa);
@@ -1753,7 +1751,7 @@ rtinit(struct ifaddr *ifa, int cmd, int 
case AF_INET6:
case AF_INET:
/* We do support multiple FIBs. */
-   fib = -1;
+   fib = RT_ALL_FIBS;
break;
}
return (rtinit1(ifa, cmd, flags, fib));

Modified: stable/10/sys/net/route.h
==
--- stable/10/sys/net/route.h   Thu May  8 20:33:47 2014(r265710)
+++ stable/10/sys/net/route.h   Thu May  8 20:41:39 2014(r265711)
@@ -83,7 +83,8 @@ struct rt_metrics {
 #defineRTTTOPRHZ(r)((r) / (RTM_RTTUNIT / PR_SLOWHZ))
 
 #defineRT_DEFAULT_FIB  0   /* Explicitly mark fib=0 restricted 
cases */
-extern u_int rt_numfibs;   /* number fo usable routing tables */
+#defineRT_ALL_FIBS -1  /* Announce event for every fib */
+extern u_int rt_numfibs;   /* number of usable routing tables */
 
 /*
  * We distinguish between routes to hosts and routes to networks,

Modified: stable/10/sys/net/rtsock.c
==
--- stable/10/sys/net/rtsock.c  Thu May  8 20:33:47 2014(r265710)
+++ stable/10/sys/net/rtsock.c  Thu May  8 20:41:39 2014

svn commit: r265712 - head/sys/dev/mpr

2014-05-08 Thread Kenneth D. Merry
Author: ken
Date: Thu May  8 20:46:46 2014
New Revision: 265712
URL: http://svnweb.freebsd.org/changeset/base/265712

Log:
  Add #ifdefs in the mpr(4) driver so that versions of stable/9 that
  have implemented the PIM_NOSCAN rescan functionality will have it
  enabled.
  
  This is a no-op for head.
  
  Reviewed by:  slm
  Sponsored by: Spectra Logic Corporation
  MFC after:3 days

Modified:
  head/sys/dev/mpr/mpr_sas.c
  head/sys/dev/mpr/mpr_sas_lsi.c

Modified: head/sys/dev/mpr/mpr_sas.c
==
--- head/sys/dev/mpr/mpr_sas.c  Thu May  8 20:41:39 2014(r265711)
+++ head/sys/dev/mpr/mpr_sas.c  Thu May  8 20:46:46 2014(r265712)
@@ -183,7 +183,8 @@ mprsas_startup_increment(struct mprsas_s
/* just starting, freeze the simq */
mpr_dprint(sassc-sc, MPR_INIT,
%s freezing simq\n, __func__);
-#if __FreeBSD_version = 139
+#if (__FreeBSD_version = 139) || \
+((__FreeBSD_version  100)  (__FreeBSD_version = 902502))
xpt_hold_boot();
 #endif
xpt_freeze_simq(sassc-sim, 1);
@@ -217,7 +218,8 @@ mprsas_startup_decrement(struct mprsas_s
%s releasing simq\n, __func__);
sassc-flags = ~MPRSAS_IN_STARTUP;
xpt_release_simq(sassc-sim, 1);
-#if __FreeBSD_version = 139
+#if (__FreeBSD_version = 139) || \
+((__FreeBSD_version  100)  (__FreeBSD_version = 902502))
xpt_release_boot();
 #else
mprsas_rescan_target(sassc-sc, NULL);
@@ -974,7 +976,8 @@ mprsas_action(struct cam_sim *sim, union
cpi-version_num = 1;
cpi-hba_inquiry = PI_SDTR_ABLE|PI_TAG_ABLE|PI_WIDE_16;
cpi-target_sprt = 0;
-#if __FreeBSD_version = 139
+#if (__FreeBSD_version = 139) || \
+((__FreeBSD_version  100)  (__FreeBSD_version = 902502))
cpi-hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED | PIM_NOSCAN;
 #else
cpi-hba_misc = PIM_NOBUSRESET | PIM_UNMAPPED;

Modified: head/sys/dev/mpr/mpr_sas_lsi.c
==
--- head/sys/dev/mpr/mpr_sas_lsi.c  Thu May  8 20:41:39 2014
(r265711)
+++ head/sys/dev/mpr/mpr_sas_lsi.c  Thu May  8 20:46:46 2014
(r265712)
@@ -801,7 +801,8 @@ mprsas_add_device(struct mpr_softc *sc, 
and connector name (%4s)\n, targ-encl_level,
targ-connector_name);
}
-#if __FreeBSD_version  139
+#if ((__FreeBSD_version = 100)  (__FreeBSD_version  139)) || \
+(__FreeBSD_version  902502)
if ((sassc-flags  MPRSAS_IN_STARTUP) == 0)
 #endif
mprsas_rescan_target(sc, targ);
@@ -992,7 +993,8 @@ mprsas_volume_add(struct mpr_softc *sc, 
free(lun, M_MPR);
}
SLIST_INIT(targ-luns);
-#if __FreeBSD_version  139
+#if ((__FreeBSD_version = 100)  (__FreeBSD_version  139)) || \
+(__FreeBSD_version  902502)
if ((sassc-flags  MPRSAS_IN_STARTUP) == 0)
 #endif
mprsas_rescan_target(sc, targ);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265713 - head/sys/netinet

2014-05-08 Thread Michael Tuexen
Author: tuexen
Date: Thu May  8 20:47:54 2014
New Revision: 265713
URL: http://svnweb.freebsd.org/changeset/base/265713

Log:
  Use KASSERTs as suggested by glebius@
  
  MFC after: 3 days
  X-MFC with: 265691

Modified:
  head/sys/netinet/ip_output.c

Modified: head/sys/netinet/ip_output.c
==
--- head/sys/netinet/ip_output.cThu May  8 20:46:46 2014
(r265712)
+++ head/sys/netinet/ip_output.cThu May  8 20:47:54 2014
(r265713)
@@ -892,20 +892,8 @@ in_delayed_cksum(struct mbuf *m)
offset -= m-m_len;
m = m-m_next;
}
-   if (m == NULL) {
-   /* This should not happen. */
-   printf(in_delayed_cksum(): checksum outside mbuf chain.\n);
-   return;
-   }
-   if (offset + sizeof(u_short)  m-m_len) {
-   /*
-* XXX
-* This should not happen, but if it does, it might make more
-* sense to fix the caller than to add code to split it here.
-*/
-   printf(in_delayed_cksum(): checksum split between mbufs.\n);
-   return;
-   }
+   KASSERT(m != NULL, (in_delayed_cksum: checksum outside mbuf chain.));
+   KASSERT(offset + sizeof(u_short) = m-m_len, (in_delayed_cksum: 
checksum split between mbufs.));
*(u_short *)(m-m_data + offset) = csum;
 }
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265691 - head/sys/netinet

2014-05-08 Thread Michael Tuexen
On 08 May 2014, at 22:23, Gleb Smirnoff gleb...@freebsd.org wrote:

 On Thu, May 08, 2014 at 05:27:46PM +, Michael Tuexen wrote:
 M Author: tuexen
 M Date: Thu May  8 17:27:46 2014
 M New Revision: 265691
 M URL: http://svnweb.freebsd.org/changeset/base/265691
 M 
 M Log:
 M   For some UDP packets (for example with 200 byte payload) and IP options,
 M   the IP header and the UDP header are not in the same mbuf.
 M   Add code to in_delayed_cksum() to deal with this case.
 M   
 M   MFC after: 3 days
 M 
 M Modified:
 M   head/sys/netinet/ip_output.c
 M 
 M Modified: head/sys/netinet/ip_output.c
 M 
 ==
 M --- head/sys/netinet/ip_output.c   Thu May  8 17:20:45 2014
 (r265690)
 M +++ head/sys/netinet/ip_output.c   Thu May  8 17:27:46 2014
 (r265691)
 M @@ -887,15 +887,23 @@ in_delayed_cksum(struct mbuf *m)
 Mcsum = 0x;
 Moffset += m-m_pkthdr.csum_data;/* checksum offset */
 M  
 M +  /* find the mbuf in the chain where the checksum starts*/
 M +  while ((m != NULL)  (offset = m-m_len)) {
 M +  offset -= m-m_len;
 M +  m = m-m_next;
 M +  }
 M +  if (m == NULL) {
 M +  /* This should not happen. */
 M +  printf(in_delayed_cksum(): checksum outside mbuf chain.\n);
 M +  return;
 M +  }
 Mif (offset + sizeof(u_short)  m-m_len) {
 M -  printf(delayed m_pullup, m-len: %d  off: %d  p: %d\n,
 M -  m-m_len, offset, ip-ip_p);
 M/*
 M * XXX
 M -   * this shouldn't happen, but if it does, the
 M -   * correct behavior may be to insert the checksum
 M -   * in the appropriate next mbuf in the chain.
 M +   * This should not happen, but if it does, it might make more
 M +   * sense to fix the caller than to add code to split it here.
 M */
 M +  printf(in_delayed_cksum(): checksum split between mbufs.\n);
 Mreturn;
 M}
 M*(u_short *)(m-m_data + offset) = csum;
 
 If this should not happen really means that we do not expect this issue
 at all, assuming we are coding correctly, then all these comments and printfs
 should be converted to KASSERTs.
I tried to keep the style of the code...
However, if the first one occurs, we are setting up a packet and have it too
short to contain the checksum. This would really be bug in our code... So a 
KASSERT is fine.
A KASSERT for the second case is also fine.
The only difference between the above and the KASSERT version is that
in case of problems the above just sends packets with wrong checksums
and the KASSERT version will panic (when compiled with INVARIANTS) or
panic (in case of m == NULL) or corrupt a byte. However, I also prefer
the KASSERT version, it will help to get the code right...
So I committed a change in
http://svnweb.freebsd.org/changeset/base/265713

Thanks for your suggestion!

Best regards
Michael
 
 If this should not happen means 'such packets shouldn't arrrive from
 network, then we need to remove printfs, because having a remotely
 triggerable printf(9) is a DDoS vulnerability.
 
 -- 
 Totus tuus, Glebius.
 

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


svn commit: r265714 - in stable/10/sys/fs: nfs nfsserver

2014-05-08 Thread Rick Macklem
Author: rmacklem
Date: Thu May  8 20:52:25 2014
New Revision: 265714
URL: http://svnweb.freebsd.org/changeset/base/265714

Log:
  MFC: r265252
  The new draft specification for NFSv4.0 specifies that a server
  should either accept owner and owner_group strings that are just
  the digits of the uid/gid or return NFS4ERR_BADOWNER.
  This patch adds a sysctl vfs.nfsd.enable_stringtouid, which can
  be set to enable the server w.r.t. accepting numeric string. It
  also ensures that NFS4ERR_BADOWNER is returned if numeric uid/gid
  strings are not enabled. This fixes the server for recent Linux
  nfs4 clients that use numeric uid/gid strings by default.

Modified:
  stable/10/sys/fs/nfs/nfs_commonsubs.c
  stable/10/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/10/sys/fs/nfs/nfs_commonsubs.c   Thu May  8 20:47:54 2014
(r265713)
+++ stable/10/sys/fs/nfs/nfs_commonsubs.c   Thu May  8 20:52:25 2014
(r265714)
@@ -65,6 +65,7 @@ uid_t nfsrv_defaultuid;
 gid_t nfsrv_defaultgid;
 int nfsrv_lease = NFSRV_LEASE;
 int ncl_mbuf_mlen = MLEN;
+int nfsd_enable_stringtouid = 0;
 NFSNAMEIDMUTEX;
 NFSSOCKMUTEX;
 
@@ -2640,9 +2641,14 @@ nfsv4_strtouid(struct nfsrv_descript *nd
/* If a string of digits and an AUTH_SYS mount, just convert it. */
str0 = str;
tuid = (uid_t)strtoul(str0, endstr, 10);
-   if ((endstr - str0) == len 
-   (nd-nd_flag  (ND_KERBV | ND_NFSCL)) == ND_NFSCL) {
-   *uidp = tuid;
+   if ((endstr - str0) == len) {
+   /* A numeric string. */
+   if ((nd-nd_flag  ND_KERBV) == 0 
+   ((nd-nd_flag  ND_NFSCL) != 0 ||
+ nfsd_enable_stringtouid != 0))
+   *uidp = tuid;
+   else
+   error = NFSERR_BADOWNER;
goto out;
}
/*
@@ -2845,9 +2851,14 @@ nfsv4_strtogid(struct nfsrv_descript *nd
/* If a string of digits and an AUTH_SYS mount, just convert it. */
str0 = str;
tgid = (gid_t)strtoul(str0, endstr, 10);
-   if ((endstr - str0) == len 
-   (nd-nd_flag  (ND_KERBV | ND_NFSCL)) == ND_NFSCL) {
-   *gidp = tgid;
+   if ((endstr - str0) == len) {
+   /* A numeric string. */
+   if ((nd-nd_flag  ND_KERBV) == 0 
+   ((nd-nd_flag  ND_NFSCL) != 0 ||
+ nfsd_enable_stringtouid != 0))
+   *gidp = tgid;
+   else
+   error = NFSERR_BADOWNER;
goto out;
}
/*

Modified: stable/10/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Thu May  8 20:47:54 2014
(r265713)
+++ stable/10/sys/fs/nfsserver/nfs_nfsdport.c   Thu May  8 20:52:25 2014
(r265714)
@@ -80,6 +80,7 @@ static int nfs_commit_blks;
 static int nfs_commit_miss;
 extern int nfsrv_issuedelegs;
 extern int nfsrv_dolocallocks;
+extern int nfsd_enable_stringtouid;
 
 SYSCTL_NODE(_vfs, OID_AUTO, nfsd, CTLFLAG_RW, 0, New NFS server);
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, mirrormnt, CTLFLAG_RW,
@@ -92,6 +93,8 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_de
 nfsrv_issuedelegs, 0, Enable nfsd to issue delegations);
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW,
 nfsrv_dolocallocks, 0, Enable nfsd to acquire local locks on files);
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_stringtouid, CTLFLAG_RW,
+nfsd_enable_stringtouid, 0, Enable nfsd to accept numeric owner_names);
 
 #defineMAX_REORDERED_RPC   16
 #defineNUM_HEURISTIC   1031
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265691 - head/sys/netinet

2014-05-08 Thread Gleb Smirnoff
On Thu, May 08, 2014 at 10:50:28PM +0200, Michael Tuexen wrote:
M  If this should not happen really means that we do not expect this issue
M  at all, assuming we are coding correctly, then all these comments and 
printfs
M  should be converted to KASSERTs.
M I tried to keep the style of the code...
M However, if the first one occurs, we are setting up a packet and have it too
M short to contain the checksum. This would really be bug in our code... So a 
KASSERT is fine.
M A KASSERT for the second case is also fine.
M The only difference between the above and the KASSERT version is that
M in case of problems the above just sends packets with wrong checksums
M and the KASSERT version will panic (when compiled with INVARIANTS) or
M panic (in case of m == NULL) or corrupt a byte. However, I also prefer
M the KASSERT version, it will help to get the code right...
M So I committed a change in
M http://svnweb.freebsd.org/changeset/base/265713
M 
M Thanks for your suggestion!

Thanks a lot, Michael!

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


svn commit: r265715 - in stable/9/sys: net netinet

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 20:57:13 2014
New Revision: 265715
URL: http://svnweb.freebsd.org/changeset/base/265715

Log:
  Merge 260488, r260508.
  
  r260488:
Split rt_newaddrmsg_fib() into two different functions.
Adding/deleting interface addresses involves access to 3 different 
subsystems,
int different parts of code. Each call can fail, so reporting successful
operation by rtsock in the middle of the process error-prone.
  
Further split routing notification API and actual rtsock calls via creating
public-available rt_addrmsg() / rt_routemsg() functions with private
rtsock_* backend.
  
  r260508:
Simplify inet alias handling code: if we're adding/removing alias which
has the same prefix as some other alias on the same interface, use
newly-added rt_addrmsg() instead of hand-rolled in_addralias_rtmsg().
  
This eliminates the following rtsock messages:
  
Pinned RTM_ADD for prefix (for alias addition).
Pinned RTM_DELETE for prefix (for alias withdrawal).
  
Example (got 10.0.0.1/24 on vlan4, playing with 10.0.0.2/24):
  
before commit, addition:
  
  got message of size 116 on Fri Jan 10 14:13:15 2014
  RTM_NEWADDR: address being added to iface: len 116, metric 0, flags:
  sockaddrs: NETMASK,IFP,IFA,BRD
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255
  
  got message of size 192 on Fri Jan 10 14:13:15 2014
  RTM_ADD: Add Route: len 192, pid: 0, seq 0, errno 0, flags:UP,PINNED
  locks:  inits:
  sockaddrs: DST,GATEWAY,NETMASK
   10.0.0.0 10.0.0.2 (255)   ff
  
after commit, addition:
  
  got message of size 116 on Fri Jan 10 13:56:26 2014
  RTM_NEWADDR: address being added to iface: len 116, metric 0, flags:
  sockaddrs: NETMASK,IFP,IFA,BRD
   255.255.255.0 vlan4:8.0.27.c5.29.d4 14.0.0.2 14.0.0.255
  
before commit, wihdrawal:
  
  got message of size 192 on Fri Jan 10 13:58:59 2014
  RTM_DELETE: Delete Route: len 192, pid: 0, seq 0, errno 0, 
flags:UP,PINNED
  locks:  inits:
  sockaddrs: DST,GATEWAY,NETMASK
   10.0.0.0 10.0.0.2 (255)   ff
  
  got message of size 116 on Fri Jan 10 13:58:59 2014
  RTM_DELADDR: address being removed from iface: len 116, metric 0, flags:
  sockaddrs: NETMASK,IFP,IFA,BRD
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255
  
adter commit, withdrawal:
  
  got message of size 116 on Fri Jan 10 14:14:11 2014
  RTM_DELADDR: address being removed from iface: len 116, metric 0, flags:
  sockaddrs: NETMASK,IFP,IFA,BRD
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255
  
Sending both RTM_ADD/RTM_DELETE messages to rtsock is completely wrong
(and requires some hacks to keep prefix in route table on RTM_DELETE).
  
I've tested this change with quagga (no change) and bird (*).
  
bird alias handling is already broken in *BSD sysdep code, so nothing
changes here, too.
  
I'm going to MFC this change if there will be no complains about behavior
change.
  
While here, fix some style(9) bugs introduced by r260488
(pointed by glebius and bde).

Modified:
  stable/9/sys/net/route.c
  stable/9/sys/net/route.h
  stable/9/sys/net/rtsock.c
  stable/9/sys/netinet/in.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/net/   (props changed)

Modified: stable/9/sys/net/route.c
==
--- stable/9/sys/net/route.cThu May  8 20:52:25 2014(r265714)
+++ stable/9/sys/net/route.cThu May  8 20:57:13 2014(r265715)
@@ -37,6 +37,7 @@
 #include opt_inet.h
 #include opt_inet6.h
 #include opt_route.h
+#include opt_sctp.h
 #include opt_mrouting.h
 #include opt_mpath.h
 
@@ -86,6 +87,14 @@
 #defineRT_NUMFIBS  1
 #endif
 
+#if defined(INET) || defined(INET6)
+#ifdef SCTP
+extern void sctp_addr_change(struct ifaddr *ifa, int cmd);
+#endif /* SCTP */
+#endif
+
+
+/* This is read-only.. */
 u_int rt_numfibs = RT_NUMFIBS;
 SYSCTL_UINT(_net, OID_AUTO, fibs, CTLFLAG_RD, rt_numfibs, 0, );
 /*
@@ -125,7 +134,8 @@ VNET_DEFINE(int, rttrash);  /* routes no
 
 
 /* compare two sockaddr structures */
-#definesa_equal(a1, a2) (bcmp((a1), (a2), (a1)-sa_len) == 0)
+#definesa_equal(a1, a2) (((a1)-sa_len == (a2)-sa_len)  \
+(bcmp((a1), (a2), (a1)-sa_len) == 0))
 
 /*
  * Convert a 'struct radix_node *' to a 'struct rtentry *'.
@@ -1748,3 +1758,89 @@ rtinit(struct ifaddr *ifa, int cmd, int 
}
return (rtinit1(ifa, cmd, flags, fib));
 }
+
+/*
+ * Announce interface address arrival/withdraw
+ * Returns 0 on success.
+ */
+int
+rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum)
+{
+
+   KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE,
+   (unexpected cmd %d, cmd));
+   
+   KASSERT(fibnum == RT_ALL_FIBS || (fibnum = 0  fibnum  rt_numfibs),
+   (%s: fib out of range 0 =%d%d, 

svn commit: r265716 - head/share/man/man4

2014-05-08 Thread Christian Brueffer
Author: brueffer
Date: Thu May  8 21:02:23 2014
New Revision: 265716
URL: http://svnweb.freebsd.org/changeset/base/265716

Log:
  Fix two more typos.
  
  Submitted by: Trond Endrestol

Modified:
  head/share/man/man4/mrsas.4

Modified: head/share/man/man4/mrsas.4
==
--- head/share/man/man4/mrsas.4 Thu May  8 20:57:13 2014(r265715)
+++ head/share/man/man4/mrsas.4 Thu May  8 21:02:23 2014(r265716)
@@ -34,7 +34,7 @@
 .\
 .\ $FreeBSD$
 .\
-.Dd May 7, 2014
+.Dd May 8, 2014
 .Dt MRSAS 4
 .Os
 .Sh NAME
@@ -122,7 +122,7 @@ The
 .Nm
 driver supports the following hardware:
 .Pp
-[ Thunderbolt 6Gbp/s MR controller ]
+[ Thunderbolt 6Gb/s MR controller ]
 .Bl -bullet -compact
 .It
 LSI MegaRAID SAS 9265
@@ -146,7 +146,7 @@ DELL PERC H810
 DELL PERC H710/P
 .El
 .Pp
-[ Invader/Fury 12Gpb/s MR controller ]
+[ Invader/Fury 12Gb/s MR controller ]
 .Bl -bullet -compact
 .It
 LSI MegaRAID SAS 9380
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265717 - in stable/10/sys: net netinet

2014-05-08 Thread Alexander V. Chernikov
Author: melifaro
Date: Thu May  8 21:03:31 2014
New Revision: 265717
URL: http://svnweb.freebsd.org/changeset/base/265717

Log:
  Merge 260488, r260508.
  
  r260488:
Split rt_newaddrmsg_fib() into two different functions.
Adding/deleting interface addresses involves access to 3 different 
subsystems,
int different parts of code. Each call can fail, so reporting successful
operation by rtsock in the middle of the process error-prone.
  
Further split routing notification API and actual rtsock calls via creating
public-available rt_addrmsg() / rt_routemsg() functions with private
rtsock_* backend.
  
  r260508:
Simplify inet alias handling code: if we're adding/removing alias which
has the same prefix as some other alias on the same interface, use
newly-added rt_addrmsg() instead of hand-rolled in_addralias_rtmsg().
  
This eliminates the following rtsock messages:
  
Pinned RTM_ADD for prefix (for alias addition).
Pinned RTM_DELETE for prefix (for alias withdrawal).
  
Example (got 10.0.0.1/24 on vlan4, playing with 10.0.0.2/24):
  
before commit, addition:
  
  got message of size 116 on Fri Jan 10 14:13:15 2014
  RTM_NEWADDR: address being added to iface: len 116, metric 0, flags:
  sockaddrs: NETMASK,IFP,IFA,BRD
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255
  
  got message of size 192 on Fri Jan 10 14:13:15 2014
  RTM_ADD: Add Route: len 192, pid: 0, seq 0, errno 0, flags:UP,PINNED
  locks:  inits:
  sockaddrs: DST,GATEWAY,NETMASK
   10.0.0.0 10.0.0.2 (255)   ff
  
after commit, addition:
  
  got message of size 116 on Fri Jan 10 13:56:26 2014
  RTM_NEWADDR: address being added to iface: len 116, metric 0, flags:
  sockaddrs: NETMASK,IFP,IFA,BRD
   255.255.255.0 vlan4:8.0.27.c5.29.d4 14.0.0.2 14.0.0.255
  
before commit, wihdrawal:
  
  got message of size 192 on Fri Jan 10 13:58:59 2014
  RTM_DELETE: Delete Route: len 192, pid: 0, seq 0, errno 0, 
flags:UP,PINNED
  locks:  inits:
  sockaddrs: DST,GATEWAY,NETMASK
   10.0.0.0 10.0.0.2 (255)   ff
  
  got message of size 116 on Fri Jan 10 13:58:59 2014
  RTM_DELADDR: address being removed from iface: len 116, metric 0, flags:
  sockaddrs: NETMASK,IFP,IFA,BRD
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255
  
adter commit, withdrawal:
  
  got message of size 116 on Fri Jan 10 14:14:11 2014
  RTM_DELADDR: address being removed from iface: len 116, metric 0, flags:
  sockaddrs: NETMASK,IFP,IFA,BRD
   255.255.255.0 vlan4:8.0.27.c5.29.d4 10.0.0.2 10.0.0.255
  
Sending both RTM_ADD/RTM_DELETE messages to rtsock is completely wrong
(and requires some hacks to keep prefix in route table on RTM_DELETE).
  
I've tested this change with quagga (no change) and bird (*).
  
bird alias handling is already broken in *BSD sysdep code, so nothing
changes here, too.
  
I'm going to MFC this change if there will be no complains about behavior
change.
  
While here, fix some style(9) bugs introduced by r260488
(pointed by glebius and bde).

Modified:
  stable/10/sys/net/route.c
  stable/10/sys/net/route.h
  stable/10/sys/net/rtsock.c
  stable/10/sys/netinet/in.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/net/route.c
==
--- stable/10/sys/net/route.c   Thu May  8 21:02:23 2014(r265716)
+++ stable/10/sys/net/route.c   Thu May  8 21:03:31 2014(r265717)
@@ -37,6 +37,7 @@
 #include opt_inet.h
 #include opt_inet6.h
 #include opt_route.h
+#include opt_sctp.h
 #include opt_mrouting.h
 #include opt_mpath.h
 
@@ -85,6 +86,13 @@
 #defineRT_NUMFIBS  1
 #endif
 
+#if defined(INET) || defined(INET6)
+#ifdef SCTP
+extern void sctp_addr_change(struct ifaddr *ifa, int cmd);
+#endif /* SCTP */
+#endif
+
+
 /* This is read-only.. */
 u_int rt_numfibs = RT_NUMFIBS;
 SYSCTL_UINT(_net, OID_AUTO, fibs, CTLFLAG_RD, rt_numfibs, 0, );
@@ -117,7 +125,8 @@ VNET_DEFINE(int, rttrash);  /* routes no
 
 
 /* compare two sockaddr structures */
-#definesa_equal(a1, a2) (bcmp((a1), (a2), (a1)-sa_len) == 0)
+#definesa_equal(a1, a2) (((a1)-sa_len == (a2)-sa_len)  \
+(bcmp((a1), (a2), (a1)-sa_len) == 0))
 
 /*
  * Convert a 'struct radix_node *' to a 'struct rtentry *'.
@@ -1756,3 +1765,89 @@ rtinit(struct ifaddr *ifa, int cmd, int 
}
return (rtinit1(ifa, cmd, flags, fib));
 }
+
+/*
+ * Announce interface address arrival/withdraw
+ * Returns 0 on success.
+ */
+int
+rt_addrmsg(int cmd, struct ifaddr *ifa, int fibnum)
+{
+
+   KASSERT(cmd == RTM_ADD || cmd == RTM_DELETE,
+   (unexpected cmd %d, cmd));
+   
+   KASSERT(fibnum == RT_ALL_FIBS || (fibnum = 0  fibnum  rt_numfibs),
+   (%s: fib out of range 0 =%d%d, __func__, fibnum, rt_numfibs));
+
+   

svn commit: r265719 - head/sys/dev/vt

2014-05-08 Thread Aleksandr Rybalko
Author: ray
Date: Thu May  8 22:52:05 2014
New Revision: 265719
URL: http://svnweb.freebsd.org/changeset/base/265719

Log:
  Hide debug messages under VT_DEBUG.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt.h
  head/sys/dev/vt/vt_consolectl.c
  head/sys/dev/vt/vt_sysmouse.c

Modified: head/sys/dev/vt/vt.h
==
--- head/sys/dev/vt/vt.hThu May  8 21:12:39 2014(r265718)
+++ head/sys/dev/vt/vt.hThu May  8 22:52:05 2014(r265719)
@@ -78,7 +78,13 @@ one 'device sc' or 'device vt'
 #endif /* defined(SC_TWOBUTTON_MOUSE) || defined(VT_TWOBUTTON_MOUSE) */
 
 #defineSC_DRIVER_NAME  vt
+#ifdef VT_DEBUG
 #defineDPRINTF(_l, ...)if (vt_debug  (_l)) printf( 
__VA_ARGS__ )
+#define VT_CONSOLECTL_DEBUG
+#define VT_SYSMOUSE_DEBUG
+#else
+#defineDPRINTF(_l, ...)do {} while (0)
+#endif
 #defineISSIGVALID(sig) ((sig)  0  (sig)  NSIG)
 
 #defineVT_SYSCTL_INT(_name, _default, _descr)  
\

Modified: head/sys/dev/vt/vt_consolectl.c
==
--- head/sys/dev/vt/vt_consolectl.c Thu May  8 21:12:39 2014
(r265718)
+++ head/sys/dev/vt/vt_consolectl.c Thu May  8 22:52:05 2014
(r265719)
@@ -61,8 +61,10 @@ consolectl_ioctl(struct cdev *dev, u_lon
return (0);
}
default:
+#ifdef VT_CONSOLECTL_DEBUG
printf(consolectl: unknown ioctl: %c:%lx\n,
(char)IOCGROUP(cmd), IOCBASECMD(cmd));
+#endif
return (ENOIOCTL);
}
 }

Modified: head/sys/dev/vt/vt_sysmouse.c
==
--- head/sys/dev/vt/vt_sysmouse.c   Thu May  8 21:12:39 2014
(r265718)
+++ head/sys/dev/vt/vt_sysmouse.c   Thu May  8 22:52:05 2014
(r265719)
@@ -376,8 +376,10 @@ sysmouse_ioctl(struct cdev *dev, u_long 
case MOUSE_MOUSECHAR:
return (0);
default:
+#ifdef VT_SYSMOUSE_DEBUG
printf(sysmouse: unknown ioctl: %c:%lx\n,
(char)IOCGROUP(cmd), IOCBASECMD(cmd));
+#endif
return (ENOIOCTL);
}
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


Re: svn commit: r265472 - head/bin/dd

2014-05-08 Thread Dmitry Morozovsky
On Wed, 7 May 2014, Alan Somers wrote:

[snip]

 Even if nanosecond resolution isn't useful, monotonicity is.  Nobody
 should be using a nonmonotonic clock just to measure durations.  I
 started an audit of all of FreeBSD to look for other programs that use
 gettimeofday to measure durations.  I haven't finished, but I've
 already found a lot, including xz, ping, hastd, fetch, systat, powerd,
 and others.  I don't have time to fix them, though.  Would you be
 interested, or do you know anyone else who would?

From your list, hastd seems to be the most dangerous point to me.

Adding trociny@ as one of the most active hastd-related committers so the issue 
would not be lost in the areas...

-- 
Sincerely,
D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer: ma...@freebsd.org ]

*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru ***

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


Re: svn commit: r265472 - head/bin/dd

2014-05-08 Thread Alan Somers
On Thu, May 8, 2014 at 4:55 PM, Dmitry Morozovsky ma...@rinet.ru wrote:
 On Wed, 7 May 2014, Alan Somers wrote:

 [snip]

 Even if nanosecond resolution isn't useful, monotonicity is.  Nobody
 should be using a nonmonotonic clock just to measure durations.  I
 started an audit of all of FreeBSD to look for other programs that use
 gettimeofday to measure durations.  I haven't finished, but I've
 already found a lot, including xz, ping, hastd, fetch, systat, powerd,
 and others.  I don't have time to fix them, though.  Would you be
 interested, or do you know anyone else who would?

 From your list, hastd seems to be the most dangerous point to me.

 Adding trociny@ as one of the most active hastd-related committers so the 
 issue
 would not be lost in the areas...

In hastd's case, the problematic comparison is only used to print
debugging info.  It happens twice, in primary.c lines 1978 and 2039.


 --
 Sincerely,
 D.Marck [DM5020, MCK-RIPE, DM3-RIPN]
 [ FreeBSD committer: ma...@freebsd.org ]
 
 *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- ma...@rinet.ru ***
 
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265721 - stable/9/sys/fs/nfsclient

2014-05-08 Thread Rick Macklem
Author: rmacklem
Date: Fri May  9 00:19:08 2014
New Revision: 265721
URL: http://svnweb.freebsd.org/changeset/base/265721

Log:
  MFC: r264842
  Modify the NFSv4 client's Pathconf RPC (actually a Getattr Op.)
  so that it only does the RPC for names that are answered by the RPC.
  Doing the RPC for other names is harmless, but unnecessary.

Modified:
  stable/9/sys/fs/nfsclient/nfs_clvnops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsclient/nfs_clvnops.c
==
--- stable/9/sys/fs/nfsclient/nfs_clvnops.c Thu May  8 23:54:15 2014
(r265720)
+++ stable/9/sys/fs/nfsclient/nfs_clvnops.c Fri May  9 00:19:08 2014
(r265721)
@@ -3405,12 +3405,15 @@ nfs_pathconf(struct vop_pathconf_args *a
struct thread *td = curthread;
int attrflag, error;
 
-   if (NFS_ISV4(vp) || (NFS_ISV3(vp)  (ap-a_name == _PC_LINK_MAX ||
+   if ((NFS_ISV34(vp)  (ap-a_name == _PC_LINK_MAX ||
ap-a_name == _PC_NAME_MAX || ap-a_name == _PC_CHOWN_RESTRICTED ||
-   ap-a_name == _PC_NO_TRUNC))) {
+   ap-a_name == _PC_NO_TRUNC)) ||
+   (NFS_ISV4(vp)  ap-a_name == _PC_ACL_NFS4)) {
/*
 * Since only the above 4 a_names are returned by the NFSv3
 * Pathconf RPC, there is no point in doing it for others.
+* For NFSv4, the Pathconf RPC (actually a Getattr Op.) can
+* be used for _PC_NFS4_ACL as well.
 */
error = nfsrpc_pathconf(vp, pc, td-td_ucred, td, nfsva,
attrflag, NULL);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265722 - stable/9/sys/fs/nfsserver

2014-05-08 Thread Rick Macklem
Author: rmacklem
Date: Fri May  9 00:24:11 2014
New Revision: 265722
URL: http://svnweb.freebsd.org/changeset/base/265722

Log:
  MFC: r264845
  Remove an unnecessary level of indirection for an argument.
  This simplifies the code and should avoid the clang sparc
  port from generating an abort() call.

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdstate.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdstate.c
==
--- stable/9/sys/fs/nfsserver/nfs_nfsdstate.c   Fri May  9 00:19:08 2014
(r265721)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdstate.c   Fri May  9 00:24:11 2014
(r265722)
@@ -79,7 +79,7 @@ static int nfsrv_getstate(struct nfsclie
 static void nfsrv_getowner(struct nfsstatehead *hp, struct nfsstate *new_stp,
 struct nfsstate **stpp);
 static int nfsrv_getlockfh(vnode_t vp, u_short flags,
-struct nfslockfile **new_lfpp, fhandle_t *nfhp, NFSPROC_T *p);
+struct nfslockfile *new_lfp, fhandle_t *nfhp, NFSPROC_T *p);
 static int nfsrv_getlockfile(u_short flags, struct nfslockfile **new_lfpp,
 struct nfslockfile **lfpp, fhandle_t *nfhp, int lockit);
 static void nfsrv_insertlock(struct nfslock *new_lop,
@@ -1985,7 +1985,7 @@ tryagain:
MALLOC(new_lfp, struct nfslockfile *, sizeof (struct nfslockfile),
M_NFSDLOCKFILE, M_WAITOK);
if (vp)
-   getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp,
+   getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp,
NULL, p);
NFSLOCKSTATE();
/*
@@ -2235,7 +2235,7 @@ tryagain:
M_NFSDSTATE, M_WAITOK);
MALLOC(new_deleg, struct nfsstate *, sizeof (struct nfsstate),
M_NFSDSTATE, M_WAITOK);
-   getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp,
+   getfhret = nfsrv_getlockfh(vp, new_stp-ls_flags, new_lfp,
NULL, p);
NFSLOCKSTATE();
/*
@@ -3142,11 +3142,10 @@ out:
  * Get the file handle for a lock structure.
  */
 static int
-nfsrv_getlockfh(vnode_t vp, u_short flags,
-struct nfslockfile **new_lfpp, fhandle_t *nfhp, NFSPROC_T *p)
+nfsrv_getlockfh(vnode_t vp, u_short flags, struct nfslockfile *new_lfp,
+fhandle_t *nfhp, NFSPROC_T *p)
 {
fhandle_t *fhp = NULL;
-   struct nfslockfile *new_lfp;
int error;
 
/*
@@ -3154,7 +3153,7 @@ nfsrv_getlockfh(vnode_t vp, u_short flag
 * a fhandle_t on the stack.
 */
if (flags  NFSLCK_OPEN) {
-   new_lfp = *new_lfpp;
+   KASSERT(new_lfp != NULL, (nfsrv_getlockfh: new_lfp NULL));
fhp = new_lfp-lf_fh;
} else if (nfhp) {
fhp = nfhp;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265723 - in stable/9/sys: fs/nfsserver nfsserver

2014-05-08 Thread Rick Macklem
Author: rmacklem
Date: Fri May  9 00:28:07 2014
New Revision: 265723
URL: http://svnweb.freebsd.org/changeset/base/265723

Log:
  MFC: r264888
  The PR reported that the old NFS server did not set uio_td == NULL
  for the VOP_READ() call. This patch fixes both the old and new
  server for this case.

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdport.c
  stable/9/sys/nfsserver/nfs_serv.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/9/sys/fs/nfsserver/nfs_nfsdport.cFri May  9 00:24:11 2014
(r265722)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cFri May  9 00:28:07 2014
(r265723)
@@ -674,6 +674,7 @@ nfsvno_read(struct vnode *vp, off_t off,
uiop-uio_resid = len;
uiop-uio_rw = UIO_READ;
uiop-uio_segflg = UIO_SYSSPACE;
+   uiop-uio_td = NULL;
nh = nfsrv_sequential_heuristic(uiop, vp);
ioflag |= nh-nh_seqcount  IO_SEQSHIFT;
error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred);

Modified: stable/9/sys/nfsserver/nfs_serv.c
==
--- stable/9/sys/nfsserver/nfs_serv.c   Fri May  9 00:24:11 2014
(r265722)
+++ stable/9/sys/nfsserver/nfs_serv.c   Fri May  9 00:28:07 2014
(r265723)
@@ -965,6 +965,7 @@ nfsrv_read(struct nfsrv_descript *nfsd, 
uiop-uio_resid = len;
uiop-uio_rw = UIO_READ;
uiop-uio_segflg = UIO_SYSSPACE;
+   uiop-uio_td = NULL;
nh = nfsrv_sequential_heuristic(uiop, vp);
ioflag |= nh-nh_seqcount  IO_SEQSHIFT;
error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred);
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265724 - in stable/9/sys/fs: nfs nfsserver

2014-05-08 Thread Rick Macklem
Author: rmacklem
Date: Fri May  9 00:34:29 2014
New Revision: 265724
URL: http://svnweb.freebsd.org/changeset/base/265724

Log:
  MFC: r265252
  The new draft specification for NFSv4.0 specifies that a server
  should either accept owner and owner_group strings that are just
  the digits of the uid/gid or return NFS4ERR_BADOWNER.
  This patch adds a sysctl vfs.nfsd.enable_stringtouid, which can
  be set to enable the server w.r.t. accepting numeric string. It
  also ensures that NFS4ERR_BADOWNER is returned if numeric uid/gid
  strings are not enabled. This fixes the server for recent Linux
  nfs4 clients that use numeric uid/gid strings by default.

Modified:
  stable/9/sys/fs/nfs/nfs_commonsubs.c
  stable/9/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfs/nfs_commonsubs.c
==
--- stable/9/sys/fs/nfs/nfs_commonsubs.cFri May  9 00:28:07 2014
(r265723)
+++ stable/9/sys/fs/nfs/nfs_commonsubs.cFri May  9 00:34:29 2014
(r265724)
@@ -65,6 +65,7 @@ uid_t nfsrv_defaultuid;
 gid_t nfsrv_defaultgid;
 int nfsrv_lease = NFSRV_LEASE;
 int ncl_mbuf_mlen = MLEN;
+int nfsd_enable_stringtouid = 0;
 NFSNAMEIDMUTEX;
 NFSSOCKMUTEX;
 
@@ -2621,9 +2622,14 @@ nfsv4_strtouid(struct nfsrv_descript *nd
/* If a string of digits and an AUTH_SYS mount, just convert it. */
str0 = str;
tuid = (uid_t)strtoul(str0, endstr, 10);
-   if ((endstr - str0) == len 
-   (nd-nd_flag  (ND_KERBV | ND_NFSCL)) == ND_NFSCL) {
-   *uidp = tuid;
+   if ((endstr - str0) == len) {
+   /* A numeric string. */
+   if ((nd-nd_flag  ND_KERBV) == 0 
+   ((nd-nd_flag  ND_NFSCL) != 0 ||
+ nfsd_enable_stringtouid != 0))
+   *uidp = tuid;
+   else
+   error = NFSERR_BADOWNER;
goto out;
}
/*
@@ -2826,9 +2832,14 @@ nfsv4_strtogid(struct nfsrv_descript *nd
/* If a string of digits and an AUTH_SYS mount, just convert it. */
str0 = str;
tgid = (gid_t)strtoul(str0, endstr, 10);
-   if ((endstr - str0) == len 
-   (nd-nd_flag  (ND_KERBV | ND_NFSCL)) == ND_NFSCL) {
-   *gidp = tgid;
+   if ((endstr - str0) == len) {
+   /* A numeric string. */
+   if ((nd-nd_flag  ND_KERBV) == 0 
+   ((nd-nd_flag  ND_NFSCL) != 0 ||
+ nfsd_enable_stringtouid != 0))
+   *gidp = tgid;
+   else
+   error = NFSERR_BADOWNER;
goto out;
}
/*

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/9/sys/fs/nfsserver/nfs_nfsdport.cFri May  9 00:28:07 2014
(r265723)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdport.cFri May  9 00:34:29 2014
(r265724)
@@ -80,6 +80,7 @@ static int nfs_commit_blks;
 static int nfs_commit_miss;
 extern int nfsrv_issuedelegs;
 extern int nfsrv_dolocallocks;
+extern int nfsd_enable_stringtouid;
 
 SYSCTL_NODE(_vfs, OID_AUTO, nfsd, CTLFLAG_RW, 0, New NFS server);
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, mirrormnt, CTLFLAG_RW,
@@ -92,6 +93,8 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_de
 nfsrv_issuedelegs, 0, Enable nfsd to issue delegations);
 SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW,
 nfsrv_dolocallocks, 0, Enable nfsd to acquire local locks on files);
+SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_stringtouid, CTLFLAG_RW,
+nfsd_enable_stringtouid, 0, Enable nfsd to accept numeric owner_names);
 
 #defineMAX_REORDERED_RPC   16
 #defineNUM_HEURISTIC   1031
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265726 - stable/10/lib/libc/regex

2014-05-08 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May  9 01:20:39 2014
New Revision: 265726
URL: http://svnweb.freebsd.org/changeset/base/265726

Log:
  MFC   r265202:
  Remove some unreachable breaks in regex.
  
  This is based on a much bigger cleanup done in Illumos.
  
  Reference:
  https://www.illumos.org/issues/2077

Modified:
  stable/10/lib/libc/regex/engine.c
  stable/10/lib/libc/regex/regcomp.c

Modified: stable/10/lib/libc/regex/engine.c
==
--- stable/10/lib/libc/regex/engine.c   Fri May  9 01:13:14 2014
(r265725)
+++ stable/10/lib/libc/regex/engine.c   Fri May  9 01:20:39 2014
(r265726)
@@ -686,19 +686,16 @@ backref(struct match *m,
while (m-g-strip[ss] != SOP(O_BACK, i))
ss++;
return(backref(m, sp+len, stop, ss+1, stopst, lev, rec));
-   break;
case OQUEST_:   /* to null or not */
dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
if (dp != NULL)
return(dp); /* not */
return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec));
-   break;
case OPLUS_:
assert(m-lastpos != NULL);
assert(lev+1 = m-g-nplus);
m-lastpos[lev+1] = sp;
return(backref(m, sp, stop, ss+1, stopst, lev+1, rec));
-   break;
case O_PLUS:
if (sp == m-lastpos[lev])  /* last pass matched null */
return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
@@ -709,7 +706,6 @@ backref(struct match *m,
return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
else
return(dp);
-   break;
case OCH_:  /* find the right one, if any */
ssub = ss + 1;
esub = ss + OPND(s) - 1;
@@ -730,6 +726,7 @@ backref(struct match *m,
else
assert(OP(m-g-strip[esub]) == O_CH);
}
+   /* NOTREACHED */
break;
case OLPAREN:   /* must undo assignment if rest fails */
i = OPND(s);
@@ -741,7 +738,6 @@ backref(struct match *m,
return(dp);
m-pmatch[i].rm_so = offsave;
return(NULL);
-   break;
case ORPAREN:   /* must undo assignment if rest fails */
i = OPND(s);
assert(0  i  i = m-g-nsub);
@@ -752,7 +748,6 @@ backref(struct match *m,
return(dp);
m-pmatch[i].rm_eo = offsave;
return(NULL);
-   break;
default:/* uh oh */
assert(nope);
break;

Modified: stable/10/lib/libc/regex/regcomp.c
==
--- stable/10/lib/libc/regex/regcomp.c  Fri May  9 01:13:14 2014
(r265725)
+++ stable/10/lib/libc/regex/regcomp.c  Fri May  9 01:20:39 2014
(r265726)
@@ -746,7 +746,6 @@ p_b_term(struct parse *p, cset *cs)
case '-':
SETERROR(REG_ERANGE);
return; /* NOTE RETURN */
-   break;
default:
c = '\0';
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265727 - stable/9/lib/libc/regex

2014-05-08 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May  9 01:25:25 2014
New Revision: 265727
URL: http://svnweb.freebsd.org/changeset/base/265727

Log:
  MFC   r265202:
  Remove some unreachable breaks in regex.
  
  This is based on a much bigger cleanup done in Illumos.
  
  Reference:
  https://www.illumos.org/issues/2077

Modified:
  stable/9/lib/libc/regex/engine.c
  stable/9/lib/libc/regex/regcomp.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/lib/   (props changed)
  stable/9/lib/libc/   (props changed)

Modified: stable/9/lib/libc/regex/engine.c
==
--- stable/9/lib/libc/regex/engine.cFri May  9 01:20:39 2014
(r265726)
+++ stable/9/lib/libc/regex/engine.cFri May  9 01:25:25 2014
(r265727)
@@ -686,19 +686,16 @@ backref(struct match *m,
while (m-g-strip[ss] != SOP(O_BACK, i))
ss++;
return(backref(m, sp+len, stop, ss+1, stopst, lev, rec));
-   break;
case OQUEST_:   /* to null or not */
dp = backref(m, sp, stop, ss+1, stopst, lev, rec);
if (dp != NULL)
return(dp); /* not */
return(backref(m, sp, stop, ss+OPND(s)+1, stopst, lev, rec));
-   break;
case OPLUS_:
assert(m-lastpos != NULL);
assert(lev+1 = m-g-nplus);
m-lastpos[lev+1] = sp;
return(backref(m, sp, stop, ss+1, stopst, lev+1, rec));
-   break;
case O_PLUS:
if (sp == m-lastpos[lev])  /* last pass matched null */
return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
@@ -709,7 +706,6 @@ backref(struct match *m,
return(backref(m, sp, stop, ss+1, stopst, lev-1, rec));
else
return(dp);
-   break;
case OCH_:  /* find the right one, if any */
ssub = ss + 1;
esub = ss + OPND(s) - 1;
@@ -730,6 +726,7 @@ backref(struct match *m,
else
assert(OP(m-g-strip[esub]) == O_CH);
}
+   /* NOTREACHED */
break;
case OLPAREN:   /* must undo assignment if rest fails */
i = OPND(s);
@@ -741,7 +738,6 @@ backref(struct match *m,
return(dp);
m-pmatch[i].rm_so = offsave;
return(NULL);
-   break;
case ORPAREN:   /* must undo assignment if rest fails */
i = OPND(s);
assert(0  i  i = m-g-nsub);
@@ -752,7 +748,6 @@ backref(struct match *m,
return(dp);
m-pmatch[i].rm_eo = offsave;
return(NULL);
-   break;
default:/* uh oh */
assert(nope);
break;

Modified: stable/9/lib/libc/regex/regcomp.c
==
--- stable/9/lib/libc/regex/regcomp.c   Fri May  9 01:20:39 2014
(r265726)
+++ stable/9/lib/libc/regex/regcomp.c   Fri May  9 01:25:25 2014
(r265727)
@@ -746,7 +746,6 @@ p_b_term(struct parse *p, cset *cs)
case '-':
SETERROR(REG_ERANGE);
return; /* NOTE RETURN */
-   break;
default:
c = '\0';
break;
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


svn commit: r265728 - stable/10/contrib/gcc/config/i386

2014-05-08 Thread Pedro F. Giffuni
Author: pfg
Date: Fri May  9 01:30:15 2014
New Revision: 265728
URL: http://svnweb.freebsd.org/changeset/base/265728

Log:
  MFC   r265231:
  
  gcc: fix strict alignment.
  
  From the OpenBSD log:
  
  x86-64 ABI requires arrays greater than 16 bytes to be aligned to
  16byte boundary.  However, GCC 16-byte aligns arrays of =16 BITS,
  not BYTES.
  
  This diff improves bug detectability for code which has local arrays
  of [16 .. 127] bits:  in those cases SSP will now detect even 1-byte
  overflows.
  
  Obtained from:OpenBSD (CVS rev 1.4)

Modified:
  stable/10/contrib/gcc/config/i386/i386.c

Modified: stable/10/contrib/gcc/config/i386/i386.c
==
--- stable/10/contrib/gcc/config/i386/i386.cFri May  9 01:25:25 2014
(r265727)
+++ stable/10/contrib/gcc/config/i386/i386.cFri May  9 01:30:15 2014
(r265728)
@@ -14408,7 +14408,7 @@ ix86_local_alignment (tree type, int ali
   if (AGGREGATE_TYPE_P (type)
TYPE_SIZE (type)
TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
-   (TREE_INT_CST_LOW (TYPE_SIZE (type)) = 16
+   (TREE_INT_CST_LOW (TYPE_SIZE (type)) = 128
   || TREE_INT_CST_HIGH (TYPE_SIZE (type)))  align  128)
return 128;
 }
___
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to svn-src-all-unsubscr...@freebsd.org


  1   2   >