In newer kernels the vfs_unlink api changed to take
more arguments. This patch creates a wrapper to let us adapt
to the different versions of vfs_unlink in old and new kernels.
As vfs_unlink is only used in server code
this only impacts server builds of lustre.
Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Change-Id: I3aa9a305530f74ee010fa5173527a37e048a9ef8
Reviewed-on: http://review.whamcloud.com/10235
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
]) # LC_VFS_RENAME_5ARGS
#
]) # LC_VFS_RENAME_5ARGS
#
+# LC_VFS_UNLINK_3ARGS
+#
+# 3.13 has vfs_renane with 3 args
+#
+AC_DEFUN([LC_VFS_UNLINK_3ARGS], [
+LB_CHECK_COMPILE([if Linux kernel has 'vfs_unlink' with 3 args],
+vfs_unlink_3args, [
+ #include <linux/fs.h>
+],[
+ vfs_unlink(NULL, NULL, NULL);
+], [
+ AC_DEFINE(HAVE_VFS_UNLINK_3ARGS, 1,
+ [kernel has vfs_unlink with 3 args])
+])
+]) # LC_VFS_UNLINK_3ARGS
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
# LC_PROG_LINUX
#
# Lustre linux kernel checks
# 3.13
LC_VFS_RENAME_5ARGS
# 3.13
LC_VFS_RENAME_5ARGS
#
AS_IF([test "x$enable_server" != xno], [
#
AS_IF([test "x$enable_server" != xno], [
#define ll_vfs_rename(a, b, c, d) vfs_rename(a, b, c, d)
#endif
#define ll_vfs_rename(a, b, c, d) vfs_rename(a, b, c, d)
#endif
+#ifdef HAVE_VFS_UNLINK_3ARGS
+#define ll_vfs_unlink(a, b) vfs_unlink(a, b, NULL)
+#else
+#define ll_vfs_unlink(a, b) vfs_unlink(a, b)
+#endif
+
/* If the src object has never been modified, then remove it. */
if (inode->i_size == 0 && inode->i_mode & S_ISUID &&
inode->i_mode & S_ISGID) {
/* If the src object has never been modified, then remove it. */
if (inode->i_size == 0 && inode->i_mode & S_ISUID &&
inode->i_mode & S_ISGID) {
- rc = vfs_unlink(src_parent, src_child);
+ rc = ll_vfs_unlink(src_parent, src_child);
if (unlikely(rc == -ENOENT))
rc = 0;
}
if (unlikely(rc == -ENOENT))
rc = 0;
}