summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Beutner <[email protected]>2011-04-28 18:35:50 +0200
committerBrian Behlendorf <[email protected]>2011-04-29 12:36:13 -0700
commit055656d4f4dfc1a85646a2c0cc10b9dce86da72b (patch)
tree505300e61b58536f0f18b2e43d1ee360a47dbf81
parent5476e6952c1ecbd2debe977eb5c3ec88dfdfea5b (diff)
Implemented NFS export_operations.
Implemented the required NFS operations for exporting ZFS datasets using the in-kernel NFS daemon.
-rw-r--r--Makefile.in1
-rw-r--r--cmd/Makefile.in1
-rw-r--r--cmd/mount_zfs/Makefile.in1
-rw-r--r--cmd/zdb/Makefile.in1
-rw-r--r--cmd/zfs/Makefile.in1
-rw-r--r--cmd/zinject/Makefile.in1
-rw-r--r--cmd/zpios/Makefile.in1
-rw-r--r--cmd/zpool/Makefile.in1
-rw-r--r--cmd/zpool_id/Makefile.in1
-rw-r--r--cmd/zpool_layout/Makefile.in1
-rw-r--r--cmd/ztest/Makefile.in1
-rw-r--r--cmd/zvol_id/Makefile.in1
-rw-r--r--config/kernel-d-obtain-alias.m412
-rw-r--r--config/kernel.m41
-rwxr-xr-xconfigure80
-rw-r--r--dracut/90zfs/Makefile.in1
-rw-r--r--dracut/Makefile.in1
-rw-r--r--etc/Makefile.in1
-rw-r--r--etc/init.d/Makefile.in1
-rw-r--r--etc/udev/Makefile.in1
-rw-r--r--etc/udev/rules.d/Makefile.in1
-rw-r--r--etc/zfs/Makefile.in1
-rw-r--r--include/Makefile.in1
-rw-r--r--include/linux/Makefile.in1
-rw-r--r--include/sys/Makefile.in1
-rw-r--r--include/sys/fm/Makefile.in1
-rw-r--r--include/sys/fm/fs/Makefile.in1
-rw-r--r--include/sys/fs/Makefile.in1
-rw-r--r--include/sys/zpl.h3
-rw-r--r--lib/Makefile.in1
-rw-r--r--lib/libavl/Makefile.in1
-rw-r--r--lib/libefi/Makefile.in1
-rw-r--r--lib/libnvpair/Makefile.in1
-rw-r--r--lib/libspl/Makefile.in1
-rw-r--r--lib/libspl/asm-generic/Makefile.in1
-rw-r--r--lib/libspl/asm-i386/Makefile.in1
-rw-r--r--lib/libspl/asm-x86_64/Makefile.in1
-rw-r--r--lib/libspl/include/Makefile.in1
-rw-r--r--lib/libspl/include/ia32/Makefile.in1
-rw-r--r--lib/libspl/include/ia32/sys/Makefile.in1
-rw-r--r--lib/libspl/include/rpc/Makefile.in1
-rw-r--r--lib/libspl/include/sys/Makefile.in1
-rw-r--r--lib/libspl/include/sys/dktp/Makefile.in1
-rw-r--r--lib/libspl/include/sys/sysevent/Makefile.in1
-rw-r--r--lib/libspl/include/util/Makefile.in1
-rw-r--r--lib/libunicode/Makefile.in1
-rw-r--r--lib/libuutil/Makefile.in1
-rw-r--r--lib/libzfs/Makefile.in1
-rw-r--r--lib/libzpool/Makefile.in1
-rw-r--r--man/Makefile.in1
-rw-r--r--man/man8/Makefile.in1
-rw-r--r--module/zfs/Makefile.in1
-rw-r--r--module/zfs/zfs_vfsops.c4
-rw-r--r--module/zfs/zpl_export.c121
-rw-r--r--module/zfs/zpl_super.c8
-rw-r--r--scripts/Makefile.in1
-rw-r--r--scripts/zpios-profile/Makefile.in1
-rw-r--r--scripts/zpios-test/Makefile.in1
-rw-r--r--scripts/zpool-config/Makefile.in1
-rw-r--r--scripts/zpool-layout/Makefile.in1
-rw-r--r--zfs_config.h.in3
61 files changed, 273 insertions, 12 deletions
diff --git a/Makefile.in b/Makefile.in
index 0e6650e39..9571503bf 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -66,6 +66,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/Makefile.in b/cmd/Makefile.in
index 3568eb1bd..d75ea03f7 100644
--- a/cmd/Makefile.in
+++ b/cmd/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/mount_zfs/Makefile.in b/cmd/mount_zfs/Makefile.in
index 27afbebdd..cb44c195e 100644
--- a/cmd/mount_zfs/Makefile.in
+++ b/cmd/mount_zfs/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/zdb/Makefile.in b/cmd/zdb/Makefile.in
index bce8a786e..32938abbe 100644
--- a/cmd/zdb/Makefile.in
+++ b/cmd/zdb/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/zfs/Makefile.in b/cmd/zfs/Makefile.in
index 8df35a2c9..caeae5c19 100644
--- a/cmd/zfs/Makefile.in
+++ b/cmd/zfs/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/zinject/Makefile.in b/cmd/zinject/Makefile.in
index 47ee6d74a..a84f06829 100644
--- a/cmd/zinject/Makefile.in
+++ b/cmd/zinject/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/zpios/Makefile.in b/cmd/zpios/Makefile.in
index 9f42e2d6f..258f36d23 100644
--- a/cmd/zpios/Makefile.in
+++ b/cmd/zpios/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/zpool/Makefile.in b/cmd/zpool/Makefile.in
index f3e4bc73e..ea0e56ae2 100644
--- a/cmd/zpool/Makefile.in
+++ b/cmd/zpool/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/zpool_id/Makefile.in b/cmd/zpool_id/Makefile.in
index b292d9cd1..b6da33ce6 100644
--- a/cmd/zpool_id/Makefile.in
+++ b/cmd/zpool_id/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/zpool_layout/Makefile.in b/cmd/zpool_layout/Makefile.in
index 2a660ee6a..6939e4bd2 100644
--- a/cmd/zpool_layout/Makefile.in
+++ b/cmd/zpool_layout/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/ztest/Makefile.in b/cmd/ztest/Makefile.in
index 65e36a0c9..6a887e9e2 100644
--- a/cmd/ztest/Makefile.in
+++ b/cmd/ztest/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/cmd/zvol_id/Makefile.in b/cmd/zvol_id/Makefile.in
index 3e8a34be0..7ff4e45de 100644
--- a/cmd/zvol_id/Makefile.in
+++ b/cmd/zvol_id/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/config/kernel-d-obtain-alias.m4 b/config/kernel-d-obtain-alias.m4
new file mode 100644
index 000000000..d80a1c89c
--- /dev/null
+++ b/config/kernel-d-obtain-alias.m4
@@ -0,0 +1,12 @@
+dnl #
+dnl # 2.6.28 API change
+dnl # Added d_obtain_alias() helper function.
+dnl #
+AC_DEFUN([ZFS_AC_KERNEL_D_OBTAIN_ALIAS], [
+ ZFS_CHECK_SYMBOL_EXPORT(
+ [d_obtain_alias],
+ [fs/dcache.c],
+ [AC_DEFINE(HAVE_D_OBTAIN_ALIAS, 1,
+ [d_obtain_alias() is available])],
+ [])
+])
diff --git a/config/kernel.m4 b/config/kernel.m4
index f31d93c97..e2a983b54 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -35,6 +35,7 @@ AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL_FSYNC_2ARGS
ZFS_AC_KERNEL_EVICT_INODE
ZFS_AC_KERNEL_INSERT_INODE_LOCKED
+ ZFS_AC_KERNEL_D_OBTAIN_ALIAS
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
diff --git a/configure b/configure
index 30f3b325c..5e501eefb 100755
--- a/configure
+++ b/configure
@@ -14358,6 +14358,46 @@ _ACEOF
+ { $as_echo "$as_me:$LINENO: checking whether symbol d_obtain_alias is exported" >&5
+$as_echo_n "checking whether symbol d_obtain_alias is exported... " >&6; }
+ grep -q -E '[[:space:]]d_obtain_alias[[:space:]]' \
+ $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null
+ rc=$?
+ if test $rc -ne 0; then
+ export=0
+ for file in fs/dcache.c; do
+ grep -q -E "EXPORT_SYMBOL.*(d_obtain_alias)" "$LINUX/$file" 2>/dev/null
+ rc=$?
+ if test $rc -eq 0; then
+ export=1
+ break;
+ fi
+ done
+ if test $export -eq 0; then
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_D_OBTAIN_ALIAS 1
+_ACEOF
+
+ fi
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_D_OBTAIN_ALIAS 1
+_ACEOF
+
+ fi
+
+
+
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
fi
@@ -18404,6 +18444,46 @@ _ACEOF
+ { $as_echo "$as_me:$LINENO: checking whether symbol d_obtain_alias is exported" >&5
+$as_echo_n "checking whether symbol d_obtain_alias is exported... " >&6; }
+ grep -q -E '[[:space:]]d_obtain_alias[[:space:]]' \
+ $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null
+ rc=$?
+ if test $rc -ne 0; then
+ export=0
+ for file in fs/dcache.c; do
+ grep -q -E "EXPORT_SYMBOL.*(d_obtain_alias)" "$LINUX/$file" 2>/dev/null
+ rc=$?
+ if test $rc -eq 0; then
+ export=1
+ break;
+ fi
+ done
+ if test $export -eq 0; then
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_D_OBTAIN_ALIAS 1
+_ACEOF
+
+ fi
+ else
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_D_OBTAIN_ALIAS 1
+_ACEOF
+
+ fi
+
+
+
if test "$LINUX_OBJ" != "$LINUX"; then
KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$LINUX_OBJ"
fi
diff --git a/dracut/90zfs/Makefile.in b/dracut/90zfs/Makefile.in
index 5478a0123..14918a7e6 100644
--- a/dracut/90zfs/Makefile.in
+++ b/dracut/90zfs/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/dracut/Makefile.in b/dracut/Makefile.in
index 3da366289..8afe241a5 100644
--- a/dracut/Makefile.in
+++ b/dracut/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/etc/Makefile.in b/etc/Makefile.in
index 9f32d7d9f..d8a9b2617 100644
--- a/etc/Makefile.in
+++ b/etc/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/etc/init.d/Makefile.in b/etc/init.d/Makefile.in
index 3f673bbb9..7ad43d4ac 100644
--- a/etc/init.d/Makefile.in
+++ b/etc/init.d/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/etc/udev/Makefile.in b/etc/udev/Makefile.in
index 2d92889f9..2cee45912 100644
--- a/etc/udev/Makefile.in
+++ b/etc/udev/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/etc/udev/rules.d/Makefile.in b/etc/udev/rules.d/Makefile.in
index 9937d06a3..44127cc61 100644
--- a/etc/udev/rules.d/Makefile.in
+++ b/etc/udev/rules.d/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/etc/zfs/Makefile.in b/etc/zfs/Makefile.in
index 3f4d3ec52..8817621f2 100644
--- a/etc/zfs/Makefile.in
+++ b/etc/zfs/Makefile.in
@@ -52,6 +52,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/include/Makefile.in b/include/Makefile.in
index cfaf47930..d2129ee35 100644
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/include/linux/Makefile.in b/include/linux/Makefile.in
index 531ce3612..a2e9998dc 100644
--- a/include/linux/Makefile.in
+++ b/include/linux/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/include/sys/Makefile.in b/include/sys/Makefile.in
index fe0c98ad5..014d3506e 100644
--- a/include/sys/Makefile.in
+++ b/include/sys/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/include/sys/fm/Makefile.in b/include/sys/fm/Makefile.in
index 29b215dc1..38d2fee91 100644
--- a/include/sys/fm/Makefile.in
+++ b/include/sys/fm/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/include/sys/fm/fs/Makefile.in b/include/sys/fm/fs/Makefile.in
index ca7bc3081..71ff76fb1 100644
--- a/include/sys/fm/fs/Makefile.in
+++ b/include/sys/fm/fs/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/include/sys/fs/Makefile.in b/include/sys/fs/Makefile.in
index bebbce985..f8172d4f8 100644
--- a/include/sys/fs/Makefile.in
+++ b/include/sys/fs/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/include/sys/zpl.h b/include/sys/zpl.h
index b6da0d271..721347585 100644
--- a/include/sys/zpl.h
+++ b/include/sys/zpl.h
@@ -28,6 +28,7 @@
#include <sys/vfs.h>
#include <linux/vfs_compat.h>
#include <linux/xattr_compat.h>
+#include <linux/exportfs.h>
/* zpl_inode.c */
extern const struct inode_operations zpl_inode_operations;
@@ -53,7 +54,7 @@ typedef struct zpl_mount_data {
} zpl_mount_data_t;
extern const struct super_operations zpl_super_operations;
-/* extern const struct export_operations zpl_export_operations; */
+extern const struct export_operations zpl_export_operations;
extern struct file_system_type zpl_fs_type;
/* zpl_xattr.c */
diff --git a/lib/Makefile.in b/lib/Makefile.in
index da30f53ef..70380c30e 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libavl/Makefile.in b/lib/libavl/Makefile.in
index 863d72e30..9228d159d 100644
--- a/lib/libavl/Makefile.in
+++ b/lib/libavl/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libefi/Makefile.in b/lib/libefi/Makefile.in
index 77f99b6b5..ff7a04820 100644
--- a/lib/libefi/Makefile.in
+++ b/lib/libefi/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libnvpair/Makefile.in b/lib/libnvpair/Makefile.in
index 31a6ccba7..21e228f8a 100644
--- a/lib/libnvpair/Makefile.in
+++ b/lib/libnvpair/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/Makefile.in b/lib/libspl/Makefile.in
index e9f98817a..040616282 100644
--- a/lib/libspl/Makefile.in
+++ b/lib/libspl/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/asm-generic/Makefile.in b/lib/libspl/asm-generic/Makefile.in
index 22f975042..17d0368ba 100644
--- a/lib/libspl/asm-generic/Makefile.in
+++ b/lib/libspl/asm-generic/Makefile.in
@@ -52,6 +52,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/asm-i386/Makefile.in b/lib/libspl/asm-i386/Makefile.in
index 7ba92fc78..30e7ffb41 100644
--- a/lib/libspl/asm-i386/Makefile.in
+++ b/lib/libspl/asm-i386/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/asm-x86_64/Makefile.in b/lib/libspl/asm-x86_64/Makefile.in
index 1b20391fe..f09efc8ca 100644
--- a/lib/libspl/asm-x86_64/Makefile.in
+++ b/lib/libspl/asm-x86_64/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/include/Makefile.in b/lib/libspl/include/Makefile.in
index b1cc2b0a9..c6e83b11f 100644
--- a/lib/libspl/include/Makefile.in
+++ b/lib/libspl/include/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/include/ia32/Makefile.in b/lib/libspl/include/ia32/Makefile.in
index 65c0d8b63..1e913789b 100644
--- a/lib/libspl/include/ia32/Makefile.in
+++ b/lib/libspl/include/ia32/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/include/ia32/sys/Makefile.in b/lib/libspl/include/ia32/sys/Makefile.in
index a71029823..50518f6cc 100644
--- a/lib/libspl/include/ia32/sys/Makefile.in
+++ b/lib/libspl/include/ia32/sys/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/include/rpc/Makefile.in b/lib/libspl/include/rpc/Makefile.in
index 868e4dd70..47894d8b5 100644
--- a/lib/libspl/include/rpc/Makefile.in
+++ b/lib/libspl/include/rpc/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/include/sys/Makefile.in b/lib/libspl/include/sys/Makefile.in
index 8f3ab8b8b..45789862e 100644
--- a/lib/libspl/include/sys/Makefile.in
+++ b/lib/libspl/include/sys/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/include/sys/dktp/Makefile.in b/lib/libspl/include/sys/dktp/Makefile.in
index 9146dc61e..b17910370 100644
--- a/lib/libspl/include/sys/dktp/Makefile.in
+++ b/lib/libspl/include/sys/dktp/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/include/sys/sysevent/Makefile.in b/lib/libspl/include/sys/sysevent/Makefile.in
index ad58060b0..48c345391 100644
--- a/lib/libspl/include/sys/sysevent/Makefile.in
+++ b/lib/libspl/include/sys/sysevent/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libspl/include/util/Makefile.in b/lib/libspl/include/util/Makefile.in
index e2451a921..bf5b94e0e 100644
--- a/lib/libspl/include/util/Makefile.in
+++ b/lib/libspl/include/util/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libunicode/Makefile.in b/lib/libunicode/Makefile.in
index 6098ce959..71f06ae0e 100644
--- a/lib/libunicode/Makefile.in
+++ b/lib/libunicode/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libuutil/Makefile.in b/lib/libuutil/Makefile.in
index c20081946..5a6760071 100644
--- a/lib/libuutil/Makefile.in
+++ b/lib/libuutil/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libzfs/Makefile.in b/lib/libzfs/Makefile.in
index bcd310151..80cb7397f 100644
--- a/lib/libzfs/Makefile.in
+++ b/lib/libzfs/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/lib/libzpool/Makefile.in b/lib/libzpool/Makefile.in
index 56b449365..8ad5d3d36 100644
--- a/lib/libzpool/Makefile.in
+++ b/lib/libzpool/Makefile.in
@@ -53,6 +53,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/man/Makefile.in b/man/Makefile.in
index b2ddc4eb2..d4be37e4c 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/man/man8/Makefile.in b/man/man8/Makefile.in
index d502f672f..61700d951 100644
--- a/man/man8/Makefile.in
+++ b/man/man8/Makefile.in
@@ -51,6 +51,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/module/zfs/Makefile.in b/module/zfs/Makefile.in
index 5a99852a1..b303168c8 100644
--- a/module/zfs/Makefile.in
+++ b/module/zfs/Makefile.in
@@ -83,6 +83,7 @@ $(MODULE)-objs += @top_srcdir@/module/zfs/zio_checksum.o
$(MODULE)-objs += @top_srcdir@/module/zfs/zio_compress.o
$(MODULE)-objs += @top_srcdir@/module/zfs/zio_inject.o
$(MODULE)-objs += @top_srcdir@/module/zfs/zle.o
+$(MODULE)-objs += @top_srcdir@/module/zfs/zpl_export.o
$(MODULE)-objs += @top_srcdir@/module/zfs/zpl_file.o
$(MODULE)-objs += @top_srcdir@/module/zfs/zpl_inode.o
$(MODULE)-objs += @top_srcdir@/module/zfs/zpl_super.o
diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c
index 8a82d9d4b..e71aa91e1 100644
--- a/module/zfs/zfs_vfsops.c
+++ b/module/zfs/zfs_vfsops.c
@@ -1206,9 +1206,7 @@ zfs_domount(struct super_block *sb, void *data, int silent)
/* Set callback operations for the file system. */
sb->s_op = &zpl_super_operations;
sb->s_xattr = zpl_xattr_handlers;
-#ifdef HAVE_EXPORTS
- sb->s_export_op = &zpl_export_operations;
-#endif /* HAVE_EXPORTS */
+ sb->s_export_op = &zpl_export_operations;
/* Set features for file system. */
zfs_set_fuid_feature(zsb);
diff --git a/module/zfs/zpl_export.c b/module/zfs/zpl_export.c
new file mode 100644
index 000000000..a38955600
--- /dev/null
+++ b/module/zfs/zpl_export.c
@@ -0,0 +1,121 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright (c) 2011 Gunnar Beutner
+ */
+
+
+#include <sys/zfs_vnops.h>
+#include <sys/zfs_znode.h>
+#include <sys/zpl.h>
+
+
+static int
+zpl_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable)
+{
+ fid_t *fid = (fid_t *)fh;
+ struct inode *ip = dentry->d_inode;
+ int len_bytes, rc;
+
+ len_bytes = *max_len * sizeof (__u32);
+
+ if (len_bytes < offsetof(fid_t, fid_data))
+ return 255;
+
+ fid->fid_len = len_bytes - offsetof(fid_t, fid_data);
+
+ rc = zfs_fid(ip, fid);
+
+ len_bytes = offsetof(fid_t, fid_data) + fid->fid_len;
+ *max_len = roundup(len_bytes, sizeof (__u32)) / sizeof (__u32);
+
+ return (rc == 0 ? FILEID_INO32_GEN : 255);
+}
+
+static struct dentry *
+zpl_dentry_obtain_alias(struct inode *ip)
+{
+ struct dentry *result;
+
+#ifdef HAVE_D_OBTAIN_ALIAS
+ result = d_obtain_alias(ip);
+#else
+ result = d_alloc_anon(ip);
+
+ if (result == NULL) {
+ iput(ip);
+ result = ERR_PTR(-ENOMEM);
+ }
+#endif /* HAVE_D_OBTAIN_ALIAS */
+
+ return result;
+}
+
+static struct dentry *
+zpl_fh_to_dentry(struct super_block *sb, struct fid *fh,
+ int fh_len, int fh_type)
+{
+ zfs_sb_t *zsb = sb->s_fs_info;
+ struct vfsmount *vfs = zsb->z_vfs;
+ fid_t *fid = (fid_t *)fh;
+ struct inode *ip;
+ int len_bytes, rc;
+
+ len_bytes = fh_len * sizeof (__u32);
+
+ if (fh_type != FILEID_INO32_GEN ||
+ len_bytes < offsetof(fid_t, fid_data) ||
+ len_bytes < offsetof(fid_t, fid_data) + fid->fid_len)
+ return ERR_PTR(-EINVAL);
+
+ rc = zfs_vget(vfs, &ip, fid);
+
+ if (rc != 0)
+ return ERR_PTR(-rc);
+
+ ASSERT((ip != NULL) && !IS_ERR(ip));
+
+ return zpl_dentry_obtain_alias(ip);
+}
+
+static struct dentry *
+zpl_get_parent(struct dentry *child)
+{
+ cred_t *cr = CRED();
+ struct inode *ip;
+ int error;
+
+ crhold(cr);
+ error = -zfs_lookup(child->d_inode, "..", &ip, 0, cr, NULL, NULL);
+ crfree(cr);
+ ASSERT3S(error, <=, 0);
+
+ if (error)
+ return ERR_PTR(error);
+
+ return zpl_dentry_obtain_alias(ip);
+}
+
+const struct export_operations zpl_export_operations = {
+ .encode_fh = zpl_encode_fh,
+ .fh_to_dentry = zpl_fh_to_dentry,
+ .get_parent = zpl_get_parent
+};
diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c
index 6e8265dac..493783213 100644
--- a/module/zfs/zpl_super.c
+++ b/module/zfs/zpl_super.c
@@ -210,14 +210,6 @@ const struct super_operations zpl_super_operations = {
.show_stats = NULL,
};
-#if 0
-const struct export_operations zpl_export_operations = {
- .fh_to_dentry = NULL,
- .fh_to_parent = NULL,
- .get_parent = NULL,
-};
-#endif
-
struct file_system_type zpl_fs_type = {
.owner = THIS_MODULE,
.name = ZFS_DRIVER,
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 2aaa67523..0cc5c8261 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -52,6 +52,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/scripts/zpios-profile/Makefile.in b/scripts/zpios-profile/Makefile.in
index 290362c1a..1d6a26b77 100644
--- a/scripts/zpios-profile/Makefile.in
+++ b/scripts/zpios-profile/Makefile.in
@@ -52,6 +52,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/scripts/zpios-test/Makefile.in b/scripts/zpios-test/Makefile.in
index 89b3f4586..56431d480 100644
--- a/scripts/zpios-test/Makefile.in
+++ b/scripts/zpios-test/Makefile.in
@@ -52,6 +52,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/scripts/zpool-config/Makefile.in b/scripts/zpool-config/Makefile.in
index 6011cb979..5f267d65e 100644
--- a/scripts/zpool-config/Makefile.in
+++ b/scripts/zpool-config/Makefile.in
@@ -52,6 +52,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/scripts/zpool-layout/Makefile.in b/scripts/zpool-layout/Makefile.in
index 83f32a360..5e7bf60aa 100644
--- a/scripts/zpool-layout/Makefile.in
+++ b/scripts/zpool-layout/Makefile.in
@@ -52,6 +52,7 @@ am__aclocal_m4_deps = \
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
+ $(top_srcdir)/config/kernel-d-obtain-alias.m4 \
$(top_srcdir)/config/kernel-evict-inode.m4 \
$(top_srcdir)/config/kernel-fmode-t.m4 \
$(top_srcdir)/config/kernel-fsync.m4 \
diff --git a/zfs_config.h.in b/zfs_config.h.in
index 938da5694..3d47e3d75 100644
--- a/zfs_config.h.in
+++ b/zfs_config.h.in
@@ -72,6 +72,9 @@
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
+/* d_obtain_alias() is available */
+#undef HAVE_D_OBTAIN_ALIAS
+
/* sops->evict_inode() exists */
#undef HAVE_EVICT_INODE