diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 0f849950e..ce798cc74 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -908,3 +908,41 @@ AC_DEFUN([SPL_AC_ZONE_STAT_ITEM_FIA], [ AC_MSG_RESULT(no) ]) ]) + +dnl # +dnl # SLES API change, never adopted in mainline, +dnl # Third 'struct vfsmount *' argument removed. +dnl # +AC_DEFUN([SPL_AC_2ARGS_VFS_UNLINK], + [AC_MSG_CHECKING([whether vfs_unlink() wants 2 args]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + vfs_unlink(NULL, NULL); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_2ARGS_VFS_UNLINK, 1, + [vfs_unlink() wants 2 args]) + ],[ + AC_MSG_RESULT(no) + ]) +]) + +dnl # +dnl # SLES API change, never adopted in mainline, +dnl # Third and sixth 'struct vfsmount *' argument removed. +dnl # +AC_DEFUN([SPL_AC_4ARGS_VFS_RENAME], + [AC_MSG_CHECKING([whether vfs_rename() wants 4 args]) + SPL_LINUX_TRY_COMPILE([ + #include + ],[ + vfs_rename(NULL, NULL, NULL, NULL); + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_4ARGS_VFS_RENAME, 1, + [vfs_rename() wants 4 args]) + ],[ + AC_MSG_RESULT(no) + ]) +]) diff --git a/configure b/configure index c16397c76..8ad6e7f53 100755 --- a/configure +++ b/configure @@ -21081,6 +21081,134 @@ echo "${ECHO_T}no" >&6 +fi + + rm -Rf build + + + +echo "$as_me:$LINENO: checking whether vfs_unlink() wants 2 args" >&5 +echo $ECHO_N "checking whether vfs_unlink() wants 2 args... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + vfs_unlink(NULL, NULL); + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_2ARGS_VFS_UNLINK 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + +fi + + rm -Rf build + + + +echo "$as_me:$LINENO: checking whether vfs_rename() wants 4 args" >&5 +echo $ECHO_N "checking whether vfs_rename() wants 4 args... $ECHO_C" >&6 + + +cat >conftest.c <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + + #include + +int +main (void) +{ + + vfs_rename(NULL, NULL, NULL, NULL); + + ; + return 0; +} + +_ACEOF + + + rm -Rf build && mkdir -p build + echo "obj-m := conftest.o" >build/Makefile + if { ac_try='cp conftest.c build && make modules LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_4ARGS_VFS_RENAME 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + + + fi rm -Rf build diff --git a/configure.ac b/configure.ac index e05629750..a073f4297 100644 --- a/configure.ac +++ b/configure.ac @@ -79,6 +79,8 @@ SPL_AC_NEXT_ZONE SPL_AC_GET_ZONE_COUNTS SPL_AC_GLOBAL_PAGE_STATE SPL_AC_ZONE_STAT_ITEM_FIA +SPL_AC_2ARGS_VFS_UNLINK +SPL_AC_4ARGS_VFS_RENAME AC_CONFIG_FILES([ Makefile diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index b19d9f1de..c5595dee0 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -290,7 +290,7 @@ vn_remove(const char *path, uio_seg_t seg, int flags) mutex_lock_nested(&nd.nd_dentry->d_inode->i_mutex, I_MUTEX_PARENT); #else down(&nd.nd_dentry->d_inode->i_sem); -#endif +#endif /* HAVE_INODE_I_MUTEX */ dentry = vn_lookup_hash(&nd); rc = PTR_ERR(dentry); if (!IS_ERR(dentry)) { @@ -301,7 +301,11 @@ vn_remove(const char *path, uio_seg_t seg, int flags) inode = dentry->d_inode; if (inode) atomic_inc(&inode->i_count); +#ifdef HAVE_2ARGS_VFS_UNLINK rc = vfs_unlink(nd.nd_dentry->d_inode, dentry); +#else + rc = vfs_unlink(nd.nd_dentry->d_inode, dentry, nd.mnt); +#endif /* HAVE_2ARGS_VFS_UNLINK */ exit2: dput(dentry); } @@ -309,7 +313,7 @@ exit2: mutex_unlock(&nd.nd_dentry->d_inode->i_mutex); #else up(&nd.nd_dentry->d_inode->i_sem); -#endif +#endif /* HAVE_INODE_I_MUTEX */ if (inode) iput(inode); /* truncate the inode here */ exit1: @@ -328,9 +332,9 @@ EXPORT_SYMBOL(vn_remove); int vn_rename(const char *oldname, const char *newname, int x1) { - struct dentry * old_dir, * new_dir; - struct dentry * old_dentry, *new_dentry; - struct dentry * trap; + struct dentry *old_dir, *new_dir; + struct dentry *old_dentry, *new_dentry; + struct dentry *trap; struct nameidata oldnd, newnd; int rc = 0; ENTRY; @@ -393,8 +397,13 @@ vn_rename(const char *oldname, const char *newname, int x1) if (new_dentry == trap) GOTO(exit5, rc); +#ifdef HAVE_4ARGS_VFS_RENAME rc = vfs_rename(old_dir->d_inode, old_dentry, new_dir->d_inode, new_dentry); +#else + rc = vfs_rename(old_dir->d_inode, old_dentry, oldnd.mnt, + new_dir->d_inode, new_dentry, newnd.mnt); +#endif /* HAVE_4ARGS_VFS_RENAME */ exit5: dput(new_dentry); exit4: diff --git a/spl_config.h.in b/spl_config.h.in index e3b80e86e..3e9e6b9af 100644 --- a/spl_config.h.in +++ b/spl_config.h.in @@ -15,12 +15,18 @@ /* register_sysctl_table() wants 2 args */ #undef HAVE_2ARGS_REGISTER_SYSCTL +/* vfs_unlink() wants 2 args */ +#undef HAVE_2ARGS_VFS_UNLINK + /* INIT_WORK wants 3 args */ #undef HAVE_3ARGS_INIT_WORK /* on_each_cpu wants 3 args */ #undef HAVE_3ARGS_ON_EACH_CPU +/* vfs_rename() wants 4 args */ +#undef HAVE_4ARGS_VFS_RENAME + /* device_create wants 5 args */ #undef HAVE_5ARGS_DEVICE_CREATE