From: Richard Yao Date: Tue, 12 Mar 2013 02:02:45 +0000 (-0400) Subject: Drop support for 3 argument version of set_fs_pwd X-Git-Tag: spl-0.7.12~315^2~1 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=8274ed598801255626b8c1648c3a4cdfea07b738;p=mirror_spl.git Drop support for 3 argument version of set_fs_pwd This was a suggestion that Brian Behlendorf made when reviewing an early pull request for Linux 3.9 support. This commit was made intentionally easy to revert should we ever have a reason to reintroduce support for older kernels. Signed-off-by: Richard Yao Signed-off-by: Brian Behlendorf --- diff --git a/config/spl-build.m4 b/config/spl-build.m4 index 6a8e658..14a7d97 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -63,7 +63,6 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [ SPL_AC_GET_ZONE_COUNTS SPL_AC_USER_PATH_DIR SPL_AC_SET_FS_PWD - SPL_AC_2ARGS_SET_FS_PWD SPL_AC_SET_FS_PWD_WITH_CONST SPL_AC_2ARGS_VFS_UNLINK SPL_AC_4ARGS_VFS_RENAME @@ -1672,33 +1671,11 @@ AC_DEFUN([SPL_AC_SET_FS_PWD], ]) ]) -dnl # -dnl # 2.6.25 API change, -dnl # Simplied API by replacing mnt+dentry args with a single path arg. -dnl # -AC_DEFUN([SPL_AC_2ARGS_SET_FS_PWD], - [AC_MSG_CHECKING([whether set_fs_pwd() wants 2 args]) - SPL_LINUX_TRY_COMPILE([ - #include - #include - ],[ - set_fs_pwd(NULL, NULL); - ],[ - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_2ARGS_SET_FS_PWD, 1, - [set_fs_pwd() wants 2 args]) - HAVE_2ARGS_SET_FS_PWD=yes - ],[ - AC_MSG_RESULT(no) - ]) -]) - dnl # dnl # 3.9 API change dnl # set_fs_pwd takes const struct path * dnl # AC_DEFUN([SPL_AC_SET_FS_PWD_WITH_CONST], -if test "x$HAVE_2ARGS_SET_FS_PWD" = xyes; then tmp_flags="$EXTRA_KCFLAGS" EXTRA_KCFLAGS="-Werror" [AC_MSG_CHECKING([whether set_fs_pwd() requires const struct path *]) @@ -1732,7 +1709,6 @@ if test "x$HAVE_2ARGS_SET_FS_PWD" = xyes; then ]) ]) EXTRA_KCFLAGS="$tmp_flags" -fi ]) dnl # diff --git a/module/spl/spl-vnode.c b/module/spl/spl-vnode.c index dac452c..4f56f10 100644 --- a/module/spl/spl-vnode.c +++ b/module/spl/spl-vnode.c @@ -837,8 +837,6 @@ vn_releasef(int fd) EXPORT_SYMBOL(releasef); #ifndef HAVE_SET_FS_PWD -# ifdef HAVE_2ARGS_SET_FS_PWD -/* Used from 2.6.25 - 2.6.31+ */ void # ifdef HAVE_SET_FS_PWD_WITH_CONST set_fs_pwd(struct fs_struct *fs, const struct path *path) @@ -865,37 +863,16 @@ set_fs_pwd(struct fs_struct *fs, struct path *path) if (old_pwd.dentry) path_put(&old_pwd); } -# else -/* Used from 2.6.11 - 2.6.24 */ -void -set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt, struct dentry *dentry) -{ - struct dentry *old_pwd; - struct vfsmount *old_pwdmnt; - - write_lock(&fs->lock); - old_pwd = fs->pwd; - old_pwdmnt = fs->pwdmnt; - fs->pwdmnt = mntget(mnt); - fs->pwd = dget(dentry); - write_unlock(&fs->lock); - - if (old_pwd) { - dput(old_pwd); - mntput(old_pwdmnt); - } -} -# endif /* HAVE_2ARGS_SET_FS_PWD */ #endif /* HAVE_SET_FS_PWD */ int vn_set_pwd(const char *filename) { -#if defined(HAVE_2ARGS_SET_FS_PWD) && defined(HAVE_USER_PATH_DIR) +#ifdef HAVE_USER_PATH_DIR struct path path; #else struct nameidata nd; -#endif /* HAVE_2ARGS_SET_FS_PWD */ +#endif /* HAVE_USER_PATH_DIR */ mm_segment_t saved_fs; int rc; SENTRY; @@ -908,7 +885,6 @@ vn_set_pwd(const char *filename) saved_fs = get_fs(); set_fs(get_ds()); -#ifdef HAVE_2ARGS_SET_FS_PWD # ifdef HAVE_USER_PATH_DIR rc = user_path_dir(filename, &path); if (rc) @@ -937,21 +913,6 @@ dput_and_out: dput_and_out: path_put(&nd.path); # endif /* HAVE_USER_PATH_DIR */ -#else - rc = __user_walk(filename, - LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd); - if (rc) - SGOTO(out, rc); - - rc = vfs_permission(&nd, MAY_EXEC); - if (rc) - SGOTO(dput_and_out, rc); - - set_fs_pwd(current->fs, nd.nd_mnt, nd.nd_dentry); - -dput_and_out: - vn_path_release(&nd); -#endif /* HAVE_2ARGS_SET_FS_PWD */ out: set_fs(saved_fs);