Fix readdir for .zfs/snapshot directory

dmu_snapshot_list_next stores the index of the next snapshot entry to the offp
argument, which zpl_snapdir_iterate then uses for the dir_emit. This
result in an off-by-one error. Therefore a temporary variable should be
used.

This was a regression introduced in commit zfsonlinux/zfs@0f37d0c.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
zfsctl: No need to sync ctldir inodes

There's no metadata to write to disk for ctldir inodes. So we check if
a inode belongs to the ctldir in zpl_commit_metadata, and returns
immediately if it is.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
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.

XXX: need to delete the saved dentry on snapshot unmount.

Signed-off-by: Andrey Vesnovaty <andrey.vesnovaty@gmail.com>
Don't encode short fh for snapshot inodes

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
path_lookup no longer exists. TODO: add configure check
get_mnt_path