Implement database to workaround misreported physical sector sizes

This implements vdev_bdev_database_check(). It alters the detected
sector size of any device listed in a database of drives known to lie
about their physical sector sizes.

This is based on "6931570 Add flash devices' VID/PID to disk table to
advertising 4K physical sector size" from Open Solaris and on
sg_simple4.c from sg3_utils. About two dozen lines are taken from
sg_simple4.c, which is GPLv2 licensed. However, sg_simple4.c is
analogous to a Hello World program and is safe for us to use. We
requested that Douglas Gilbert, the author of sg_simple4.c, confirm that
this is the case. A cutdown version of his response is as follows:

```
I would consider a SCSI INQUIRY example using the Linux sg
driver interface (also written by me) as the equivalent of an
"hello world" program in C.
```

The database was created with the help of the freenode and ZFSOnLinux
communities.

Some notes:

1. The following drives both were confirmed to lie via reports in IRC
and they contain capacity information in their identifiers:

INTEL SSDSA2M080
INTEL SSDSA2M160
M4-CT256M4SSD2
WDC WD15EARS-00S
WDC WD15EARS-00Z
WDC WD20EARS-00M

The identifiers for different capacity models were extrapolated and
added under the assumption that those models also lie. Google was used
to verify that the extrapolated drive identifiers existed prior to their
inclusion.

2. The OCZ-VERTEX2 3.5 identifer applies to two drives that differ
solely in page size (and slightly in capacity). One uses 4096-byte pages
and the other uses 8192-byte pages. Both are set to use 8192-byte pages.
We could detect the page size by checking the capacity, but that would
unnecessarily complicate the code.

3. It is possible for updated drive firmware to correctly report the
sector size. There were reports of a few advanced format drives doing
that. One report stated that the vendor changed the identification
string while another was unclear on this. Both reports involved WDC
models.

4. Google was used to determine the size of pages in the listed flash
devices. Reports of 8192-byte pages took precedence over reports of
4096-byte pages.

5. Devices behind USB adapters can have their identification strings
altered. Identification strings obtained across USB adapters are
omitted and no attempt is made to correct for alterations made by USB
adapters when doing comparisons against the database. Two entries in the
Open Solaris database that appear to have been altered by a USB
adapter were omitted.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Illumos #2882, #2883, #2900

2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>
Approved by: Eric Schrock <Eric.Schrock@delphix.com>

References:
  illumos/illumos-gate@4445fffbbb1ea25fd0e9ea68b9380dd7a6709025

Ported-by: Tim Chase <tim@chase2k.com>
Closes #1293

Porting notes:

Add "nosleep" versions of the fnvlist_dup, fnvlist_merge, fnvlist_alloc
and fnvlist_pack functions with a suffix of "_nosleep".  They simply
perform their allocations with the KM_NOSLEEP flag.

Add zvol minor device creation to the new zfs_snapshot_nvl function.

Remove the logging of the "release" operation in
dsl_dataset_user_release_sync().  The logging caused a null dereference
because ds->ds_dir is zeroed in dsl_dataset_destroy_sync() and the
logging functions try to get the ds name via the dsl_dataset_name()
function. I've got no idea why this particular code would have worked
in Illumos.  This code has subsequently been completely reworked in
Illumos commit 3b2aab1 (3464 zfs synctask code needs restructuring).

Squash some "may be used uninitialized" warning/erorrs.

Fix some printf format warnings for %lld and %llu.

Apply a few spa_writeable() changes that were made to Illumos in
illumos/illumos-gate.git@cd1c8b8 as part of the 3112, 3113, 3114 and
3115 fixes.

Add a missing call to fnvlist_free(nvl) in log_internal() that was added
in Illumos to fix issue 3085 but couldn't be ported to ZoL at the time
(zfsonlinux/zfs@9e11c73) because it depended on future work.
Revert #3464 changes that crept into #2882 commit

Signed-off-by: Richard Yao <ryao@gentoo.org>
Illumos #3098

3098 zfs userspace/groupspace fail without saying why when run as non-root

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

Ported-by: Tim Chase <tim@chase2k.com>

Conflicts:
	lib/libzfs/libzfs_dataset.c
Illumos #3236

3236 zio nop-write

Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Christopher Siden <chris.siden@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>

References:
  illumos/illumos-gate@80901aea8e78a2c20751f61f01bebd1d5b5c2ba5
  https://www.illumos.org/issues/3236

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

Conflicts:
	module/zfs/dmu.c
	module/zfs/spa_misc.c
Constify first argument of dmu_objset_find()

This enables us to avoid typecasting (char *) in other areas of the
code. In particular, the zvol code.

Signed-off-by: Richard Yao <ryao@gentoo.org>
Import zvol_create_minors() from FreeBSD

The current zvol_create_minors() code depends on dmu_objset_find_spa(),
which is removed as of Illumos #3464. We can use FreeBSD's function as a
replacement with a few changes.

1. printf() becomes printk()

2. zvol_inhibit_dev support is checked in zvol_create_minors()

3. The helper function zvol_create_snapshots is altered to stop printing
a warning when it sees ENODEV from zvol_create_minor(). That means that
snapdev=hidden is set.

Ported-by: Richard Yao <ryao@gentoo.org>
Illumos 3464 zfs synctask code needs restructuring

Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Ported-by: Richard Yao <ryao@gentoo.org>
25068 arc_evict_ghost() should not hold arcs_mtx for a long time

glibc provides sched_yield() rather than yield(). kpreempt() in
zfs_context.h was adjusted to reflect this.

Ported-by: Richard Yao <ryao@gentoo.org>
21470 dsl_dataset_t ds_dir->dd_lock is highly contended
25529 assertion failed in dsl_dataset_check_quota()

Ported-by: Richard Yao <ryao@gentoo.org>