kernel 3.4 converts d_alloc_root to d_make_root.
(kernel commit
32991ab305ace7017c62f8eecbe5eb36dc32e13b)
Add LC_HAVE_D_MAKE_ROOT/HAVE_D_MAKE_ROOT to ckeck it.
Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Change-Id: I7ff1f0eff25495b655e650997016377ca0a200aa
Reviewed-on: http://review.whamcloud.com/3580
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
+# 3.4 converts d_alloc_root to d_make_root
+# see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b
+#
+AC_DEFUN([LC_HAVE_D_MAKE_ROOT],
+[AC_MSG_CHECKING([if have d_make_root])
+LB_LINUX_TRY_COMPILE([
+ #include <linux/fs.h>
+],[
+ d_make_root((struct inode *)NULL);
+],[
+ AC_DEFINE(HAVE_D_MAKE_ROOT, 1,
+ [have d_make_root])
+ AC_MSG_RESULT([yes])
+],[
+ AC_MSG_RESULT([no])
+])
+])
+
+#
# LC_PROG_LINUX
#
# Lustre linux kernel checks
# LC_PROG_LINUX
#
# Lustre linux kernel checks
# 3.4
LC_TOUCH_ATIME_1ARG
# 3.4
LC_TOUCH_ATIME_1ARG
-
- #
- if test x$enable_server = xyes ; then
- AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
- LC_FUNC_DEV_SET_RDONLY
- LC_STACK_SIZE
- LC_QUOTA64
- LC_QUOTA_CONFIG
- fi
+ LC_HAVE_D_MAKE_ROOT
+
+ #
+ if test x$enable_server = xyes ; then
+ AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server])
+ LC_FUNC_DEV_SET_RDONLY
+ LC_STACK_SIZE
+ LC_QUOTA64
+ LC_QUOTA_CONFIG
+ fi
# define ll_umode_t int
#endif
# define ll_umode_t int
#endif
+#include <linux/dcache.h>
+#ifndef HAVE_D_MAKE_ROOT
+static inline struct dentry *d_make_root(struct inode *root)
+{
+ struct dentry *res = d_alloc_root(root);
+
+ if (res == NULL && root)
+ iput(root);
+
+ return res;
+}
+#endif
+
KEY_CACHE_SET, sizeof(sbi->ll_cache),
&sbi->ll_cache, NULL);
KEY_CACHE_SET, sizeof(sbi->ll_cache),
&sbi->ll_cache, NULL);
- sb->s_root = d_alloc_root(root);
+ sb->s_root = d_make_root(root);
+ if (sb->s_root == NULL) {
+ CERROR("%s: can't make root dentry\n",
+ ll_get_fsname(sb, NULL, 0));
+ GOTO(out_lock_cn_cb, err = -ENOMEM);
+ }
+
#ifdef HAVE_DCACHE_LOCK
sb->s_root->d_op = &ll_d_root_ops;
#else
#ifdef HAVE_DCACHE_LOCK
sb->s_root->d_op = &ll_d_root_ops;
#else
- /* returns -EIO for every operation */
- /* make_bad_inode(root); -- badness - can't umount */
- /* apparently we need to be a directory for the mount to finish */
- root->i_mode = S_IFDIR;
-
- sb->s_root = d_alloc_root(root);
- if (!sb->s_root) {
- CERROR("Can't make root dentry\n");
- iput(root);
- RETURN(-EIO);
- }
+ /* returns -EIO for every operation */
+ /* make_bad_inode(root); -- badness - can't umount */
+ /* apparently we need to be a directory for the mount to finish */
+ root->i_mode = S_IFDIR;
+
+ sb->s_root = d_make_root(root);
+ if (!sb->s_root) {
+ CERROR("%s: can't make root dentry\n", sb->s_id);
+ RETURN(-EIO);
+ }
}
static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags)
}
static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags)