From 33d45e1e13ccea6da7d7075d9f4cfc55b30983dd Mon Sep 17 00:00:00 2001 From: brian Date: Wed, 19 Aug 2009 21:14:47 +0000 Subject: [PATCH] b=20479 i=yangsheng i=adilger i=shadow Ubuntu's 2.6.24-19-generic (and perhaps other kernels) remove_suid() takes a struct path * argument. --- lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++ lustre/include/linux/lustre_compat25.h | 6 +++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index af463e9..8e52200 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1342,6 +1342,23 @@ LB_LINUX_TRY_COMPILE([ ]) ]) +# (Ubuntu) 2.6.24's remove_suid() takes a struct path * +AC_DEFUN([LC_PATH_REMOVE_SUID], +[AC_MSG_CHECKING([kernel has a remove_suid that takes a struct path]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + struct path *a_path = NULL; + remove_suid(a_path); +],[ + AC_DEFINE(HAVE_PATH_REMOVE_SUID, 1, + [kernel has a remove suid that takes a struct path]) + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) +]) +]) + # 2.6.27 have new page locking API AC_DEFUN([LC_TRYLOCKPAGE], [AC_MSG_CHECKING([kernel use trylock_page for page lock]) @@ -1736,6 +1753,9 @@ AC_DEFUN([LC_PROG_LINUX], LC_FH_TO_DENTRY LC_PROCFS_DELETED + # 2.6.24-19-generic Ubuntu + LC_PATH_REMOVE_SUID + # 2.6.26 LC_FS_STRUCT_USE_PATH LC_RCU_LIST_SAFE diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 32b922c..f4ea8a7 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -439,7 +439,11 @@ int ll_unregister_blkdev(unsigned int dev, const char *name) #define ll_remove_suid(file, mnt) file_remove_suid(file) #else #ifdef HAVE_SECURITY_PLUG - #define ll_remove_suid(file,mnt) remove_suid(file->f_dentry,mnt) + #ifdef HAVE_PATH_REMOVE_SUID + #define ll_remove_suid(file,mnt) remove_suid(&file->f_path) + #else + #define ll_remove_suid(file,mnt) remove_suid(file->f_dentry,mnt) + #endif #else #define ll_remove_suid(file,mnt) remove_suid(file->f_dentry) #endif -- 1.8.3.1