Fixed a NULL pointer dereference bug in zfs_preumount

When zpl_fill_super -> zfs_domount fails (e.g. because the dataset
was destroyed before it could be successfully mounted) the subsequent
call to zpl_kill_sb -> zfs_preumount would derefence a NULL pointer.

This bug can be reproduced using this shell script:

 #!/bin/sh
 (
 while true; do
 	zfs create -o mountpoint=legacz tank/bar
 	zfs destroy tank/bar
 done
 ) &

 (
 while true; do
 	mount -t zfs tank/bar /mnt
 	umount /mnt
 done
 ) &
SMBFS sharing for ZoL.
Sixth official patch attempt. Previous ones was/is lost
in my inability with GIT.
* Fix issues after review by behlendorf.
  = Move comments etc from the README to the code and to the manpage.
  = Adhere to the 80 char line limit.
  = Cast constants when setting argv[x].
  = More defines, concentrated at the top.
  = Move smb_retrieve_shares() to the top, to avoid forward declaration.
  = Make private functions static.
  = Remove all debugging.
  = Whitespace fixes.
  = Return SA_OK instead of 0 where needed.
  = Remove some fprintf(stderr, "ERROR: ...") strings. Not needed really,
    they where mostly for debugging any way.
  = Bump release.
  = Add missing locale.h include.
  = Add file_is_executable().
  = Remove file_is_executable() per request from Brian.

* Some minor SMBFS fixes, comments from Richard Laager:
  = Remove redundant variable = NULL check.
  = Rewrite static 'net' command options define's
  = Remove commented out/redundant line parsing code.
  = Add Samba host options to net command in smb_disable_share_one()
    as well.

* Fixes after second review by behlendorf.
  = Putting back things that wasn't mine that I removed or
    changed..
  = Remove the file_is_executable() declaration that came
    back some how.
  = Reword, rewrite and indent information about how to
    setup Samba.
  = Implement smb_validate_shareopts().

* Fixes after third review by Prakash-Surya.
  = Removed missplaced space.
Add iSCSI sharing to ZoL.
Sixth official patch attempt. Previous ones was/is lost
in my inability with GIT.
* Script to run through some tests to test share/unsharing...
* Debugging output added.
* Retabbing
* Fix faulty nfs|smb check (setting ZFS_TYPE_FILESYSTEM). Now possible to
  use 'share -a [nfs|smb|iscsi] as command line suggests. Not documented
  in man page though...
  + In unshare_unmount(), 'if(do_all)', 'continue' instead of 'break' after
    checking 'sharenfs=off' (so that we can continue checking for shareiscsi
    and sharesmb).
* Process iscsi shares early in update_zfs_shares_cb().
* Fix problem with assertion fail when running 'zfs unshare -a'.
* Call process_share() early of update_zfs_shares_cb() if iSCSI.
* Add shell script (test_zfs.sh) to test some functionality of SMB/iSCSI
  patch(es).
+ Remove file_is_executable() from iSCSI per request from Brian.

Fix some stuff that I know Brian will nag about :)
* 80 char line
* Move content of README to code + man page.
* Remove all debugging.
* Return SA_OK instead of 0 where needed.
* Cast to char* when setting argv with constant string(s).
* C9x compliance
* Make private functions static.

Some minor iSCSI fixes, comments from Richard Laager:
* Remove redundant variable = NULL check.
* Rename the custom iSCSI share script (remove .sh suffix).
  + Reword manual

Some more iSCSI fixes.
* Since iscsi_retrieve_targets() is now static, move it
  up to the top of iscsi.c and remove from iscsi.h.
* In update_zfs_shares_cb(), do the iSCSI parts later
  and skip the if type != FS check etc.
* Implement iscsi_validate_shareopts().
* Distinguish between FS and VOL when updating
  share information.
  + Support adding a VOL to list.
* Uncomment some stuff in process_share() that is/was supposed
  to possibly fix the 'shareicsi=on' auto sharing but didn't.
  Only made it to not compile...
* Update copyright note and year(s).

Fixes after second review by behlendorf and comments by Richard Yao.
* Check for getdomainname() - set HAVE_GETDOMAINNAME=1 if so - in
  ./configure.
  + Only try to get domain name with getdomainname() if
    we have it (HAVE_GETDOMAINNAME). If we don't, use the
    file /etc/domainname (configurable with DOMAINNAME_FILE).
* s/if\(/if \(/.
* Init iscsi_volumes_fp in iscsi_retrieve_targets() to NULL.
* Make sure tid_s is only 11 chars long.
* Remove one level of indentation from test binary.
* Don't malloc temp - memleak in test binary.
* Retabbing.
* s/share/tank/g in comments etc.

More fixes after review by Richard Yao, Richard Laager and Prakash Surya:
* Spelling errors fixed.
* ietadm is in man section '8', not '8M' (to much cut-and-past :).
* Remove (rewrite) some redundant strlen() usage.
* Replace a non-working sizeof with strlen.
Integrate ARC more tightly with Linux

Under Solaris the ARC was designed to stay one step ahead of the
VM subsystem.  It would attempt to recognize low memory situtions
before they occured and evict data from the cache.  It would also
make assessments about if there was enough free memory to perform
a specific operation.

This was all possible because Solaris exposes a fairly decent
view of the memory state of the system to other kernel threads.
Linux on the other hand does not make this information easily
available.  To avoid extensive modifications to the ARC the SPL
attempts to provide these same interfaces.  While this works it
is not ideal and problems can arise when the ARC and Linux have
different ideas about when your out of memory.  This has manifested
itself in the past as a spinning arc_reclaim_thread.

This patch abandons the emulated Solaris interfaces in favor of
the prefered Linux interface.  That means moving the bulk of the
memory reclaim logic out of the arc_reclaim_thread and in to the
evict driven shrinker callback.  The Linux VM will call this
function when it needs memory.  The ARC is then responsible for
attempting to free the requested amount of memory if possible.

Several interfaces have been modified to accomidate this approach,
however the basic user space implementation remains the same.
The following changes almost exclusively just apply to the kernel
implementation.

* Removed the hdr_recl() reclaim callback which is redundant
  with the broader arc_shrinker_func().

* Reduced arc_grow_retry to 5 seconds from 60.  This is now used
  internally in the ARC with arc_no_grow to indicate that direct
  reclaim was recently performed.  This typically indicates a
  rapid change in memory demands which the kswapd threads were
  unable to keep ahead of.  As long as direct reclaim is happening
  once every 5 seconds arc growth will be paused to avoid further
  contributing to the existing memory pressure.  The more common
  indirect reclaim paths will not set arc_no_grow.

* arc_shrink() has been extended to take the number of bytes by
  which arc_c should be reduced.  This allows for a more granual
  reduction of the arc target.  Since the kernel provides a
  reclaim value to the arc_shrinker_func() this value is used
  instead of 1<<arc_shrink_shift.

* arc_reclaim_needed() has been removed.  It was used to determine
  if the system was under memory pressure and relied extensively
  on Solaris specific VM interfaces.  In most case the new code
  just checks arc_no_grow which indicates that within the last
  arc_grow_retry seconds direct memory reclaim occurred.

* arc_memory_throttle() has been updated to always include the
  amount of evictable memory (arc and page cache) in its free
  space calculations.  This space is largely available in most
  call paths due to direct memory reclaim.

* The Solaris pageout code was also removed to avoid confusion.
  It has always been disabled due to proc_pageout being defined
  as NULL in the Linux port.

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