Whamcloud - gitweb
LU-5014 osd-ldiskfs: vfs_unlink api changed 35/10235/2
authorBob Glossman <bob.glossman@intel.com>
Tue, 6 May 2014 17:34:11 +0000 (10:34 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 13 May 2014 14:48:20 +0000 (14:48 +0000)
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>
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/osd-ldiskfs/osd_compat.c

index 991c1e1..8e471bb 100644 (file)
@@ -1451,6 +1451,23 @@ vfs_rename_5args, [
 ]) # 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
@@ -1566,6 +1583,7 @@ AC_DEFUN([LC_PROG_LINUX], [
 
        # 3.13
        LC_VFS_RENAME_5ARGS
 
        # 3.13
        LC_VFS_RENAME_5ARGS
+       LC_VFS_UNLINK_3ARGS
 
        #
        AS_IF([test "x$enable_server" != xno], [
 
        #
        AS_IF([test "x$enable_server" != xno], [
index a485b07..42092db 100644 (file)
@@ -342,4 +342,10 @@ static inline struct dentry *d_make_root(struct inode *root)
 #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
+
 #endif /* _COMPAT25_H */
 #endif /* _COMPAT25_H */
index 6330066..d01748d 100644 (file)
@@ -1104,7 +1104,7 @@ int osd_obj_map_recover(struct osd_thread_info *info,
                /* 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;
                }