From: Peng Tao Date: Tue, 28 Aug 2012 16:08:17 +0000 (+0800) Subject: LU-1994 kernel: 3.6 dentry_open uses struct path as first arg X-Git-Tag: 2.3.58~24 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=78b1d1bd115d643cc7e4718c3e946078b4b005ce;hp=7317ae10c0e26c2f3cfe9693e120ba39deae1a62;p=fs%2Flustre-release.git LU-1994 kernel: 3.6 dentry_open uses struct path as first arg 3.6 dentry_open uses struct path as first argument. see kernel commit 765927b2 for details. Signed-off-by: Peng Tao Change-Id: Ib69021356b1483abfcc49f644260b1dcbb57f76b Reviewed-on: http://review.whamcloud.com/4386 Tested-by: Hudson Reviewed-by: Lai Siyao Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Andreas Dilger --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 0412c16..4bf9a02 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2141,6 +2141,30 @@ EXTRA_KCFLAGS="$tmp_flags" ]) # +# 3.6 dentry_open uses struct path as first argument +# see kernel commit 765927b2 +# +AC_DEFUN([LC_DENTRY_OPEN_USE_PATH], +[AC_MSG_CHECKING([if dentry_open uses struct path as first argument]) +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror" +LB_LINUX_TRY_COMPILE([ + #include + #include +],[ + struct path path; + dentry_open(&path, 0, NULL); +],[ + AC_DEFINE(HAVE_DENTRY_OPEN_USE_PATH, 1, + [dentry_open uses struct path as first argument]) + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) +]) +EXTRA_KCFLAGS="$tmp_flags" +]) + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -2311,6 +2335,7 @@ AC_DEFUN([LC_PROG_LINUX], # 3.6 LC_HAVE_DENTRY_D_ALIAS_HLIST + LC_DENTRY_OPEN_USE_PATH # if test x$enable_server = xyes ; then diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index fe3d08f..398f571 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -140,11 +140,19 @@ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, #define ll_blkdev_put(a, b) blkdev_put(a) #endif -#ifdef HAVE_DENTRY_OPEN_4ARGS -#define ll_dentry_open(a, b, c, d) dentry_open(a, b, c, d) +static inline struct file *ll_dentry_open(struct dentry *dentry, + struct vfsmount *mnt, int flags, + const struct cred *cred) +{ +#ifdef HAVE_DENTRY_OPEN_USE_PATH + struct path path = { .mnt = mnt, .dentry = dentry }; + return dentry_open(&path, flags, cred); +#elif defined HAVE_DENTRY_OPEN_4ARGS + return dentry_open(dentry, mnt, flags, cred); #else -#define ll_dentry_open(a, b, c, d) dentry_open(a, b, c) + return dentry_open(dentry, mnt, flags); #endif +} #ifdef HAVE_SECURITY_PLUG #define ll_vfs_symlink(dir, dentry, mnt, path, mode) \