]> git.proxmox.com Git - mirror_zfs-debian.git/log
mirror_zfs-debian.git
11 years agoMerge branch 'build-system'
Brian Behlendorf [Wed, 6 Mar 2013 23:47:38 +0000 (15:47 -0800)]
Merge branch 'build-system'

11 years agoFix zdb.8 macro warning
Brian Behlendorf [Fri, 22 Feb 2013 19:28:28 +0000 (11:28 -0800)]
Fix zdb.8 macro warning

Detected by rpmlint the 'rpool/export/home' section was being
interpretted by troff as an undefined macro.  This resulted
in the 'rpool/export/home' output being omitted from 'man zdb'.

This was caused by starting the line with a ' character.  By
moving the 'in' down to the next line we're able to fix it.

  zfs.x86_64: W: manual-page-warning /usr/share/man/man8/zdb.8.gz
  450: warning: macro `rpool/export/home'' not defined

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRefresh links to web site
Ned Bass [Sun, 17 Feb 2013 19:31:20 +0000 (11:31 -0800)]
Refresh links to web site

A few files still refer to @behlendorf's private fork on
github.  Use the primary web site URL instead.  Two typos
are also corrected.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRetire ZFS.RELEASE file
Brian Behlendorf [Sun, 17 Feb 2013 19:16:22 +0000 (11:16 -0800)]
Retire ZFS.RELEASE file

The ZFS.RELEASE file was originally added to document which
version of OpenSolaris the ZoL code was based on.  However,
that's no longer particularly important or useful.  We'll
likely never see a new onnv_* drop from Solaris, and even
if we do the ZoL changes are now extensive enough they
could not be easily applied.  We now treat Illumos as the
official upstream and cherry pick the patches we need.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove ARCH packaging
Brian Behlendorf [Sun, 17 Feb 2013 19:11:41 +0000 (11:11 -0800)]
Remove ARCH packaging

The kernel modules are now available in the Arch User Repository
(AUR) via zfs.  Since their packaging is maintained and superior
to ours it is being removed from the tree.

  https://wiki.archlinux.org/index.php/ZFS

Now that various distributions are picking up the packages we
should eventually be able to remove most of this infrastructure.
Packaging belongs with the distributions not upstream.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoAdd --with-dracutdir configure option
Brian Behlendorf [Fri, 22 Feb 2013 18:16:16 +0000 (10:16 -0800)]
Add --with-dracutdir configure option

The standard dracut directory has moved from /usr/share/dracut to
/usr/lib/dracut.  To ensure the dracut modules get installed in
the correct location provide a --with-dracutdir configure option
to set the path.

The default install location has been updated to /usr/lib/dracut
which is used by more current versions of Fedora.  However, this
default is overriden by the RPM packaging for consistency.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoAdd KMODDIR to install target
Brian Behlendorf [Sun, 17 Feb 2013 19:05:11 +0000 (11:05 -0800)]
Add KMODDIR to install target

Provide a mechanism to control the directory name the modules
are installed in.  The kernel privdes INSTALL_MOD_DIR for
this but it was hardcoded to be 'addon/zfs'.

Add a KMODDIR variable which can be passed to 'make install'
to override the default directory name.  While we're here
change the default from 'addon/zfs' to 'extra' which is the
kernel.org default.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix zfs_config.h install permissions
Brian Behlendorf [Fri, 8 Feb 2013 21:51:27 +0000 (13:51 -0800)]
Fix zfs_config.h install permissions

The default permissions used by install are 755.  Since this
file isn't executable 644 is more appropriate.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoReplace libexecdir with datadir
Brian Behlendorf [Fri, 8 Feb 2013 18:01:41 +0000 (10:01 -0800)]
Replace libexecdir with datadir

According to the FHS.  Testing scripts and examples which are all
architecture independent should be installed in a subdirectory
under /usr/share.

  http://www.pathname.com/fhs/2.2/fhs-4.11.html

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoAdd snapdev=[hidden|visible] dataset property
Eric Dillmann [Wed, 13 Feb 2013 23:11:59 +0000 (00:11 +0100)]
Add snapdev=[hidden|visible] dataset property

The new snapdev dataset property may be set to control the
visibility of zvol snapshot devices.  By default this value
is set to 'hidden' which will prevent zvol snapshots from
appearing under /dev/zvol/ and /dev/<dataset>/.  When set to
'visible' all zvol snapshots for the dataset will be visible.

This functionality was largely added because when automatic
snapshoting is enabled large numbers of read-only zvol snapshots
will be created.  When creating these devices the kernel will
attempt to read their partition tables, and blkid will attempt
to identify any filesystems on those partitions.  This leads
to a variety of issues:

1) The zvol partition tables will be read in the context of
   the `modprobe zfs` for automatically imported pools.  This
   is undesirable and should be done asynchronously, but for
   now reducing the number of visible devices helps.

2) Udev expects to be able to complete its work for a new
   block devices fairly quickly.  When many zvol devices are
   added at the same time this is no longer be true.  It can
   lead to udev timeouts and missing /dev/zvol links.

3) Simply having lots of devices in /dev/ can be aukward from
   a management standpoint.  Hidding the devices your unlikely
   to ever use helps with this.  Any snapshot device which is
   needed can be made visible by changing the snapdev property.

NOTE: This patch changes the default behavior for zvols which
      was effectively 'snapdev=visible'.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1235
Closes #945
Issue #956
Issue #756

11 years agoMerge zvol.c changes from PSARC 2010/306 Read-only ZFS pools
George Wilson [Sun, 3 Mar 2013 05:57:39 +0000 (00:57 -0500)]
Merge zvol.c changes from PSARC 2010/306 Read-only ZFS pools

The changes to zvol.c were never merged from the last onnv_147
bulk update.  This was because zvol.c was largely rewritten
for Linux making it fairly easy to miss these sorts of changes.

This causes a regression when importing a zpool with zvols
read-only.  This does not impact pool which only contain
filesystem datasets.

References:
  illumos/illumos-gate@f9af39b

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1332
Closes #1333

11 years agoConstify structures containing function pointers
Richard Yao [Fri, 15 Feb 2013 04:37:43 +0000 (23:37 -0500)]
Constify structures containing function pointers

The PaX team modified the kernel's modpost to report writeable function
pointers as section mismatches because they are potential exploit
targets. We could ignore the warnings, but their presence can obscure
actual issues. Proper const correctness can also catch programming
mistakes.

Building the kernel modules against a PaX/GrSecurity patched Linux 3.4.2
kernel reports 133 section mismatches prior to this patch. This patch
eliminates 130 of them. The quantity of writeable function pointers
eliminated by constifying each structure is as follows:

vdev_opts_t             52
zil_replay_func_t       24
zio_compress_info_t     24
zio_checksum_info_t     9
space_map_ops_t         7
arc_byteswap_func_t     5

The remaining 3 writeable function pointers cannot be addressed by this
patch. 2 of them are in zpl_fs_type. The kernel's sget function requires
that this be non-const. The final writeable function pointer is created
by SPL_SHRINKER_DECLARE. The kernel's set_shrinker() and
remove_shrinker() functions also require that this be non-const.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1300

11 years agoEliminate runtime function pointer mods in autotools checks
Richard Yao [Thu, 14 Feb 2013 23:54:04 +0000 (18:54 -0500)]
Eliminate runtime function pointer mods in autotools checks

PaX/GrSecurity patched kernels implement a dialect of C that relies on a
GCC plugin for enforcement. A basic idea in this dialect is that
function pointers in structures should not change during runtime.
This causes code that modifies function pointers at runtime to fail to
compile in many instances. The autotools checks rely on whether or
not small test cases compile against a given kernel. Some
autotools checks assume some default case if other cases fail. When one
of these autotools checks tests a PaX/GrSecurity patched kernel by
modifying a function pointer at runtime, the default case will be used.

Early detection of such situations is possible by relying on compiler
warnings, which are compiler errors when --enable-debug is used.
Unfortunately, very few people build ZFS with --enable-debug. The more
common situation is that these issues manifest themselves as runtime
failures in the form of NULL pointer exceptions.

Previous patches that addressed such issues with PaX/GrSecurity
compatibility largely relied on rewriting autotools checks to avoid
runtime function pointer modification or the addition of PaX/GrSecurity
specific checks. This patch takes the previous work to its logical
conclusion by eliminating the use of runtime function pointer
modification. This permits the removal of PaX-specific autotools checks
in favor of ones that work across all supported kernels.

This should resolve issues that were reported to occur with
PaX/GrSecurity-patched Linux 3.7.5 kernels on Gentoo Linux.

https://bugs.gentoo.org/show_bug.cgi?id=457176

We should be able to prevent future regressions in PaX/GrSecurity
compatibility by ensuring that all changes to ZFSOnLinux avoid runtime
function pointer modification. At the same time, this does not solve the
issue of silent failures triggering default cases in the autotools
check, which is what permitted these regressions to become runtime
failures in the first place. This will need to be addressed in a future
patch.

Reported-by: Marcin Mirosław <bug@mejor.pl>
Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1300

11 years agoFix hot spares
Brian Behlendorf [Wed, 27 Feb 2013 01:02:27 +0000 (17:02 -0800)]
Fix hot spares

The issue with hot spares in ZoL is because it opens all leaf
vdevs exclusively (O_EXCL).  On Linux, exclusive opens cause
subsequent exclusive opens to fail with EBUSY.

This could be resolved by not opening any of the devices
exclusively, which is what Illumos does, but the additional
protection offered by exclusive opens is desirable.  It cleanly
prevents you from accidentally adding an in-use non-ZFS device
to your pool.

To fix this we very slightly relaxed the usage of O_EXCL in
the following ways.

1) Functions which open the device but only read had the
   O_EXCL flag removed and were updated to use O_RDONLY.

2) A common holder was added to the vdev disk code.  This
   allow the ZFS code to internally open the device multiple
   times but non-ZFS callers may not.

3) An exception was added to make_disks() for hot spare when
   creating partition tables.  For hot spare devices which
   are already opened exclusively we skip creating the partition
   table because this must already have been done when the disk
   was originally added as a hot spare.

Additional minor changes include fixing check_in_use() to use
a partition instead of a slice suffix.  And is_spare() was moved
above make_disks() to avoid adding a forward reference.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #250

11 years agoRemove wholedisk check from vdev_disk_open()
Brian Behlendorf [Tue, 26 Feb 2013 19:28:14 +0000 (11:28 -0800)]
Remove wholedisk check from vdev_disk_open()

As described by the comment and enforced the by assertion the
v->vdev_wholedisk will never be -1.  The wholedisk handling
is performed by the user space utilities.  To prevent confusion
this dead code is being removed.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoLeaf vdevs should not be reopened
Brian Behlendorf [Tue, 26 Feb 2013 19:25:55 +0000 (11:25 -0800)]
Leaf vdevs should not be reopened

When vdev_disk.c was implemented for Linux we failed to handle the
reopen case.  According to the vdev_reopen() comment leaf vdevs should
not be closed or opened when v->vdev_reopening is set.  Under Linux
we would always close and open the device.

This issue was only noticed when a 'zpool scrub' command was run while
the leaf vdev device names in /dev/disk/by-vdev were missing.  The
scrub command calls vdev_reopen() which caused the vdevs to be closed
but they couldn't be reopened due to the missing links.  The result
was that all the vdevs were marked unavailable and the pool was
halted due to failmode=wait.

This patch adds the missing functionality in a similiar fashion to
to the Illumos code.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years ago-x shouldn't warn about old on-disk format or unavailable features
Tim Connors [Mon, 25 Feb 2013 21:00:45 +0000 (08:00 +1100)]
-x shouldn't warn about old on-disk format or unavailable features

`zpool status -x` should only flag errors or where the pool is
unavailable.  If it imported fine but isn't using the latest features
available in the code, that's not an error.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1319

11 years agoRemove the bio_empty_barrier() check.
Etienne Dechamps [Sun, 24 Feb 2013 11:22:07 +0000 (11:22 +0000)]
Remove the bio_empty_barrier() check.

To determine whether the kernel is capable of handling empty barrier
BIOs, we check for the presence of the bio_empty_barrier() macro,
which was introduced in 2.6.24. If this macro is defined, then we can
flush disk vdevs; if it isn't, then flushing is disabled.

Unfortunately, the bio_empty_barrier() macro was removed in 2.6.37,
even though the kernel is still capable of handling empty barrier BIOs.

As a result, flushing is effectively disabled on kernels >= 2.6.37,
meaning that starting from this kernel version, zfs doesn't use
barriers to guarantee on-disk data consistency. This is quite bad and
can lead to potential data corruption on power failures.

This patch fixes the issue by removing the configure check for
bio_empty_barrier(), as we don't support kernels <= 2.6.24 anymore.

Thanks to Richard Kojedzinszky for catching this nasty bug.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1318

11 years agoUse -Werror for all kernel configure tests.
Etienne Dechamps [Sun, 24 Feb 2013 12:42:28 +0000 (12:42 +0000)]
Use -Werror for all kernel configure tests.

As a matter of fact, we're already using -Werror for most tests because
of a bug in kernel-bio-empty-barrier.m4 which sets -Werror without
reverting it afterwards. This meant that all tests which ran after this
one was using -Werror.

This patch simply makes it clear that we're using -Werror and makes
the code more readable and more predictable.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1317

11 years agoEnable zfs_arc_memory_throttle_disable by default
Brian Behlendorf [Thu, 21 Feb 2013 20:14:44 +0000 (12:14 -0800)]
Enable zfs_arc_memory_throttle_disable by default

The zfs_arc_memory_throttle_disable module option was introduced
by commit 0c5493d47059f25ce9dbf20c9fe87655f55102a1 to resolve a
memory miscalculation which could result in the txg_sync thread
spinning.

When this was first introduced the default behavior was left
unchanged until enough real world usage confirmed there were no
unexpected issues.  We've now reached that point.  Linux's
direct reclaim is working as expected so we're enabling this
behavior by default.

This helps pave the way to retire the spl_kmem_availrmem()
functionality in the SPL layer.  This was the only caller.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #938

11 years agoFix broken RPATH in spec file
Brian Behlendorf [Fri, 8 Feb 2013 00:33:06 +0000 (16:33 -0800)]
Fix broken RPATH in spec file

Rather then setting _prefix=/ and having to override all the
default install locations.  It's cleaner, and more understandable,
to leave prefix=/usr and only override _sbindir and _libdir.  This
fixes three issues:

* The commands no longer get built with an incorrect rpath for
  the libraries.   This is good because fixing this sort of
  thing is required by the Fedora packaging guidelines.

    http://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath

* The various AUTHORS, COPYRIGHT, etc files are now correctly
  installed under /usr/share/doc instead of /share/doc.

* _libexecdir is now handled properly for each distribution.
  Fedora/RHEL=/usr/libexec, OpenSUSE/SLES=/usr/lib, Debian=/usr/lib/rpm

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1058

11 years agoMake spa.c assertions catch unsupported pre-feature flag pool versions
Richard Yao [Sun, 10 Feb 2013 00:25:55 +0000 (19:25 -0500)]
Make spa.c assertions catch unsupported pre-feature flag pool versions

A couple of assertions in spa.c were designed to prevent the use of
invalid pool versions. They were written under the assumption
that all valid pools are less than SPA_VERSION. Since feature flags
jumped from 28 to 5000, any numbers in the range 28 to 5000
non-inclusive will fail to trigger them.  We switch to the new
SPA_VERSION_IS_SUPPORTED macro to correct this.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1282

11 years agoAdd explicit MAXNAMELEN check
Brian Behlendorf [Mon, 11 Feb 2013 20:55:24 +0000 (12:55 -0800)]
Add explicit MAXNAMELEN check

It turns out that the Linux VFS doesn't strictly handle all cases
where a component path name exceeds MAXNAMELEN.  It does however
appear to correctly handle MAXPATHLEN for us.

The right way to handle this appears to be to add an explicit
check to the zpl_lookup() function.  Several in-tree filesystems
handle this case the same way.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1279

11 years agoUpdate the zfs.8 "ZFS Volumes as Swap" section
Brian Behlendorf [Thu, 7 Feb 2013 22:15:53 +0000 (14:15 -0800)]
Update the zfs.8 "ZFS Volumes as Swap" section

As of 0.6.0-rc11 using ZFS volumes as Linux swap devices is
supported.  Swapping to files in ZFS filesystems is not.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1189

11 years agoSwitch KM_SLEEP to KM_PUSHPAGE
Ned Bass [Wed, 6 Feb 2013 18:15:13 +0000 (10:15 -0800)]
Switch KM_SLEEP to KM_PUSHPAGE

Two more locations where KM_SLEEP was used in a call which must
use KM_PUSHPAGE were found while using the zpool upgrade command.
See commit b8d06fc for additional details.

Also make a small correction to the comment block above
dsl_dir_open_spa().

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1268

11 years agoRemove unused machelf.h header
Brian Behlendorf [Tue, 5 Feb 2013 23:07:09 +0000 (15:07 -0800)]
Remove unused machelf.h header

The machelf.h header is never included by anything in the zfs
build process.  It is all effectively dead code which can be
safely removed.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1265

11 years agoFix function relocations in libzpool
Richard Yao [Tue, 5 Feb 2013 23:14:30 +0000 (18:14 -0500)]
Fix function relocations in libzpool

binutils 2.23.1 fails in situations that generate function relocations
on PowerPC and possibly other architectures. This causes linking of
libzpool to fail because it depends on libnvpair. We add a dependency on
libnvpair to lib/libzpool/Makefile.am to correct that.

Signed-off-by: Richard Yao <ryao@cs.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1267

11 years agoCast 'zfs bad bloc' to ULL for x86
Brian Behlendorf [Tue, 5 Feb 2013 00:35:54 +0000 (16:35 -0800)]
Cast 'zfs bad bloc' to ULL for x86

Explicitly case this value to an unsigned long long for 32-bit
systems to inform the compiler that a long type should not be
used.  Otherwise we get the following compiler error:

  dmu_send.c:376: error: integer constant is too large for
  ‘long’ type

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix 1M references in zpool-features.5
Brian Behlendorf [Mon, 4 Feb 2013 20:35:25 +0000 (12:35 -0800)]
Fix 1M references in zpool-features.5

The zpool-features(5) man page should reference the Linux zfs(8)
and zpool(8) man pages.  The 1M convention isn't used on Linux.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1184

11 years agoAdd zpool-features(5) man page
Brian Behlendorf [Mon, 4 Feb 2013 20:08:25 +0000 (12:08 -0800)]
Add zpool-features(5) man page

The zpool-features(5) man page was accidentally omitted from the
build target when feature flags was merged.  As a result it doesn't
get installed as part of 'make install' so none of the packages
include this man page.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1262

11 years agoZFS 0.6.0-rc14
Brian Behlendorf [Fri, 1 Feb 2013 19:26:55 +0000 (11:26 -0800)]
ZFS 0.6.0-rc14

11 years agoAdd zfs_arc_memory_throttle_disable module option
Brian Behlendorf [Fri, 1 Feb 2013 17:33:04 +0000 (09:33 -0800)]
Add zfs_arc_memory_throttle_disable module option

The way in which virtual box ab(uses) memory can throw off the
free memory calculation in arc_memory_throttle().  The result is
the txg_sync thread will effectively spin waiting for memory to
be released even though there's lots of memory on the system.

To handle this case I'm adding a zfs_arc_memory_throttle_disable
module option largely for virtual box users.  Setting this option
disables free memory checks which allows the txg_sync thread to
make progress.

By default this option is disabled to preserve the current
behavior.  However, because Linux supports direct memory reclaim
it's doubtful throttling due to perceived memory pressure is ever
a good idea.  We should enable this option by default once we've
done enough real world testing to convince ourselve there aren't
any unexpected side effects.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #938

11 years agoAdd zfs_disable_dup_eviction module option
Brian Behlendorf [Fri, 1 Feb 2013 17:18:45 +0000 (09:18 -0800)]
Add zfs_disable_dup_eviction module option

Commit 1eb5bfa introduced a new zfs_disable_dup_eviction tunable.
It should have been made available as a module option in the
original patch but was overlooked.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoHonor 80 character limit in 'zpool status'
Brian Behlendorf [Thu, 31 Jan 2013 19:02:21 +0000 (11:02 -0800)]
Honor 80 character limit in 'zpool status'

This is a minor nit, but the second line of the 'action' message
when you need to upgrade your pool to support feature flags exceeds
the standard 80 character limit.  Fix it by moving the word
'feature' on to the third line.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix mismatch between SA header size and layout
Ned Bass [Wed, 30 Jan 2013 17:48:57 +0000 (09:48 -0800)]
Fix mismatch between SA header size and layout

When a system attribute layout is created an inconsistency may occur
between the system attribute header (sa_hdr_phys_t) size and the
variable-sized attribute count stored in the layout.  The inconsistency
results in the following failed assertion when SA_HDR_SIZE_MATCH_LAYOUT
returns false:

SPLError: 11315:0:(sa.c:1541:sa_find_idx_tab())
ASSERTION((IS_SA_BONUSTYPE(bonustype) && SA_HDR_SIZE_MATCH_LAYOUT(hdr,
tb)) || !IS_SA_BONUSTYPE(bonustype) || (IS_SA_BONUSTYPE(bonustype) &&
hdr->sa_layout_info == 0)) failed

The bug originates in this snippet from sa_find_sizes().

    if (is_var_sz && var_size > 1) {
            if (P2ROUNDUP(hdrsize + sizeof (uint16_t),
                *total < full_space) {
                    hdrsize += sizeof (uint16_t);

This assumes that the current variable-sized attribute will be stored in
the current buffer and accounts for the space needed to store its size
in the sa_hdr_phys_t. However if the next attribute spills over we need
to store a blkptr_t at the end of the bonus buffer to point to the spill
block. If the current attribute is in the way of the blkptr_t then it
too will be relocated into the spill block. But since we've already
accounted for it in the header size we get the inconsistency described
above.

To avoid this, record the index of the last variable-sized attribute
that prompted a hdrsize increase, and reverse the increase if we later
determine that that attribute will be relocated to the spill block.

Signed-off-by: Matthew Ahrens <mahrens@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1250

11 years agoFix rounding discrepancy in sa_find_sizes()
Ned Bass [Tue, 29 Jan 2013 23:49:15 +0000 (15:49 -0800)]
Fix rounding discrepancy in sa_find_sizes()

A rounding discrepancy exists between how sa_build_layouts() and
sa_find_sizes() calculate when the spill block needs to be kicked in.
This results in a narrow size range where sa_build_layouts() believes
there must be a spill block allocated but due to the discrepancy there
isn't.  A panic then occurs when the hdl->sa_spill NULL pointer is
dereferenced.

The following reproducer for this bug was isolated:

    truncate -s 128m /tmp/tank
    zpool create tank /tmp/tank
    zfs create -o xattr=sa tank/fish
    ln -s `perl -e 'print "z" x 41'` /tank/fish/z
    setfattr -hn trusted.foo -v`perl -e 'print "z"x45'` /tank/fish/z

This test results in roughly the following system attribute (SA)
layout:

  176 bytes - "standard" SA's
   41 bytes - name of symbolic link target
  100 bytes - XDR encoded nvlist for xattr
  ---
  317 bytes - total

Because 317 is less than DN_MAX_BONUSLEN (320), sa_find_sizes()
decides no spill block is needed. But sa_build_layouts() rounds 41 up
to 48 when computing the space requirements so it tries to switch to
the spill block.

Note that we were only able to reproduce this bug using a combination
of symbolic links and the Linux-specific xattr=sa dataset property.
So while this issue is not technically Linux-specific, it may be
difficult or impossible to hit the narrow size range needed to
reproduce it on other platforms.

To fix the discrepancy, round the running total in sa_find_sizes() up
to an 8-byte boundary before accounting for each SA, since this is how
they will be stored in the bonus and (possibly) spill buffers.

To make the intent of the code more clear, explicitly assert key
assumptions about expected alignment of data and whether spill-over
will occur.

Signed-off-by: Matthew Ahrens <mahrens@delphix.com
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1240

11 years agoIllumos #3447 improve the comment in txg.c
Adam H. Leventhal [Wed, 30 Jan 2013 16:54:17 +0000 (08:54 -0800)]
Illumos #3447 improve the comment in txg.c

3447 improve the comment in txg.c

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Richard Elling <richard.elling@dey-sys.com>
Approved by: Dan McDonald <danmcd@nexenta.com>

References:
  illumos/illumos-gate@adbbcfface63b3a71922d5a25d34a2018c0435de
  https://www.illumos.org/issues/3447

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRetire zpool_id infrastructure
Brian Behlendorf [Tue, 29 Jan 2013 18:53:19 +0000 (10:53 -0800)]
Retire zpool_id infrastructure

In the interest of maintaining only one udev helper to give vdevs
user friendly names, the zpool_id and zpool_layout infrastructure
is being retired.  They are superseded by vdev_id which incorporates
all the previous functionality.

Documentation for the new vdev_id(8) helper and its configuration
file, vdev_id.conf(5), can be found in their respective man pages.
Several useful example files are installed under /etc/zfs/.

  /etc/zfs/vdev_id.conf.alias.example
  /etc/zfs/vdev_id.conf.multipath.example
  /etc/zfs/vdev_id.conf.sas_direct.example
  /etc/zfs/vdev_id.conf.sas_switch.example

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #981

11 years agoRemove NPTL_GUARD_WITHIN_STACK
Brian Behlendorf [Tue, 29 Jan 2013 18:35:02 +0000 (10:35 -0800)]
Remove NPTL_GUARD_WITHIN_STACK

Commit 4b2f65b253952c5103311cc8bb4b8cdc6836fd7e increased the user
space stack by 4x to resolve certain stack overflows.  As such it
no longer makes sense to worry about a single extra page which
might or might not be part of the process stack.  There is now
ample headroom for normal usage.

By eliminating this configure check we are also resolving the
following segfault which intentionally occurs at configure time
and may be logged in dmesg.

  conftest[22156]: segfault at 7fbf18a47e48 ip 00000000004007fe
  sp 00007fbf18a4be50 error 6 in conftest[400000+1000]

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #3035 LZ4 compression support in ZFS and GRUB
Eric Dillmann [Wed, 23 Jan 2013 09:54:30 +0000 (10:54 +0100)]
Illumos #3035 LZ4 compression support in ZFS and GRUB

3035 LZ4 compression support in ZFS and GRUB

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Christopher Siden <csiden@delphix.com>

References:
  illumos/illumos-gate@a6f561b4aee75d0d028e7b36b151c8ed8a86bc76
  https://www.illumos.org/issues/3035
  http://wiki.illumos.org/display/illumos/LZ4+Compression+In+ZFS

This patch has been slightly modified from the upstream Illumos
version to be compatible with Linux.  Due to the very limited
stack space in the kernel a lz4 workspace kmem cache is used.
Since we are using gcc we are also able to take advantage of the
gcc optimized __builtin_ctz functions.

Support for GRUB has been dropped from this patch.  That code
is available but those changes will need to made to the upstream
GRUB package.

Lastly, several hunks of dead code were dropped for clarity.  They
include the functions real_LZ4_uncompress(), LZ4_compressBound()
and the Visual Studio specific hunks wrapped in _MSC_VER.

Ported-by: Eric Dillmann <eric@jave.fr>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1217

11 years agoQuiet mkfs.ext2 output
Brian Behlendorf [Mon, 28 Jan 2013 22:49:12 +0000 (14:49 -0800)]
Quiet mkfs.ext2 output

The -q option should quiet the mkfs.ext2 output but certain
versions of e2fsprogs appear to ignore it.  This can result in
an extra 'done' message in the test output.  To keep this noise
from distracting just direct stdout to /dev/null.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoLinux 2.6.26 compat, lookup_bdev()
Brian Behlendorf [Mon, 28 Jan 2013 22:15:39 +0000 (14:15 -0800)]
Linux 2.6.26 compat, lookup_bdev()

It's doubtful many people were impacted by this but commit 6c28567
accidentally broke ZFS builds for 2.6.26 and earlier kernels.  This
commit depends on the lookup_bdev() function which exists in 2.6.26
but wasn't exported until 2.6.27.

The availability of the function isn't critical so a wrapper is
introduced which returns ERR_PTR(-ENOTSUP) when the function isn't
defined.  This will have the effect of causing zvol_is_zvol() to
always fail for 2.6.26 kernels.  This in turn means vdevs will
always get opened concurrently which is good for normal usage.
This will only become an issue if your using a zvol as a vdev in
another pool.  In which case you really should be using a newer
kernel anyway.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1205

11 years agoStop using /bin/ as a source in zconfig.sh
Brian Behlendorf [Mon, 28 Jan 2013 21:39:40 +0000 (13:39 -0800)]
Stop using /bin/ as a source in zconfig.sh

Test 5, 6, 7, and 7 in zconfig.sh use /bin/ as a source of random
directories and files for their test.  This has lead to unexpected
tests failures because the total size of /bin/ on the test system
isn't checked and it is entirely possible for it to be larger than
the target filesystem.

To resolve this issue we create a somewhat random collection of
files and directories in /var/tmp to use.  On average we expect
about 5MB of data with the worst case being 20MB.  This is large
enough to be interesting and small enough to always fit in the
default test datasets.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1113

11 years agoUse strerror() not strerror_r()
Brian Behlendorf [Mon, 28 Jan 2013 17:53:51 +0000 (09:53 -0800)]
Use strerror() not strerror_r()

The differ() function used strerror_r() instead of strerror() because
it allowed the error message to be directly copied in to a buffer.
This causes two issues under Linux.

* There are two versions of strerror_r() available an XSI-compliant
  version which returns an 'int' error code.  And a GNU-specific
  version which return a 'char *' to the resulting error string.

    int strerror_r(int errnum, char *buf, size_t buflen);   /* XSI */
    char *strerror_r(int errnum, char *buf, size_t buflen); /* GNU */

* The most recent versions of strerror_r() are annotated with the
  warn_unused_result attribute.  This causes the following warning
  since the upstream implementation casts the result to void.

    warning: ignoring return value of 'strerror_r', declared with
    attribute warn_unused_result [-Wunused-result]

The cleanest way to resolve both of these problems is just to use
strerror() and make a copy of the result in to the buffer.  This
resolves both issues and this is the only instance of strerror_r()
in the code base.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1231

11 years agoAvoid gcc -Werror=maybe-uninitialized warnings
Chris Wedgwood [Sat, 26 Jan 2013 02:19:45 +0000 (18:19 -0800)]
Avoid gcc -Werror=maybe-uninitialized warnings

Explicitly set acl details to zero to silence gcc (zfs_acl_node_read
can't be sure zfs_acl_znode_info will set acl_count and aclsize).
Normally suppressing these warnings by setting this to zero at
declaration time is a bad idea but in this instance it's hard to
avoid and should be fairly safe.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1244

11 years agoUse dsl_dataset_snap_lookup()
Brian Behlendorf [Fri, 25 Jan 2013 22:57:53 +0000 (14:57 -0800)]
Use dsl_dataset_snap_lookup()

Retire the dmu_snapshot_id() function which was introduced in the
initial .zfs control directory implementation.  There is already
an existing dsl_dataset_snap_lookup() which does exactly what we
need, and the dmu_snapshot_id() function as implemented is racy.

https://github.com/zfsonlinux/zfs/issues/1215#issuecomment-12579879

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1238

11 years agovdev_id: improve keyword parsing flexibility
Ned Bass [Thu, 24 Jan 2013 22:19:03 +0000 (14:19 -0800)]
vdev_id: improve keyword parsing flexibility

The vdev_id udev helper strictly requires configuration file keywords
to always be anchored at the beginning of the line and to be followed
by a space character.  However, users may prefer to use indentation or
tab delimitation.  Improve flexibility by simply requiring a keyword
to be the first field on the line.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1239

11 years agoFix zconfig.sh partitioning error
Brian Behlendorf [Thu, 24 Jan 2013 21:54:58 +0000 (13:54 -0800)]
Fix zconfig.sh partitioning error

Parted version 3.0 doesn't allow us to specify the start and end
percentages as 50% and 100% respectively.  This results in:

  Error: The location 100% is outside the device /dev/zd0

Therefore we change the syntax to 51% and -1 for end of device.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix test script error codes
Brian Behlendorf [Thu, 24 Jan 2013 21:49:17 +0000 (13:49 -0800)]
Fix test script error codes

The 'exit $?' command in the INT TERM EXIT trap was overwritting
the expected error code with the error code from mv.  Fix the
issue by removing the 'exit $?'.  It's important the we preserve
the original error code so failures are easily noticed.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoAdd d_clear_d_op() compatibility
Brian Behlendorf [Wed, 23 Jan 2013 00:14:43 +0000 (16:14 -0800)]
Add d_clear_d_op() compatibility

Added d_clear_d_op() helper function which clears some flags and the
registered dentry->d_op table.  This is required because d_set_d_op()
issues a warning when the dentry operations table is already set.
For the .zfs control directory to work properly we must be able to
override the default operations table and register custom .d_automount
and .d_revalidate callbacks.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #1230

11 years agofzap_cursor_move_to_key() should drop l_rwlock
Ned Bass [Tue, 22 Jan 2013 22:33:01 +0000 (14:33 -0800)]
fzap_cursor_move_to_key() should drop l_rwlock

Callers of zap_deref_leaf() must be careful to drop leaf->l_rwlock
since that function returns with the lock held on success.  All other
callers drop the lock correctly but it seems fzap_cursor_move_to_key()
does not.  This may block writers or cause VERIFY failures when the
lock is freed.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1215
Closes zfsonlinux/spl#143
Closes zfsonlinux/spl#97

11 years agoFix zpl_revalidate() NULL deref
Brian Behlendorf [Tue, 22 Jan 2013 17:05:49 +0000 (09:05 -0800)]
Fix zpl_revalidate() NULL deref

In zpl_revalidate() it's possible for the nameidata to be NULL
for kernels which still accept the parameter.  In particular,
lookup_one_len() calls d_revalidate() with a NULL nameidata.

Resolve the issue by checking for a NULL nameidata in which case
just set the flags to 0.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1226

11 years agoUse sb->s_d_op default dentry operations
Brian Behlendorf [Fri, 18 Jan 2013 22:11:40 +0000 (14:11 -0800)]
Use sb->s_d_op default dentry operations

As of Linux 2.6.37 the right way to register custom dentry
operations is to use the super block's ->s_d_op field.
For older kernels they should be registered as part of the
lookup operation.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1223

11 years agoFix zpool on zvol deadlock
Massimo Maggi [Fri, 18 Jan 2013 17:44:09 +0000 (09:44 -0800)]
Fix zpool on zvol deadlock

Commit 65d56083b4617a4cade0cff68cbbaf68114169d6 fixes the lock
inversion between spa_namespace_lock and bdev->bd_mutex but only
for the first user of spa_namespace_lock: dmu_objset_own().
Later spa_namespace_lock gets acquired by dsl_prop_get_integer()
though dsl_prop_get()->dsl_dataset_hold()->dsl_dir_open_spa()->
spa_open()->spa_open_common() without this "protection".  By
moving the mutex release after this second use, even this
acquisition of the lock is "protected" by the ERESTARTSYS trick.

Signed-off-by: Massimo Maggi <me@massimo-maggi.eu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1220

11 years agoRevert "Revert "Fix unlink/xattr deadlock""
Brian Behlendorf [Thu, 17 Jan 2013 18:05:42 +0000 (10:05 -0800)]
Revert "Revert "Fix unlink/xattr deadlock""

This reverts commit 53c7411919a64d6f0889aa0d6974610f6cd35744
effectively reinstating the asynchronous xattr cleanup code.

These Linux changes were reverted because after testing
and careful contemplation I was convinced that due to the
89260a1c8851ce05ea04b23606ba438b271d890 commit they were no
longer required.

Unfortunately, the deadlock described in #1176  was a case
which wasn't considered.  At mount zfs_unlinked_drain() can
occur which will unlink a list of znodes in effectively a
random order which isn't safe.  The only reason it was safe
to originally revert this change was the we could guarantee
that the VFS would always prune the xattr leaves before the
parents.

Therefore, until we can cleanly resolve this deadlock for
all cases we need to keep this change in spite of the xattr
unlink performance penalty associated with it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1176
Issue #457

11 years agoFix 'zfs rollback' on mounted file systems
Brian Behlendorf [Wed, 16 Jan 2013 00:41:09 +0000 (16:41 -0800)]
Fix 'zfs rollback' on mounted file systems

Rolling back a mounted filesystem with open file handles and
cached dentries+inodes never worked properly in ZoL.  The
major issue was that Linux provides no easy mechanism for
modules to invalidate the inode cache for a file system.

Because of this it was possible that an inode from the previous
filesystem would not get properly dropped from the cache during
rolling back.  Then a new inode with the same inode number would
be create and collide with the existing cached inode.  Ideally
this would trigger an VERIFY() but in practice the error wasn't
handled and it would just NULL reference.

Luckily, this issue can be resolved by sprucing up the existing
Solaris zfs_rezget() functionality for the Linux VFS.

The way it works now is that when a file system is rolled back
all the cached inodes will be traversed and refetched from disk.
If a version of the cached inode exists on disk the in-core
copy will be updated accordingly.  If there is no match for that
object on disk it will be unhashed from the inode cache and
marked as stale.

This will effectively make the inode unfindable for lookups
allowing the inode number to be immediately recycled.  The inode
will then only be accessible from the cached dentries.  Subsequent
dentry lookups which reference a stale inode will result in the
dentry being invalidated.  Once invalidated the dentry will drop
its reference on the inode allowing it to be safely pruned from
the cache.

Special care is taken for negative dentries since they do not
reference any inode.  These dentires will be invalidate based
on when they were added to the dentry cache.  Entries added
before the last rollback will be invalidate to prevent them
from masking real files in the dataset.

Two nice side effects of this fix are:

* Removes the dependency on spl_invalidate_inodes(), it can now
  be safely removed from the SPL when we choose to do so.

* zfs_znode_alloc() no longer requires a dentry to be passed.
  This effectively reverts this portition of the code to its
  upstream counterpart.  The dentry is not instantiated more
  correctly in the Linux ZPL layer.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Closes #795

11 years agoFix false ENOENT on snapshot control dentries
Ned Bass [Mon, 14 Jan 2013 21:59:14 +0000 (13:59 -0800)]
Fix false ENOENT on snapshot control dentries

Lookups in the snapshot control directory for an existing snapshot
fail with ENOENT if an earlier lookup failed before the snapshot was
created.  This is because the earlier lookup causes a negative dentry
to be cached which is never invalidated.

The bug can be reproduced as follows (the second ls should succeed):

 $ ls /tank/.zfs/snapshot/s
 ls: cannot access /tank/.zfs/snapshot/s: No such file or directory
 $ zfs snap tank@s
 $ ls /tank/.zfs/snapshot/s
 ls: cannot access /tank/.zfs/snapshot/s: No such file or directory

To remedy this, always invalidate cached dentries in the snapshot
control directory.  Since these entries never exist on disk there is
no significant performance penalty for the extra lookups.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1192

11 years agoFix quoting error in unmount command
Ned Bass [Wed, 16 Jan 2013 20:44:25 +0000 (12:44 -0800)]
Fix quoting error in unmount command

A misplaced single quote caused the umount command to fail with a
syntax error when unmounting snapshots under the .zfs/snapshot
control directory.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1210

11 years agoEnsure that zfs diff prints unicode safely.
Darik Horn [Tue, 15 Jan 2013 01:27:39 +0000 (19:27 -0600)]
Ensure that zfs diff prints unicode safely.

In the stream_bytes() library function used by `zfs diff`, explicitly
cast each byte in the input string to an unsigned character so that the
Linux fprintf() correctly escapes to octal and does not mangle the output.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1172

11 years agoIllumos #3189 kernel panic in test hotspare_onoffline_004_neg
Christopher Siden [Mon, 14 Jan 2013 18:29:55 +0000 (10:29 -0800)]
Illumos #3189 kernel panic in test hotspare_onoffline_004_neg

3189 kernel panic in ZFS test suite during hotspare_onoffline_004_neg

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Arne Jansen <sensille@gmx.net>
Approved by: Dan McDonald <danmcd@nexenta.com>

References:
  illumos/illumos-gate@8f0b538d1dc99df23a6a89cfd9ffddc1b9804a00
  changeset: 13818:e9ad0a945d45
  https://www.illumos.org/issues/3189

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #1862 incremental zfs receive fails for sparse file > 8PB
Arne Jansen [Mon, 14 Jan 2013 18:26:31 +0000 (10:26 -0800)]
Illumos #1862 incremental zfs receive fails for sparse file > 8PB

1862 incremental zfs receive fails for sparse file > 8PB

Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Simon Klinkert <klinkert@webgods.de>
Approved by: Eric Schrock <eric.schrock@delphix.com>

References:
  illumos/illumos-gate@31495a1e56860f4575614774a592fe33fc9c71f2
  illumos changeset: 13789:f0c17d471b7a
  https://www.illumos.org/issues/1862

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #3208 cross-endian incorrect user/group accounting
Matthew Ahrens [Mon, 14 Jan 2013 17:31:53 +0000 (09:31 -0800)]
Illumos #3208 cross-endian incorrect user/group accounting

3208 moving zpool cross-endian results in incorrect user/group
accounting

Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

References:
  illumos/illumos-gate@e828a46d29ad418487f50d56b5c19e2a1f9033a7
  illumos changeset: 13835:eea81edc4f14
  https://www.illumos.org/issues/3208

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #627
Closes #1136

11 years agoIllumos #3397, #3398
Christopher Siden [Sat, 12 Jan 2013 00:42:50 +0000 (16:42 -0800)]
Illumos #3397, #3398

3397 zdb <pool> <objnum> output is too verbose
3398 zdb can't dump feature flags zap objects

Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@nexenta.com>

References:
  illumos/illumos-gate@e690fb27a7d1483f052505e1ff373d205f9dee99
  https://www.illumos.org/issues/3397
  https://www.illumos.org/issues/3398

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #1884, #3028, #3048, #3049, #3060, #3061, #3093
Yuri Pankov [Thu, 10 Jan 2013 22:25:47 +0000 (14:25 -0800)]
Illumos #1884, #3028, #3048, #3049, #3060, #3061, #3093

1884 Empty "used" field for zfs *space commands
3028 zfs {group,user}space -n prints (null) instead of numeric GID/UID
3048 zfs {user,group}space [-s|-S] is broken
3049 zfs {user,group}space -t doesn't really filter the results
3060 zfs {user,group}space -H output isn't tab-delimited
3061 zfs {user,group}space -o doesn't use specified fields order
3093 zfs {user,group}space's -i is noop

Reviewed by: Garry Mills <gary_mills@fastmail.fm>
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

References:
  illumos/illumos-gate@89f5d17b06fc4132c983112b24836a779a0ed736
  illumos changeset: 13803:b5e49d71ff0e
  https://www.illumos.org/issues/1884
  https://www.illumos.org/issues/3028
  https://www.illumos.org/issues/3048
  https://www.illumos.org/issues/3049
  https://www.illumos.org/issues/3060
  https://www.illumos.org/issues/3061
  https://www.illumos.org/issues/3093

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1194

11 years agoIllumos #1377 `zpool status -D' should tell if there are no DDT entries
Yuri Pankov [Fri, 11 Jan 2013 17:11:09 +0000 (09:11 -0800)]
Illumos #1377 `zpool status -D' should tell if there are no DDT entries

1337 `zpool status -D' should tell if there are no DDT entries

Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Reviewed by: George Wilson <gwilson@zfsmail.com>
Approved by: Albert Lee <trisk@nexenta.com>

References:
  illumos/illumos-gate@ce72e614c133351311e87bbbe4eba8fea9e77768
  illumos changeset: 13432:d1ad8d106d64
  https://www.illumos.org/issues/1337

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #1557 assertion failed in userland taskq_destroy()
Garrett D'Amore [Fri, 11 Jan 2013 17:04:23 +0000 (09:04 -0800)]
Illumos #1557 assertion failed in userland taskq_destroy()

1557 assertion failed in userland taskq_destroy()

Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: George Wilson <gwilson@zfsmail.com>
Approved by: Eric Schrock <eric.schrock@delphix.com>

References:
  illumos/illumos-gate@aa846ad9bc4785806bb6263657698d5890afbc08
  illumos changeset: 13597:3eac1e8e0f4c
  https://www.illumos.org/issues/1557

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #2618 arc.c mistypes in the comments
Bart Coddens [Fri, 11 Jan 2013 16:54:18 +0000 (08:54 -0800)]
Illumos #2618 arc.c mistypes in the comments

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>

References:
  illumos/illumos-gate@fc98fea58e89224f6f13d7fae246d6cb5dfa35ea
  illumos changeset: 13721:5b51a16a186f
  https://www.illumos.org/issues/2618

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoOnly use gcc -Wunused-but-set-variable when available
Brian Behlendorf [Fri, 11 Jan 2013 00:09:31 +0000 (16:09 -0800)]
Only use gcc -Wunused-but-set-variable when available

Certain versions of gcc generate an 'unrecognized command
line option' error message when -Wunused-but-set-variable
is used unconditionally.  This in turn can cause several
of the autoconf tests to misdetect an interface.

Now, the use of -Wunused-but-set-variable in the autoconf
tests was introduced by commit b9c59ec8 to address a gcc
4.6 compatibility problem.  So we really only need to pass
this option for version of gcc which are known to support it.

Therefore, the tests have been updated to use the result of
the existing ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE
which determines if gcc supports this option.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1004

11 years ago'zfs send' man page sync'ed with Illumos
Steven Burgess [Fri, 28 Dec 2012 21:53:18 +0000 (16:53 -0500)]
'zfs send' man page sync'ed with Illumos

* Move -R option up one position in the list to match
  the Illumos documentation.

* Move -D option up one position and refreshed it to
  match the Illumos documentation.

* Move -p option up one position and refreshed it to
  match the Illumos documentation.

* Add the -n, -P  documentation found in zfs receive
  in to zfs send where to belongs.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1187

11 years ago'zfs receive' man page sync'ed with Illumos
Steven Burgess [Fri, 28 Dec 2012 21:36:10 +0000 (16:36 -0500)]
'zfs receive' man page sync'ed with Illumos

The only valid options are -vnFu, these other ones seem to be
misplaced zfs send options.

Remove: -D -r -p -n -P

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1186

11 years agoAdd /sbin/fsck.zfs helper
Brian Behlendorf [Wed, 9 Jan 2013 20:51:29 +0000 (12:51 -0800)]
Add /sbin/fsck.zfs helper

A fsck helper to accomidate distributions that expect to be able
to execute a fsck on all filesystem types.  Currently this script
does nothing but it could be extended to act as a compatibility
wrapper for 'zpool scrub'.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #964

11 years agoReport realpath() canonicalization error
Brian Behlendorf [Wed, 9 Jan 2013 19:56:37 +0000 (11:56 -0800)]
Report realpath() canonicalization error

Rather than just reporting the failure include the passed
mount point and error number.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1153

11 years agocall_usermodehelper() should wait for process
Ned Bass [Wed, 9 Jan 2013 23:46:31 +0000 (15:46 -0800)]
call_usermodehelper() should wait for process

As of Linux 3.4 the UMH_WAIT_* constants were renumbered.  In
particular, the meaning of "1" changed from UMH_WAIT_PROC (wait for
process to complete), to UMH_WAIT_EXEC (wait for the exec, but not the
process).  A number of call sites used the number 1 instead of the
constant name, so the behavior was not as expected on kernels with this
change.

One visible consequence of this change was that processes accessing
automounted snapshots received an ELOOP error because they failed to
wait for zfs.mount to complete.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #816

11 years agoRevert "Avoid ELOOP on auto-mounted snapshots"
Brian Behlendorf [Wed, 9 Jan 2013 19:09:06 +0000 (11:09 -0800)]
Revert "Avoid ELOOP on auto-mounted snapshots"

This reverts commit 7afcf5b1da83549bfba70a61fae7a00eaa63c2b0 which
accidentally introduced a regression with the .zfs snapshot directory.
While the updated code still does correctly mount the requested
snapshot.  It updates the vfsmount such that it references the
original dataset vfsmount.  The result is that the snapshot itself
isn't visible.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #816

11 years agoOnly reduce __zio_execute() stack usage in kernel space
Brian Behlendorf [Wed, 9 Jan 2013 00:16:46 +0000 (16:16 -0800)]
Only reduce __zio_execute() stack usage in kernel space

Related to 91579709fccd3e55a21970742b66c388fb1403db we need to
be very careful about not overrunning the stack in kernel space.
However, in user space we're already allowing slightly larger
stacks so this stack usage optimization is not required there.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoMerge branch 'feature-flags'
Brian Behlendorf [Tue, 8 Jan 2013 18:59:05 +0000 (10:59 -0800)]
Merge branch 'feature-flags'

Feature flags support for ZFS ported from Illumos.  Only minimal
compatibility changes were made where required to accomidate Linux.
For a detailed description of feature flags see original proposal
on zfs-discuss.  They are conceptually very similar to Linux's
ext[234] style of feature flags.

http://lists.freebsd.org/pipermail/freebsd-fs/2011-May/011568.html

NOTE: This branch updates the default pool version for new pools
from 28 to 5000.  Version 28 pools may still be created for
compatibility with Solaris by using the '-o version=28' option.

$ zpool create -o version=28 ...

Existing pools must be manually upgraded using 'zpool upgrade'.

$ zpool upgrade ...

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #778

11 years agoIllumos #3145, #3212
George Wilson [Fri, 21 Dec 2012 22:57:09 +0000 (14:57 -0800)]
Illumos #3145, #3212

3145 single-copy arc
3212 ztest: race condition between vdev_online() and spa_vdev_remove()

Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Eric Schrock <eric.schrock@delphix.com>
Reviewed by: Justin T. Gibbs <gibbs@scsiguy.com>
Approved by: Eric Schrock <eric.schrock@delphix.com>

References:
  illumos-gate/commit/9253d63df408bb48584e0b1abfcc24ef2472382e
  illumos changeset: 13840:97fd5cdf328a
  https://www.illumos.org/issues/3145
  https://www.illumos.org/issues/3212

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #989
Closes #1137

11 years agoIllumos #3104: eliminate empty bpobjs
Matthew Ahrens [Sun, 23 Dec 2012 23:57:14 +0000 (15:57 -0800)]
Illumos #3104: eliminate empty bpobjs

3104 eliminate empty bpobjs
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Eric Schrock <eric.schrock@delphix.com>

References:
  illumos/illumos-gate@f17457368189aa911f774c38c1f21875a568bdca
  illumos changeset: 13782:8f78aae28a63
  https://www.illumos.org/issues/3104

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix __zio_execute() asynchronous dispatch
Brian Behlendorf [Tue, 18 Dec 2012 00:23:27 +0000 (16:23 -0800)]
Fix __zio_execute() asynchronous dispatch

To save valuable stack all zio's were made asynchronous when in the
tgx_sync_thread context or during pool initialization.  See commit
2fac4c2 for the original patch and motivation.

Unfortuantely, the changes to dsl_pool_sync_context() made by the
feature flags broke this logic causing in __zio_execute() to dispatch
itself infinitely when called during pool initialization.  This
commit refines the existing logic to specificly target only the two
cases we care about.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #3349: zpool upgrade -V bumps the on disk version number
George Wilson [Sat, 15 Dec 2012 00:28:49 +0000 (16:28 -0800)]
Illumos #3349: zpool upgrade -V bumps the on disk version number

3349 zpool upgrade -V bumps the on disk version number, but leaves
the in core version
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Dan McDonald <danmcd@nexenta.com>

References:
  illumos/illumos-gate@25345e466695fbe736faa53b8f3413d8e8f81981
  https://www.illumos.org/issues/3349

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #3086: unnecessarily setting DS_FLAG_INCONSISTENT on async
Matthew Ahrens [Sat, 15 Dec 2012 00:13:40 +0000 (16:13 -0800)]
Illumos #3086: unnecessarily setting DS_FLAG_INCONSISTENT on async

3086 unnecessarily setting DS_FLAG_INCONSISTENT on async
destroyed datasets
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

References:
  illumos/illumos-gate@ce636f8b38e8c9ff484e880d9abb27251a882860
  illumos changeset: 13776:cd512c80fd75
  https://www.illumos.org/issues/3086

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #2762: zpool command should have better support for feature flags
Christopher Siden [Fri, 14 Dec 2012 23:00:45 +0000 (15:00 -0800)]
Illumos #2762: zpool command should have better support for feature flags

2762 zpool command should have better support for feature flags
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

References:
  illumos/illumos-gate@57221772c3fc05faba04bf48ddff45abf2bbf2bd
  https://www.illumos.org/issues/2762

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoIllumos #3090 and #3102
George Wilson [Fri, 14 Dec 2012 20:38:04 +0000 (12:38 -0800)]
Illumos #3090 and #3102

3090 vdev_reopen() during reguid causes vdev to be treated as corrupt
3102 vdev_uberblock_load() and vdev_validate() may read the wrong label

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

References:
  illumos/illumos-gate@dfbb943217bf8ab22a1a9d2e9dca01d4da95ee0b
  illumos changeset: 13777:b1e53580146d
  https://www.illumos.org/issues/3090
  https://www.illumos.org/issues/3102

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #939

11 years agoRevert "Temporarily disable the reguid test."
Brian Behlendorf [Fri, 14 Dec 2012 20:24:04 +0000 (12:24 -0800)]
Revert "Temporarily disable the reguid test."

This reverts commit d13524579162b35189804c357a63993be758b84c.
Since feature flags have now been merged we can apply the real
upstream fix from Illumos.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #997

11 years agoIllumos #2619 and #2747
Christopher Siden [Thu, 13 Dec 2012 23:24:15 +0000 (15:24 -0800)]
Illumos #2619 and #2747

2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <gwilson@delphix.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

References:
  illumos/illumos-gate@53089ab7c84db6fb76c16ca50076c147cda11757
  illumos/illumos-gate@ad135b5d644628e791c3188a6ecbd9c257961ef8
  illumos changeset: 13700:2889e2596bd6
  https://www.illumos.org/issues/2619
  https://www.illumos.org/issues/2747

NOTE: The grub specific changes were not ported.  This change
must be made to the Linux grub packages.

Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoFix duplicate words in zpool.8
Dominik Honnef [Fri, 4 Jan 2013 19:09:20 +0000 (20:09 +0100)]
Fix duplicate words in zpool.8

Remove the duplicate words 'cannot be' from the zpool.8 man page.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1177

11 years agoAllow fake mounts to succeed on non-legacy filesystems.
Will Rouesnel [Thu, 27 Dec 2012 14:44:16 +0000 (01:44 +1100)]
Allow fake mounts to succeed on non-legacy filesystems.

mountall in Debian depends on being able to pass the -f parameter to
mount, which specifies a fake mount and just updates the mtab. Currently
mount.zfs will fail such a request if it is not passed with -o zfsutil.

This patch allows a fake mount on a non-legacy filesystem to succeed in
the same manner as a -o remount does, thus enabling mountall to work
correctly.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1167

11 years agoFix gcc array subscript above bounds warning
Ned Bass [Wed, 26 Dec 2012 22:56:41 +0000 (14:56 -0800)]
Fix gcc array subscript above bounds warning

In a debug build, certain GCC versions flag an array bounds warning in
the below code from dnode_sync.c

    } else {
            int i;
            ASSERT(dn->dn_next_nblkptr[txgoff] < dnp->dn_nblkptr);
            /* the blkptrs we are losing better be unallocated */
            for (i = dn->dn_next_nblkptr[txgoff];
                i < dnp->dn_nblkptr; i++)
                    ASSERT(BP_IS_HOLE(&dnp->dn_blkptr[i]));

This usage is in fact safe, since the ASSERT ensures the index does
not exceed to maximum possible number of block pointers. However gcc
can't determine that the assignment 'i = dn->dn_next_nblkptr[txgoff];'
falls within the array bounds so it issues a warning.  To avoid this,
initialize i to zero to make gcc happy but skip the elements before
dn->dn_next_nblkptr[txgoff] in the loop body.  Since a dnode contains
at most 3 block pointers this overhead should be negligible.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #950

11 years agoMerge branch 'io_schedule'
Brian Behlendorf [Mon, 7 Jan 2013 18:54:56 +0000 (10:54 -0800)]
Merge branch 'io_schedule'

Currently ZFS doesn't show any I/O time in eg "top" wait% or in
/proc/$pid/stat's blkio_ticks.  Using io_schedule() instead of
schedule() in zio_wait()'s cv_wait() is the correct way to fix
this.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1158
Closes #1175

11 years agoUse cv_wait_io() which will will account for iowait
Matt Johnston [Fri, 21 Dec 2012 02:40:20 +0000 (10:40 +0800)]
Use cv_wait_io() which will will account for iowait

Update zio_wait() to use cv_wait_io() to ensure the iowait time
is properly accounted for.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRevert part of "Log I/Os longer than zio_delay_max (30s default)"
Matt Johnston [Fri, 21 Dec 2012 02:15:34 +0000 (10:15 +0800)]
Revert part of "Log I/Os longer than zio_delay_max (30s default)"

This reverts commit 9dcb97198338ba2d8764dd5604b278118612f74
which was originally introduced to debug occasional slow I/Os.
These I/Os would complete eventually but were observed to take
several 100 seconds.

The root cause of this issue was the CFQ scheduler which can,
under certain conditions, excessively delay an I/O from being
issued to the device.  This issue was mitigated somewhat by
commit 84daaddedbfc9cf4bd1490d8a6f4b2967051e308 which ensures
the I/O elevator gets changed even for DM style devices.

This change isn't in any way harmful but it does conflict with
a required change to properly account from I/O wait time.
Because Linux does not export the io_schedule_timeout() function
we must instead rely  on io_schedule() via cv_wait_io().

The additional debugging information which was added to the
delay event has been intentionally left in place.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoZFS 0.6.0-rc13
Brian Behlendorf [Thu, 20 Dec 2012 19:02:24 +0000 (11:02 -0800)]
ZFS 0.6.0-rc13

11 years agoFix zpool on zvol lock inversion deadlock
Brian Behlendorf [Wed, 19 Dec 2012 21:51:44 +0000 (13:51 -0800)]
Fix zpool on zvol lock inversion deadlock

In all but one case the spa_namespace_lock is taken before the
bdev->bd_mutex lock.  But Linux __blkdev_get() function calls
fops->open() with the bdev->bd_mutex lock held and we must
somehow still safely acquire the spa_namespace_lock.

To avoid a potential lock inversion deadlock we preemptively
try to take the spa_namespace_lock().  Normally it will not
be contended and this is safe because spa_open_common() handles
the case where the caller already holds the spa_namespace_lock.

When it is contended we risk a lock inversion if we were to
block waiting for the lock.  Luckily, the __blkdev_get()
function allows us to return -ERESTARTSYS which will result in
bdev->bd_mutex being dropped, reacquired, and fops->open() being
called again.  This process can be repeated safely until both
locks are acquired.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #612

11 years agoRevert "Remove TSD zfs_fsyncer_key"
Brian Behlendorf [Thu, 20 Dec 2012 17:55:47 +0000 (09:55 -0800)]
Revert "Remove TSD zfs_fsyncer_key"

This reverts commit 31f2b5abdf95d8426d8bfd66ca7f62ec70215e3c back
to the original code until the fsync(2) performance regression
can be addressed.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRefresh AUTHORS
Brian Behlendorf [Wed, 19 Dec 2012 17:47:25 +0000 (09:47 -0800)]
Refresh AUTHORS

The AUTHORS file was getting stale.  Refresh its contents
using the authors listed in the git commit logs.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove the ChangeLog
Brian Behlendorf [Wed, 19 Dec 2012 17:22:07 +0000 (09:22 -0800)]
Remove the ChangeLog

The ChangeLog was retired long ago, the git commit logs are
authoritative.  To avoid any confusion remove the ChangeLog.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
11 years agoRemove TSD zfs_fsyncer_key
Brian Behlendorf [Thu, 13 Dec 2012 20:21:11 +0000 (12:21 -0800)]
Remove TSD zfs_fsyncer_key

It's my understanding that the zfs_fsyncer_key TSD was added as
a performance omtimization to reduce contention on the zl_lock
from zil_commit().  This issue manifested itself as very long
(100+ms) fsync() system call times for fsync() heavy workloads.

However, under Linux I'm not seeing the same contention that
was originally described.  Therefore, I'm removing this code
in order to ween ourselves off any dependence on TSD.  If the
original performance issue reappears on Linux we can revisit
fixing it without resorting to TSD.

This just leaves one small ZFS TSD consumer.  If it can be
cleanly removed from the code we'll be able to shed the SPL
TSD implementation entirely.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/spl#174

11 years agoSet elevator for DM devices despite vdev_wholedisk
Prakash Surya [Sat, 15 Dec 2012 00:16:35 +0000 (16:16 -0800)]
Set elevator for DM devices despite vdev_wholedisk

The current state of udev and devicer-mapper devices makes it difficult
to construct a mapping of DM partitions and their underlying DM device.
For example, with a /dev directory with the following contents:

    $ ls -d /dev/dm-*
    /dev/dm-0
    /dev/dm-1
    /dev/dm-2
    /dev/dm-3

it is not immediately apparent if these are completely separate devices,
or partitions and real devices intermixed. In contrast, SCSI devices
would appear as so:

    $ ls -d /dev/sd*
    /dev/sda
    /dev/sda1
    /dev/sdb
    /dev/sdb1

Here, one can immediately determine that there are two devices (sda and
sdb), each containing a single partition. The lack of a predictable and
consistent mapping from DM devices to DM device partitions makes it
difficult for user space to process these devices the same way it does
SCSI devices.

As a result, the ZFS utilities do not partition DM devices, and instead
set the "vdev_wholedisk" label to 0 and treat them as partitions. This
has the side effect that, even if ZFS has sole ownership of the device,
the IO scheduler will not be modified because it is treated as a
partition.

This change adds an exception for DM devices in vdev_elevator_switch,
allowing the elevator to be modified even though the "vdev_wholedisk"
property is not set.

Signed-off-by: Prakash Surya <surya1@llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1149

11 years agoFix using zvol as slog device
Jorgen Lundman [Mon, 17 Dec 2012 01:33:57 +0000 (10:33 +0900)]
Fix using zvol as slog device

During the original ZoL port the vdev_uses_zvols() function was
disabled until it could be properly implemented.  This prevented
a zpool from use a zvol for its slog device.

This patch implements that missing functionality by adding a
zvol_is_zvol() function to zvol.c.  Given the full path to a
device it will lookup the device and verify its major number
against the registered zvol major number for the system.  If
they match we know the device is a zvol.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1131

11 years agoFix get/set users/groups in quota props via numeric id
Massimo Maggi [Sun, 16 Dec 2012 13:33:51 +0000 (14:33 +0100)]
Fix get/set users/groups in quota props via numeric id

Fix setting/getting users/groups in quota properties through
numeric identifier.  This support was accidentally disabled
in the original port by applying the HAVE_IDMAP wrapper macro
too broadly.

Fix obtained by moving #ifdef HAVE_IDMAP to exclude only
the part of code that really needs IDMAP.  Now zfs (get|set)
(user|group)quota@1000 works as expected.

Signed-off-by: Massimo Maggi <massimo@mmmm.it>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1147