200328 Commits

Author SHA1 Message Date
mav
76966ba3a7 MFC r287618: Disable CTL_IO_DELAY feature.
It is too developer-oriented to be enabled by default.
2015-10-05 08:55:00 +00:00
mav
f1a03e38c5 MFC r287534: Add two new portal group options "tag" and "foreign".
They are going to be useful in clustered setups.
2015-10-05 08:54:02 +00:00
mav
3f61db5756 MFC r287500: Allow LUN options modification via CTL_LUNREQ_MODIFY.
Not all changes take effect, but that is a different question.
2015-10-05 08:52:37 +00:00
mav
c060972cd4 MFC r287499: Move setting of media parameters inside open routines.
This is preparation for possibility to open/close media several times
per LUN life cycle.  While there, rename variables to reduce confusion.
As additional bonus this allows to open read-only media, such as ZFS
snapshots.
2015-10-05 08:51:20 +00:00
mav
158f0406b0 MFC r287455, r287458, r287459: Remove some dead code. 2015-10-05 08:50:15 +00:00
mav
9c0e046e5c MFC r287433: Small UA cleanup. 2015-10-05 08:48:47 +00:00
mav
efb416ffd8 MFC r287372:
Make most of port methods optional and remove bunch of dummies.
2015-10-05 08:47:45 +00:00
mav
a2a611a1d8 MFC r287293: Remove 600 bytes of port_priv from struct ctl_io_hdr.
This field used only for camtgt frontend, and once it any way preallocates
all requests, let it preallocate this memory too, not bothering core code.
2015-10-05 08:46:48 +00:00
mav
a4eceb6595 MFC r287221: Fix type bug introduced at r286811. 2015-10-05 08:45:56 +00:00
mav
f22bc34284 MFC r286811: Polish sizes processing. 2015-10-05 08:44:39 +00:00
mav
52a9e7a64d MFC r286807: Move "ioctl" CAM frontend into separate file.
It has nothing to share with too huge ctl.c other then device descriptor,
but even that may be counted as design error that may be fixed later.
At some point we may even want to have several ioctl ports.
2015-10-05 08:43:47 +00:00
mav
656a5c3136 MFC r286806: Drop "internal" CTL frontend.
Its idea was to be a simple initiator and execute several commands from
kernel level, but FreeBSD never had consumer for that functionality,
while its implementation polluted many unrelated places.
2015-10-05 08:42:43 +00:00
mav
6be41b0877 MFC r286406, r286414:
Wrap some unused functions with notyet, it is necessary to be able to
build the modules/ctl directly.
Remove a dead MALLOC_DEFINE.
2015-10-05 08:41:32 +00:00
mav
344c89f147 MFC r285600: MULTI_ID supported does not mean it is used. 2015-10-05 08:35:48 +00:00
mav
66cf55baf8 MFC r285510:
Switch initiator IDs in target mode to the same address space as target
IDs in initiator mode -- index in port database instead of handlers.

This makes initiator IDs persist across role changes and firmware resets,
when handlers previously assigned by firmware are lost and reused.
2015-10-05 08:33:41 +00:00
mav
f19237a8be MFC r285481: Make role sysctl handling from r284727 less strict. 2015-10-05 08:32:34 +00:00
mav
ec7deb53d1 MFC r285459: Unify port database use for target and initiator roles.
Aside from cleaner and more consistent code, this allows ports to be both
target and initiator same time, and easily switch from any role to any.
2015-10-05 08:31:48 +00:00
mav
9b07ecd099 MFC r285155:
Make first step toward supporting target and initiator roles same time.

To avoid conflicts between target and initiator devices in CAM, make
CTL use target ID reported by HBA as its initiator_id in XPT_PATH_INQ.
That target ID is known to never be used for initiator role, so it won't
conflict.  For Fibre Channel and FireWire HBAs this specific ID choice
is irrelevant since all target IDs there are virtual. Same time for SPI
HBAs it seems could be even requirement to use same target ID for both
initiator and target roles.

While there are some more things to polish in isp(4) driver, first tests
of using both roles same time on the same port appeared successfull:

# camcontrol devlist -v
scbus0 on isp0 bus 0:
<FREEBSD CTLDISK 0001>             at scbus0 target 1 lun 0 (da20,pass21)
<>                                 at scbus0 target 256 lun 0 (ctl0)
<>                                 at scbus0 target -1 lun ffffffff (ctl1)
2015-10-05 08:30:49 +00:00
mav
587443b8f9 MFC r285154: Remove extra level of target ID indirection (isp_dev_map).
FreeBSD never had limitation on number of target IDs, and there is no
any other requirement to allocate them densely.  Since slots of port
database already populated just sequentially, there is no much need
for another indirection to allocate sequentially too.
2015-10-05 08:29:31 +00:00
mav
276dc40196 MFC r285147: Change comment added in r284540.
This appeared to be not card's issue, but driver's, though solution is
the same so far.
2015-10-05 08:28:33 +00:00
bapt
49c462994f MFC 287473,287485,287493,287494
Add a new sesutil(8) utility

This is an utility for managing SCSI Enclosure Services (SES) device.

For now only one command is supported "locate" which will change the test of the
external LED associated to a given disk.

Usage if the following:
sesutil locate disk [on|off]

Disk can be a device name: "da12" or a special keyword: "all".

Reviewed by:	mav
Relnotes:	yes
Sponsored by:	gandi.net
2015-10-05 08:18:31 +00:00
mav
df85f2e52d MFC r285146: Drop discovered targets when initiator role is disabled. 2015-10-05 08:16:10 +00:00
mav
2df2e7b59b MFC r273051 (by imp):
Use the C99 flexible array construct to denote a variable amount of
data rather than the old-school [1] construct. We have required c99
compilers for some time.
2015-10-05 08:14:27 +00:00
mav
0640ba01cb MFC r271731 (by will): Fix a kernel panic when unloading isp(4).
In the current implementation, the isp_kthread() threads never exit.

The target threads do have an exit mode from isp_attach(), but it is
not invoked from isp_detach().

Ensure isp_detach() notifies threads started for each channel, such
that they exit before their parent device softc detaches, and thus
before the module does.  Otherwise, a page fault panic occurs later in:

sysctl_kern_proc
  sysctl_out_proc
    kern_proc_out
      fill_kinfo_proc
        fill_kinfo_thread
          strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));

For isp_kthread() (and isp(4) target threads), td->td_wmesg references
now-unmapped memory after the module has been unloaded.  These threads
are typically msleep()ing at the time of unload, but they could also
attempt to execute now-unmapped code segments.
2015-10-05 08:13:29 +00:00
mav
84502136f9 MFC r285030: Fix couple panics on forced unmount of backing file. 2015-10-05 08:09:34 +00:00
mav
64e021919b MFC r281532 (by delphij): Eliminate unused headers. 2015-10-05 07:42:05 +00:00
mav
d5fb1f0517 MFC r281531 (by asomers):
Initialize async_arg_ptr in xpt_async when called with async_code
AC_ADVINFO_CHANGED.

Without this change, newly inserted hard disks won't always have their
physical path device nodes created.  The problem reproduces most readily
when attaching a large number of disks at once.
2015-10-05 07:40:18 +00:00
mav
656ac26a52 MFC r280845 (by eadler):
Add some additional quirks for various Western Digital Caviar MHDDs
2015-10-05 07:38:22 +00:00
mav
fece49cfcc MFC r280388 (by benno): Be consistent with M_ZERO when allocating ccbs.
There are four places, all in cam_xpt.c, where ccbs are malloc'ed. Two of
these use M_ZERO, two don't. The two that don't meant that allocated ccbs
had trash in them making it hard to debug errors where they showed up. Due
to this, use M_ZERO all the time when allocating ccbs.
2015-10-05 07:36:16 +00:00
mav
f3e1fd582e MFC r279314 (by trasz): Add missing error check. 2015-10-05 07:33:54 +00:00
mav
f7a8b2b7ad MFC r278622 (by trasz): Remove unused code. 2015-10-05 07:31:51 +00:00
mav
a3098c6c63 MFC r278398 (by trasz):
Fix ordering of "*logout" and "*terminate"; no functional changes.
2015-10-05 07:29:26 +00:00
mav
3de479a07f MFC r257831 (by smh):
Corrected definition for old_rate to match d_rotation_rate
2015-10-05 07:21:26 +00:00
mav
eeb9c6755e MFC r277440 (by will):
Restore the CAM XPT peripheral generation counter, and export it via sysctl.

Define it as an atomic uint32_t.  These increments happen infrequently
enough for the atomic overhead to be a problem, and since they're now
independent atomics, they won't contend with xpt_lock_buses().

This counter is useful as a means of cheaply identifying whether any changes
have been made to the CAM peripheral list.  Userland programs have no guarantee
that the counter won't change on them while being returned or while processing
the information, so they must be written accordingly.
2015-10-05 07:10:09 +00:00
mav
7d80829511 MFC r277101 (by imp):
Explain a bit of tricky code dealing with trims and how it prevents
starvation. These side effects aren't obvious without extremely
careful study, and are important to do just so.
2015-10-05 07:07:37 +00:00
mav
47dc3fe588 MFC r270225 (by jhb): Unexpand TAILQ_FOREACH(). 2015-10-05 06:56:22 +00:00
mav
9b99abcebd MFC r269709 (by imp): is_full_id is set to 0 and then not used. remove it. 2015-10-05 06:55:26 +00:00
kib
b41e3ae634 MFC r288068:
Ensure that maxproc does not exceed pid_max, at the time of boot.
2015-10-05 05:33:30 +00:00
peter
30cb993101 Fix broken build, again.
cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c wasn't added to
conf/files in r286705 and was fixed by r286718.  The broken
version was MFCed by r288571.

Forgotten by:  mav (again)
2015-10-05 01:25:51 +00:00
bdrewery
6bdc1ca71d Partially revert r288607, stable/10 does not use ncurses_dll.h.in like head
does, so this file should not be in CLEANFILES / .NOPATH.
2015-10-03 18:40:27 +00:00
bdrewery
3439b1010e MFC r287982:
Replace afterinstall: hack from r54681 with 'make delete-old' functionality.
2015-10-03 16:26:13 +00:00
bdrewery
77f7f98e06 MFC r287981:
Replace afterinstall: hack from r111083 with 'make delete-old' functionality.
2015-10-03 16:24:20 +00:00
bdrewery
e6473a1f3c MFC r273756,r287980:
r273756:
    only install .pc files when we are not installing 32bit compat libs...
  r287980:
    Replace beforeinstall: handling with FILES.
2015-10-03 16:21:53 +00:00
bdrewery
d55e00843a MFC r288199,r288246:
Add missing CLEANFILES.
2015-10-03 16:01:16 +00:00
mav
cc1f6f3820 MFC r288064 (by avg): 6220 memleak in l2arc on debug build
illumos/illumos-gate/commit/c546f36aa898d913ff77674fb5ff97f15b2e08b4
https://www.illumos.org/issues/6220
  5408 introduced a memleak in l2arc, namely the member b_thawed gets leaked
  when an arc_hdr is realloced from full to l2only.

Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Reviewed by: George Wilson <george@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Arne Jansen <sensille@gmx.net>
2015-10-03 11:43:54 +00:00
mav
3a9f042f34 MFC r287771: 5695 dmu_sync'ed holes do not retain birth time
(userland portion that was not merged in r286677)

Update zdb to also print ltime, type, and level information
for these new style holes. Previously, only the logical birth
time would be printed.
2015-10-03 11:41:27 +00:00
mav
46c4461443 MFC r287744 (by delphij): Reduce diff against upstream. 2015-10-03 11:39:39 +00:00
mav
c9b8e5282d MFC r287706 (by delphij):
6214 zpools going south

In r286570 (MFV of r277426) an unprotected write to b_flags to
set the compression mode was introduced.  This would open a race
window where data is partially decompressed, modified, checksummed
and written to the pool, resulting in pool corruption due to the
partial decompression.

Prevent this by reintroducing b_compress

illumos/illumos-gate@d4cd038c92

Illumos issues:

    6214 zpools going south
    https://www.illumos.org/issues/6214
2015-10-03 11:38:10 +00:00
mav
3d7c92eff7 MFV r287703, r287705 (by delphij):
6091 avl_add doesn't assert on non-debug builds

Use assfail() from libuutil instead of ASSERT() in userland
AVL avl_add.

illumos/illumos-gate@faa2b6be2f

Illumos issues:

    6091 avl_add doesn't assert on non-debug builds
    https://www.illumos.org/issues/6091
2015-10-03 11:37:00 +00:00
mav
3f77fc2885 MFC r287702: 5987 zfs prefetch code needs work
Rewrite the ZFS prefetch code to detect only forward, sequential
streams.

The following kstats have been added:

    kstat.zfs.misc.arcstats.sync_wait_for_async

        How many sync reads have waited for async read
        to complete. (less is better)

    kstat.zfs.misc.arcstats.demand_hit_predictive_prefetch

        How many demand read didn't have to wait for I/O
        because of predictive prefetch.  (more is better)

zfetch kstats have been similified to hits, misses, and max_streams,
with max_streams representing times when we were not able to create
new stream because we already have the maximum number of sequences
for a file.

The sysctl variable/loader tunable vfs.zfs.zfetch.block_cap have been
replaced by vfs.zfs.zfetch.max_distance, which controls maximum bytes
to prefetch per stream.

illumos/illumos-gate@cf6106c8a0

Illumos ZFS issues:

    5987 zfs prefetch code needs work
    https://www.illumos.org/issues/5987
2015-10-03 11:35:18 +00:00