Commit Graph

200370 Commits

Author SHA1 Message Date
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
mav
2ceef49597 MFC r287335 (by allanjude):
Remove duplicate defines introduced in initial ZFS import (r168404)

This change reduces compiler warnings by removing duplicate defines

Line numbers are from r168404 (and r284648)
#define lbolt: lines 384 and 459 (531 and 648) (original was renamed later)
#define lbolt64: lines 385 and 460 (532 and 649) (original was renamed later)
#define gethrestime_sec: lines 390 and 465 (540 and 653)
uint64_t physmem: lines 402 and 463 (561 and 651)
2015-10-03 11:27:23 +00:00
mav
ed042b9725 MFC r287283 (by delphij):
Fix a buffer overrun which may lead to data corruption, introduced in
r286951 by reinstating changes in r274628.

In l2arc_compress_buf(), we allocate a buffer to stash away the compressed
data in 'cdata', allocated of l2hdr->b_asize bytes.

We then ask zio_compress_data() to compress the buffer, b_l1hdr.b_tmp_cdata,
which is of l2hdr->b_asize bytes, and have the compressed size (or original
size, if compress didn't gain enough) stored in csize.

To pad the buffer to fit the optimal write size, we round up the compressed
size to L2 device's vdev_ashift.

Illumos code rounds up the size by at most SPA_MINBLOCKSIZE.  Because we
know csize <= b_asize, and b_asize is integer multiple of SPA_MINBLOCKSIZE,
we are guaranteed that the rounded up csize would be <= b_asize. However,
this is not necessarily true when we round up to 1 << vdev_ashift, because
it could be larger than SPA_MINBLOCKSIZE.

So, in the worst case scenario, we are overwriting at most

        (1 << vdev_ashift - SPA_MINBLOCKSIZE)

bytes of memory next to the compressed data buffer.

Andriy's original change in r274628 reorganized the code a little bit,
by moving the padding to after we determined that the compression was
beneficial.  At which point, we would check rounded size against the
allocated buffer size, and the buffer overrun would not be possible.
2015-10-03 11:24:47 +00:00
mav
3cfde751dc MFC r287280 (by delphij):
In r286705 (Illumos 5960/a2cdcdd), a separate thread is created with curproc
as parent.  In the case of a send or receive, the curproc would be the
userland application that issues the ioctl.  This would trigger an assertion
failure introduced in Solaris compatibility shims in r196458 when kernel is
compiled with INVARIANTS.

Fix this by using p0 (proc0 or kernel) as the parent thread when creating
the kernel threads.
2015-10-03 11:23:08 +00:00
mav
b237c6cdd8 MFC r287103 (by avg): 5692 expose the number of hole blocks in a file
FreeBSD porting notes:
- only kernel-side changes are merged
- the new ioctl is not actually implemented yet
- thus, the goal is to synchronize DMU code

illumos/illumos-gate@2bcf0248e9

https://www.illumos.org/issues/5692
we would like to expose the number of hole (sparse) blocks in a file.
this can be useful to for example if you want to fill in the holes with
some data; knowing the number of holes in advances allows you to report
progress on hole filling. We could use SEEK_HOLE to do that but it would
be O(n) where n is the number of holes present in the file.

Author: Max Grossman <max.grossman@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
2015-10-03 11:21:50 +00:00
mav
f2f72b8384 MFC r286983 (by avg):
fix a mismerge in r286539 (MFV 286538: 5562 ZFS sa_handle's violate...)
2015-10-03 11:19:32 +00:00
mav
ff0cc52bed MFC r286951: Restore part of r274628, reverted at r286776. 2015-10-03 11:18:30 +00:00
mav
634be06c9d MFC r286776: Remove some random accumulated diff from Illumos. 2015-10-03 11:17:31 +00:00
mav
d05d0d4757 MFC r286774: 2618 arc.c mistypes in the comments
Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Josef Sipek <jeffpc@josefsipek.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bart Coddens <bart.coddens@gmail.com>

illumos/illumos-gate@fc98fea58e
2015-10-03 11:16:42 +00:00