From e4d660244e9265015c3e3480b48a28b15f0813b7 Mon Sep 17 00:00:00 2001 From: Bob Glossman Date: Thu, 6 Mar 2014 10:31:05 -0800 Subject: [PATCH] LU-4726 ptlrpc: vfs_rename api changed In newer kernels the vfs_rename api changed to take more arguments. This patch creates a wrapper to let us adapt to the different versions of vfs_rename in old and new kernels. Signed-off-by: Bob Glossman Change-Id: Ia5dafe64570fc404cd8a037fd442ca12e687ffc1 Reviewed-on: http://review.whamcloud.com/9537 Tested-by: Jenkins Reviewed-by: James Simmons Reviewed-by: Dmitry Eremin Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 19 +++++++++++++++++++ lustre/include/linux/lustre_compat25.h | 6 ++++++ lustre/ptlrpc/sec_ctx.c | 2 +- 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 804b6e0..a42b479 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1454,6 +1454,22 @@ LB_LINUX_TRY_COMPILE([ ]) ]) +# 3.13 has vfs_renane with 5 args +AC_DEFUN([LC_VFS_RENAME_5ARGS], +[AC_MSG_CHECKING([if kernel has vfs_rename with 5 args]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + vfs_rename(NULL, NULL, NULL, NULL, NULL); +], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(HAVE_VFS_RENAME_5ARGS, 1, + [kernel has vfs_rename with 5 args]) +],[ + AC_MSG_RESULT([no]) +]) +]) + # # LC_PROG_LINUX # @@ -1566,6 +1582,9 @@ AC_DEFUN([LC_PROG_LINUX], LC_OLDSIZE_TRUNCATE_PAGECACHE LC_KIOCB_KI_LEFT + # 3.13 + LC_VFS_RENAME_5ARGS + # if test x$enable_server != xno ; then LC_FUNC_DEV_SET_RDONLY diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 24412f2..a485b07 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -336,4 +336,10 @@ static inline struct dentry *d_make_root(struct inode *root) #define ll_truncate_pagecache(inode, size) truncate_pagecache(inode, size) #endif +#ifdef HAVE_VFS_RENAME_5ARGS +#define ll_vfs_rename(a, b, c, d) vfs_rename(a, b, c, d, NULL) +#else +#define ll_vfs_rename(a, b, c, d) vfs_rename(a, b, c, d) +#endif + #endif /* _COMPAT25_H */ diff --git a/lustre/ptlrpc/sec_ctx.c b/lustre/ptlrpc/sec_ctx.c index 29ffc95..34d1afc 100644 --- a/lustre/ptlrpc/sec_ctx.c +++ b/lustre/ptlrpc/sec_ctx.c @@ -116,7 +116,7 @@ int lustre_rename(struct dentry *dir, struct vfsmount *mnt, if (IS_ERR(dchild_new)) GOTO(put_old, err = PTR_ERR(dchild_new)); - err = vfs_rename(dir->d_inode, dchild_old, dir->d_inode, dchild_new); + err = ll_vfs_rename(dir->d_inode, dchild_old, dir->d_inode, dchild_new); dput(dchild_new); put_old: -- 1.8.3.1