File aufs-nfs4-is-special of Package aufs
From: Jeff Mahoney <jeffm@suse.com>
Subject: aufs: Handle NFSv4 enablement separately from NFSv2/3
NFSv4's atomic opens require that a nameidata be passed down
into __lookup_hash, which isn't exported. However, NFSv2/3
can be supported with just lookup_one_len.
This patch handles NFSv4 enablement separately and will
enable NFSv2/3 support if __lookup_hash isn't exported, and
addtionally enable NFSv4 if it is.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
fs/aufs25/branch.c | 2 +-
fs/aufs25/branch.h | 15 +++++++++++----
fs/aufs25/vfsub.c | 10 ++++++----
fs/aufs25/vfsub.h | 2 --
local.mk | 6 +++++-
patch/release_open_intent.patch | 14 ++++++++++++++
6 files changed, 37 insertions(+), 12 deletions(-)
--- a/fs/aufs25/branch.c
+++ b/fs/aufs25/branch.c
@@ -393,7 +393,7 @@ static int test_add(struct super_block *
goto out;
}
- if (unlikely(au_test_unsupported_nfs(inode->i_sb))) {
+ if (unlikely(au_test_unsupported_nfs(inode))) {
AuErr(AuNoNfsBranchMsg " %s\n", add->path);
goto out;
}
--- a/fs/aufs25/branch.h
+++ b/fs/aufs25/branch.h
@@ -28,6 +28,7 @@
#ifdef __KERNEL__
#include <linux/fs.h>
+#include <linux/nfs_fs.h>
#include <linux/mount.h>
#include <linux/sysfs.h>
#include <linux/aufs_type.h>
@@ -350,9 +351,14 @@ static inline void au_br_nfs_lockdep_on(
}
#ifdef CONFIG_AUFS_BR_NFS
-static inline int au_test_unsupported_nfs(struct super_block *h_sb)
+static inline int au_test_unsupported_nfs(struct inode *h_inode)
{
+#ifdef CONFIG_AUFS_BR_NFS4
return 0;
+#else
+ return h_inode->i_sb->s_magic == NFS_SUPER_MAGIC &&
+ NFS_PROTO(h_inode)->version == 4;
+#endif
}
/* it doesn't mntget() */
@@ -362,12 +368,13 @@ struct vfsmount *au_nfsmnt(struct super_
return au_do_nfsmnt(au_sbr_mnt(sb, bindex));
}
-#define AuNoNfsBranchMsg "dummy"
+#define AuNoNfsBranchMsg "NFSv4 branch is not supported" \
+ ", try some configurations and patches included in aufs source CVS."
#else
-static inline int au_test_unsupported_nfs(struct super_block *h_sb)
+static inline int au_test_unsupported_nfs(struct inode *h_inode)
{
- return h_sb->s_magic == NFS_SUPER_MAGIC;
+ return h_inode->i_sb->s_magic == NFS_SUPER_MAGIC;
}
static inline
--- a/fs/aufs25/vfsub.c
+++ b/fs/aufs25/vfsub.c
@@ -84,7 +84,6 @@ struct dentry *vfsub_lookup_one_len(cons
return d;
}
-#ifdef CONFIG_AUFS_LHASH_PATCH
struct dentry *vfsub__lookup_hash(struct qstr *name, struct dentry *parent,
struct nameidata *nd)
{
@@ -92,16 +91,19 @@ struct dentry *vfsub__lookup_hash(struct
LKTRTrace("%.*s/%.*s, nd %d\n",
AuDLNPair(parent), AuLNPair(name), !!nd);
- if (nd)
- LKTRTrace("nd{0x%x}\n", nd->flags);
+#ifdef CONFIG_AUFS_LHASH_PATCH
+ BUG_ON(!nd);
+ LKTRTrace("nd{0x%x}\n", nd->flags);
IMustLock(parent->d_inode);
d = __lookup_hash(name, parent, nd);
if (!IS_ERR(d))
au_update_fuse_h_inode(NULL, d); /*ignore*/
+#else
+ d = vfsub_lookup_one_len(name->name, parent, name->len);
+#endif
return d;
}
-#endif
/* ---------------------------------------------------------------------- */
--- a/fs/aufs25/vfsub.h
+++ b/fs/aufs25/vfsub.h
@@ -250,10 +250,8 @@ int vfsub_path_lookup(const char *name,
struct dentry *vfsub_lookup_one_len(const char *name, struct dentry *parent,
int len);
-#ifdef CONFIG_AUFS_LHASH_PATCH
struct dentry *vfsub__lookup_hash(struct qstr *name, struct dentry *parent,
struct nameidata *nd);
-#endif
/* ---------------------------------------------------------------------- */
--- a/local.mk
+++ b/local.mk
@@ -61,8 +61,12 @@ AUFS_DEF_CONFIG =
# automatic configurations
export CONFIG_AUFS_BR_NFS =
+export CONFIG_AUFS_BR_NFS4 =
ifdef CONFIG_NFS_FS
CONFIG_AUFS_BR_NFS = y
+ifdef CONFIG_NFS_V4
+CONFIG_AUFS_BR_NFS4 = y
+endif
ifeq "t" "$(shell test ${SUBLEVEL} -lt 16 && echo t)"
CONFIG_AUFS_BR_NFS =
else ifeq "t" "$(shell test ${SUBLEVEL} -ge 19 \
@@ -71,7 +75,7 @@ else ifeq "t" "$(shell test ${SUBLEVEL}
-o x${CONFIG_AUFS_PUT_FILP_PATCH} = xy \) \
\) \
&& echo t)"
-CONFIG_AUFS_BR_NFS =
+CONFIG_AUFS_BR_NFS4 =
endif
endif
--- /dev/null
+++ b/patch/release_open_intent.patch
@@ -0,0 +1,14 @@
+---
+ fs/namei.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -410,6 +410,7 @@ void release_open_intent(struct nameidat
+ else
+ fput(nd->intent.open.file);
+ }
++EXPORT_SYMBOL_GPL(release_open_intent);
+
+ static inline struct dentry *
+ do_revalidate(struct dentry *dentry, struct nameidata *nd)