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 <tuxoko@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #355
This commit is contained in:
Chunwei Chen 2014-05-07 10:54:37 -07:00 committed by Brian Behlendorf
parent 1538f4b6e3
commit ad3412efd7
2 changed files with 34 additions and 7 deletions

View File

@ -1906,10 +1906,31 @@ AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME],
AC_MSG_RESULT(yes) AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_5ARGS_VFS_RENAME, 1, AC_DEFINE(HAVE_5ARGS_VFS_RENAME, 1,
[vfs_rename() wants 5 args]) [vfs_rename() wants 5 args])
],[
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 <linux/fs.h>
],[
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) AC_MSG_ERROR(no)
]) ])
]) ])
])
]) ])
dnl # dnl #

View File

@ -414,13 +414,16 @@ vn_rename(const char *oldname, const char *newname, int x1)
SGOTO(exit4, rc); SGOTO(exit4, rc);
} }
#ifdef HAVE_4ARGS_VFS_RENAME #if defined(HAVE_4ARGS_VFS_RENAME)
rc = vfs_rename(old_dir->d_inode, old_dentry, rc = vfs_rename(old_dir->d_inode, old_dentry,
new_dir->d_inode, new_dentry); new_dir->d_inode, new_dentry);
#else #elif defined(HAVE_5ARGS_VFS_RENAME)
rc = vfs_rename(old_dir->d_inode, old_dentry, rc = vfs_rename(old_dir->d_inode, old_dentry,
new_dir->d_inode, new_dentry, NULL); 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: exit4:
unlock_rename(new_dir, old_dir); unlock_rename(new_dir, old_dir);
exit3: exit3:
@ -574,13 +577,16 @@ vn_rename(const char *oldname, const char *newname, int x1)
if (new_dentry == trap) if (new_dentry == trap)
SGOTO(exit5, rc); SGOTO(exit5, rc);
#ifdef HAVE_4ARGS_VFS_RENAME #if defined(HAVE_4ARGS_VFS_RENAME)
rc = vfs_rename(old_dir->d_inode, old_dentry, rc = vfs_rename(old_dir->d_inode, old_dentry,
new_dir->d_inode, new_dentry); new_dir->d_inode, new_dentry);
#else #elif defined(HAVE_5ARGS_VFS_RENAME)
rc = vfs_rename(old_dir->d_inode, old_dentry, rc = vfs_rename(old_dir->d_inode, old_dentry,
new_dir->d_inode, new_dentry, NULL); 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: exit5:
dput(new_dentry); dput(new_dentry);
exit4: exit4: