save snapshot root dentry on snapshot mount

When it's need to decode snapshot file handly it hard to get snapshot sb.
On the contrary on snapshot mount it's easy to get snapshot sb because
mount path available in the context of snapshot mount.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
fix invalid fileid for snapshot root dentry

Prevents NFS client from detection of different fileids of snapshot root dentry
before & after snapshot mount.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
encode snapshot file handle as objsetid+inode

Encoded file handle should provide enough info in order to detect right objsetid
and right object in the objset defined by objsetid.

If objsetid not provided (<fh langth> == SHORT_FID_LEN) it's assumed that
objset of the exported fs should be used.

The objsetid should be encoded for every snapshot dentry including root dentry;
	for snapshot root dentry zf_gen should be 0

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
fix snapshot fh (long fh) decoding

In order to decode long file handly containing snapshot objsetid:
	1 If snapshot defined by objsetid not mounted than it should be mounted;
		to trigger snapshot automount path_lookup(<full snapshot path>) issued
		(see 'save vfsmount to extract path to trigger automount' for
		details about getting <full snapshot path>).
	2 Once snapshot mounted sb of the snapshot should be provided;
		(see 'save snapshot root dentry on snapshot mount'
		for details about getting sb of mounted snapshot).
	3 If zf_gen of fh is 0 & sb got by objsetid is snapshot sb (actually
		long file handly used for snapshots only), then consider fh
		as snapshot root dentryi fh.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
save vfsmount for path extraction to trigger automount

When decoding snapshot file handly it may happen that the snapshot pointed
by the handly currently not mounted, consequently snapshot automount should
be triggered.

In order to trigger automount path_lookup(<full path to snapshot>) need to be
issued. The <full path to snapshot> should be something like:
<zfs mount point>/<ctl dir name>/snapshot/<snapshot name>

Unfortunately, <zfs mount point> part of the path isn't available in the
context of file handly decoding.
A simple way to have a <zfs mount point> in the context of file handly
decoding is to save pointer to struct vfsmount in the context of super block
creation.

Limitations:
	1 Unfortunately it's kinda hack; in general struct vfsmount shouldn't be
		accessed in the context of the filesystem itself.
	2 Once HAVE_MOUNT_NODEV enabled current implementation wont work at all;
		It's looks like possible to port it to kernel version where
		HAVE_MOUNT_NODEV enabled but it will remain rather HACK than
		solution.
	3 Theoretically the proper solution of the problem is to eliminate usage
		of automount and/or mount at all; just generate all snapshot
		related in core structures (inodes/dentries etc.) on access.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>

Conflicts:
	include/sys/zfs_vfsops.h
	module/zfs/zfs_vfsops.c

Conflicts:

	include/sys/zfs_vfsops.h
	module/zfs/zfs_ctldir.c
	module/zfs/zfs_vfsops.c

Conflicts:
	module/zfs/zfs_vfsops.c
encode short fh for special ctl (.zfs) dirs

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
set MNT_SHRINKABLE on snapshot mount instead of occasional post mount getattr

Conflicts:

	module/zfs/zfs_ctldir.c
zfsctl: don't sync (to disk) incore only nodes

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
fix readdir for .zfs/snapshot directory

dmu_snapshot_list_next offp argument (ctx->pos) and dir_emit ctx->pos argument
should have same value for reading same snapshot directory.
dmu_snapshot_list_next modifies offp argument to point to next entry in the
list. In order to provide dir_emmit with ctx->pos having same value as before
call to dmu_snapshot_list_next temporary variable should be used and the value
of ctx->pos should be updated right before the next call to
dmu_snapshot_list_next.

This fixes a regression that was introduced in commit
0f37d0c8bed442dd0d2c1b1dddd68653fa6eec66 Linux 3.11 compat: fops->iterate().

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>