From: Bob Glossman Date: Tue, 6 May 2014 17:34:11 +0000 (-0700) Subject: LU-5014 osd-ldiskfs: vfs_unlink api changed X-Git-Tag: 2.5.59~11 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F10235%2F2;p=fs%2Flustre-release.git LU-5014 osd-ldiskfs: vfs_unlink api changed 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 Change-Id: I3aa9a305530f74ee010fa5173527a37e048a9ef8 Reviewed-on: http://review.whamcloud.com/10235 Reviewed-by: Dmitry Eremin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 991c1e1..8e471bb 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1451,6 +1451,23 @@ 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 +],[ + 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 @@ -1566,6 +1583,7 @@ AC_DEFUN([LC_PROG_LINUX], [ # 3.13 LC_VFS_RENAME_5ARGS + LC_VFS_UNLINK_3ARGS # AS_IF([test "x$enable_server" != xno], [ diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index a485b07..42092db 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -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 +#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 */ diff --git a/lustre/osd-ldiskfs/osd_compat.c b/lustre/osd-ldiskfs/osd_compat.c index 6330066..d01748d 100644 --- a/lustre/osd-ldiskfs/osd_compat.c +++ b/lustre/osd-ldiskfs/osd_compat.c @@ -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) { - rc = vfs_unlink(src_parent, src_child); + rc = ll_vfs_unlink(src_parent, src_child); if (unlikely(rc == -ENOENT)) rc = 0; }