From ad3412efd7cc2debb0f9f354d3f5e105a99d97e1 Mon Sep 17 00:00:00 2001 From: Chunwei Chen Date: Wed, 7 May 2014 10:54:37 -0700 Subject: [PATCH] Linux 3.15: vfs_rename() added a flags argument Detect the updated vfs_rename() interface and call it with an extra flags argument. References: torvalds/linux@520c8b1 Signed-off-by: Chunwei Chen Signed-off-by: Brian Behlendorf Issue #355 --- config/spl-build.m4 | 23 ++++++++++++++++++++++- module/spl/spl-vnode.c | 18 ++++++++++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 84267807db..08b84efe94 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -1907,7 +1907,28 @@ AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME], AC_DEFINE(HAVE_5ARGS_VFS_RENAME, 1, [vfs_rename() wants 5 args]) ],[ - AC_MSG_ERROR(no) + AC_MSG_RESULT(no) + dnl # + dnl # Linux 3.15 API change + dnl # Added flags + dnl # + AC_MSG_CHECKING([whether vfs_rename() wants 6 args]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + vfs_rename((struct inode *) NULL, + (struct dentry *) NULL, + (struct inode *) NULL, + (struct dentry *) NULL, + (struct inode **) NULL, + (unsigned int) 0); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_6ARGS_VFS_RENAME, 1, + [vfs_rename() wants 6 args]) + ],[ + AC_MSG_ERROR(no) + ]) ]) ]) ]) diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index 549606770f..fa3e49054f 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -414,13 +414,16 @@ vn_rename(const char *oldname, const char *newname, int x1) SGOTO(exit4, rc); } -#ifdef HAVE_4ARGS_VFS_RENAME +#if defined(HAVE_4ARGS_VFS_RENAME) rc = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry); -#else +#elif defined(HAVE_5ARGS_VFS_RENAME) rc = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry, NULL); -#endif /* HAVE_4ARGS_VFS_RENAME */ +#else + rc = vfs_rename(old_dir->d_inode, old_dentry, + new_dir->d_inode, new_dentry, NULL, 0); +#endif exit4: unlock_rename(new_dir, old_dir); exit3: @@ -574,13 +577,16 @@ vn_rename(const char *oldname, const char *newname, int x1) if (new_dentry == trap) SGOTO(exit5, rc); -#ifdef HAVE_4ARGS_VFS_RENAME +#if defined(HAVE_4ARGS_VFS_RENAME) rc = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry); -#else +#elif defined(HAVE_5ARGS_VFS_RENAME) rc = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry, NULL); -#endif /* HAVE_4ARGS_VFS_RENAME */ +#else + rc = vfs_rename(old_dir->d_inode, old_dentry, + new_dir->d_inode, new_dentry, NULL, 0); +#endif exit5: dput(new_dentry); exit4: