From 8e88bbfef5795b3bf9541c8cb5b2dd8a3bb11d9f Mon Sep 17 00:00:00 2001 From: James Simmons Date: Sat, 8 Feb 2020 08:39:30 -0500 Subject: [PATCH] LU-12477 lustre: remove obsolete config checks Remove from the lustre kernel code all the support for kernels earlier than the RHEL7 3.10+. This greatly simplifies the code and makes build times much better. Change-Id: If52091ac5249b2719b992032040ccf30cc5bf0e4 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/37085 Reviewed-by: Shaun Tancheff Reviewed-by: Andreas Dilger Reviewed-by: Petros Koutoupis Tested-by: jenkins Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- libcfs/include/libcfs/linux/linux-list.h | 20 - lustre/autoconf/lustre-core.m4 | 872 +------------------------------ lustre/include/lprocfs_status.h | 29 - lustre/include/lustre_compat.h | 264 +--------- lustre/llite/dcache.c | 44 +- lustre/llite/file.c | 77 +-- lustre/llite/llite_internal.h | 14 +- lustre/llite/llite_lib.c | 16 +- lustre/llite/llite_nfs.c | 8 - lustre/llite/namei.c | 178 +------ lustre/llite/pcc.c | 12 +- lustre/llite/rw26.c | 16 +- lustre/llite/vvp_io.c | 1 - lustre/llite/xattr_security.c | 66 +-- lustre/mdc/mdc_request.c | 6 +- lustre/obdclass/llog.c | 16 +- lustre/obdclass/llog_cat.c | 2 +- lustre/obdclass/llog_osd.c | 6 +- lustre/obdclass/llog_test.c | 2 +- lustre/obdclass/lprocfs_jobstats.c | 4 - lustre/obdclass/lprocfs_status.c | 101 ---- lustre/obdclass/obd_mount.c | 16 - lustre/obdclass/obd_mount_server.c | 10 - lustre/osc/osc_cache.c | 2 +- lustre/osc/osc_quota.c | 4 +- lustre/osc/osc_request.c | 8 +- lustre/osd-ldiskfs/osd_handler.c | 23 +- lustre/osd-ldiskfs/osd_internal.h | 3 + lustre/osd-ldiskfs/osd_io.c | 6 +- lustre/osd-ldiskfs/osd_scrub.c | 2 +- lustre/ptlrpc/gss/gss_keyring.c | 29 +- lustre/ptlrpc/gss/gss_svc_upcall.c | 49 +- lustre/ptlrpc/lproc_ptlrpc.c | 4 - lustre/ptlrpc/sec.c | 8 +- lustre/quota/lproc_quota.c | 4 - lustre/target/tgt_handler.c | 28 +- lustre/utils/mount_utils.c | 7 +- 37 files changed, 124 insertions(+), 1833 deletions(-) diff --git a/libcfs/include/libcfs/linux/linux-list.h b/libcfs/include/libcfs/linux/linux-list.h index e4a8e8d..c457bee 100644 --- a/libcfs/include/libcfs/linux/linux-list.h +++ b/libcfs/include/libcfs/linux/linux-list.h @@ -25,26 +25,6 @@ #include -#ifdef HAVE_HLIST_FOR_EACH_3ARG -#define cfs_hlist_for_each_entry(tpos, pos, head, member) \ - hlist_for_each_entry(tpos, head, member) -#define cfs_hlist_for_each_entry_safe(tpos, pos, n, head, member) \ - hlist_for_each_entry_safe(tpos, n, head, member) -#define cfs_hlist_for_each_entry_continue(tpos, pos, member) \ - hlist_for_each_entry_continue(tpos, member) -#define cfs_hlist_for_each_entry_from(tpos, pos, member) \ - hlist_for_each_entry_from(tpos, member) -#else -#define cfs_hlist_for_each_entry(tpos, pos, head, member) \ - hlist_for_each_entry(tpos, pos, head, member) -#define cfs_hlist_for_each_entry_safe(tpos, pos, n, head, member) \ - hlist_for_each_entry_safe(tpos, pos, n, head, member) -#define cfs_hlist_for_each_entry_continue(tpos, pos, member) \ - hlist_for_each_entry_continue(tpos, pos, member) -#define cfs_hlist_for_each_entry_from(tpos, pos, member) \ - hlist_for_each_entry_from(tpos, pos, member) -#endif - #ifdef HAVE_HLIST_ADD_AFTER #define hlist_add_behind(hnode, tail) hlist_add_after(tail, hnode) #endif /* HAVE_HLIST_ADD_AFTER */ diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 24c1f1b..d609a4c 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -181,8 +181,20 @@ Lustre quota requires that CONFIG_QUOTA is enabled in your kernel. ])]) ]) # LC_QUOTA_CONFIG +# +# LC_CONFIG_FHANDLE +# +# fhandle kernel support for open_by_handle_at() and name_to_handle_at() +# system calls. The kernel must support CONFIG_FHANDLE. +# +AC_DEFUN([LC_CONFIG_FHANDLE], [ +LB_CHECK_CONFIG_IM([FHANDLE], [], + [AC_MSG_ERROR([ + +Lustre fid handling requires that CONFIG_FHANDLE is enabled in your kernel. +])]) +]) # LC_CONFIG_FHANDLE -#[AC_DEFINE(CONFIG_LUSTRE_FS_POSIX_ACL, 1, [Enable POSIX acl])]) # # LC_POSIX_ACL_CONFIG # @@ -360,738 +372,6 @@ No openssk-devel headers found, unable to build l_getsepol and SELinux status ch AC_MSG_RESULT([$enable_getsepol]) ]) # LC_OPENSSL_GETSEPOL -# LC_INODE_PERMISION_2ARGS -# -# up to v2.6.27 had a 3 arg version (inode, mask, nameidata) -# v2.6.27->v2.6.37 had a 2 arg version (inode, mask) -# v2.6.37->v3.0 had a 3 arg version (inode, mask, nameidata) -# v3.1 onward have a 2 arg version (inode, mask) -# -AC_DEFUN([LC_INODE_PERMISION_2ARGS], [ -LB_CHECK_COMPILE([if 'inode_operations->permission' has two args], -inode_ops_permission_2args, [ - #include -],[ - struct inode *inode __attribute__ ((unused)); - - inode = NULL; - inode->i_op->permission(NULL, 0); -],[ - AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1, - [inode_operations->permission has two args]) -]) -]) # LC_INODE_PERMISION_2ARGS - -# -# LC_HAVE_FSTYPE_MOUNT -# -# 2.6.39 replace get_sb with mount in struct file_system_type -# -AC_DEFUN([LC_HAVE_FSTYPE_MOUNT], [ -LB_CHECK_COMPILE([if 'file_system_type' has 'mount' field], -file_system_type_mount, [ - #include -],[ - struct file_system_type fst = { }; - void *mount; - - mount = (void *)fst.mount; -],[ - AC_DEFINE(HAVE_FSTYPE_MOUNT, 1, - [struct file_system_type has mount field]) -]) -]) # LC_HAVE_FSTYPE_MOUNT - -# -# LC_HAVE_FHANDLE_SYSCALLS -# -# 2.6.39 The open_by_handle_at() and name_to_handle_at() system calls were -# added to Linux kernel 2.6.39. -# Check if client supports these functions -# -AC_DEFUN([LC_HAVE_FHANDLE_SYSCALLS], [ -LB_CHECK_CONFIG_IM([FHANDLE],[ - AC_DEFINE(HAVE_FHANDLE_SYSCALLS, 1, - [kernel supports fhandles and related syscalls]) - ]) -]) # LC_HAVE_FHANDLE_SYSCALLS - -# -# LC_HAVE_INODE_OWNER_OR_CAPABLE -# -# 2.6.39 renames is_owner_or_cap to inode_owner_or_capable -# -AC_DEFUN([LC_HAVE_INODE_OWNER_OR_CAPABLE], [ -LB_CHECK_COMPILE([if 'inode_owner_or_capable' exist], -inode_owner_or_capable, [ - #include -],[ - inode_owner_or_capable(NULL); -],[ - AC_DEFINE(HAVE_INODE_OWNER_OR_CAPABLE, 1, - [inode_owner_or_capable exist]) -]) -]) # LC_HAVE_INODE_OWNER_OR_CAPABLE - -# -# LC_DIRTY_INODE_WITH_FLAG -# -# 3.0 dirty_inode() has a flag parameter -# see kernel commit aa38572954ade525817fe88c54faebf85e5a61c0 -# -AC_DEFUN([LC_DIRTY_INODE_WITH_FLAG], [ -LB_CHECK_COMPILE([if 'dirty_inode' super_operation takes flag], -dirty_inode_super_operation_flag, [ - #include -],[ - struct inode *inode = NULL; - inode->i_sb->s_op->dirty_inode(NULL, 0); -],[ - AC_DEFINE(HAVE_DIRTY_INODE_HAS_FLAG, 1, - [dirty_inode super_operation takes flag]) -]) -]) # LC_DIRTY_INODE_WITH_FLAG - -# -# LC_SETNS -# -# 3.0 introduced setns -# -AC_DEFUN([LC_SETNS], [ -AC_CHECK_HEADERS([sched.h], [], [], - [#define _GNU_SOURCE - ]) -AC_CHECK_FUNCS([setns]) -]) # LC_SETNS - -# -# LC_LM_XXX_LOCK_MANAGER_OPS -# -# 3.1 renames lock-manager ops(lock_manager_operations) from fl_xxx to lm_xxx -# see kernel commit 8fb47a4fbf858a164e973b8ea8ef5e83e61f2e50 -# -AC_DEFUN([LC_LM_XXX_LOCK_MANAGER_OPS], [ -LB_CHECK_COMPILE([if 'lock-manager' ops renamed to 'lm_xxx'], -lock_manager_ops_lm_xxx, [ - #include -],[ - struct lock_manager_operations lm_ops; - lm_ops.lm_notify = NULL; -],[ - AC_DEFINE(HAVE_LM_XXX_LOCK_MANAGER_OPS, 1, - [lock-manager ops renamed to lm_xxx]) -]) -]) # LC_LM_XXX_LOCK_MANAGER_OPS - -# -# LC_INODE_DIO_WAIT -# -# 3.1 kills inode->i_alloc_sem, use i_dio_count and inode_dio_wait -# instead. -# see kernel commit bd5fe6c5eb9c548d7f07fe8f89a150bb6705e8e3 -# -AC_DEFUN([LC_INODE_DIO_WAIT], [ -LB_CHECK_COMPILE([if 'inode->i_alloc_sem' is killed and use inode_dio_wait], -inode_dio_wait, [ - #include -],[ - inode_dio_wait((struct inode *)0); -],[ - AC_DEFINE(HAVE_INODE_DIO_WAIT, 1, - [inode->i_alloc_sem is killed and use inode_dio_wait]) -]) -]) # LC_INODE_DIO_WAIT - -# -# LC_IOP_GET_ACL -# -# 3.1 adds get_acl method to inode_operations to read ACL from disk. -# see kernel commit 4e34e719e457f2e031297175410fc0bd4016a085 -# -AC_DEFUN([LC_IOP_GET_ACL], [ -LB_CHECK_COMPILE([if 'inode_operations' has '.get_acl' member function], -inode_ops_get_acl, [ - #include -],[ - struct inode_operations iop; - iop.get_acl = NULL; -],[ - AC_DEFINE(HAVE_IOP_GET_ACL, 1, - [inode_operations has .get_acl member function]) -]) -]) # LC_IOP_GET_ACL - -# -# LC_FILE_LLSEEK_SIZE -# -# 3.1 introduced generic_file_llseek_size() -# -AC_DEFUN([LC_FILE_LLSEEK_SIZE], [ -LB_CHECK_EXPORT([generic_file_llseek_size], [fs/read_write.c], - [AC_DEFINE(HAVE_FILE_LLSEEK_SIZE, 1, - [generic_file_llseek_size is exported by the kernel])]) -]) # LC_FILE_LLSEEK_SIZE - -# -# LC_RADIX_EXCEPTION_ENTRY -# 3.1 adds radix_tree_exception_entry. -# -AC_DEFUN([LC_RADIX_EXCEPTION_ENTRY], [ -LB_CHECK_COMPILE([radix_tree_exceptional_entry exist], -radix_tree_exceptional_entry, [ - #include -],[ - radix_tree_exceptional_entry(NULL); -],[ - AC_DEFINE(HAVE_RADIX_EXCEPTION_ENTRY, 1, - [radix_tree_exceptional_entry exist]) -]) -]) # LC_RADIX_EXCEPTION_ENTRY - -# -# LC_HAVE_PROTECT_I_NLINK -# -# 3.2 protects inode->i_nlink from direct modification -# see kernel commit a78ef704a8dd430225955f0709b22d4a6ba21deb -# at the same time adds set_nlink(), so checks set_nlink() for it. -# -AC_DEFUN([LC_HAVE_PROTECT_I_NLINK], [ -LB_CHECK_COMPILE([if 'inode->i_nlink' is protected from direct modification], -inode_i_nlink_protected, [ - #include -],[ - struct inode i; - set_nlink(&i, 1); -],[ - AC_DEFINE(HAVE_PROTECT_I_NLINK, 1, - [inode->i_nlink is protected from direct modification]) -]) -]) # LC_HAVE_PROTECT_I_NLINK - -# -# 2.6.39 security_inode_init_security takes a 'struct qstr' parameter -# -# 3.2 security_inode_init_security takes a callback to set xattrs -# -AC_DEFUN([LC_HAVE_SECURITY_IINITSEC], [ -LB_CHECK_COMPILE([if security_inode_init_security takes a callback], -security_inode_init_security_callback, [ - #include -],[ - security_inode_init_security(NULL, NULL, NULL, (const initxattrs)NULL, NULL); -],[ - AC_DEFINE(HAVE_SECURITY_IINITSEC_CALLBACK, 1, - [security_inode_init_security takes a callback to set xattrs]) -],[ - LB_CHECK_COMPILE([if security_inode_init_security takes a 'struct qstr' parameter], - security_inode_init_security_qstr, [ - #include - ],[ - security_inode_init_security(NULL, NULL, (struct qstr *)NULL, NULL, NULL, NULL); - ],[ - AC_DEFINE(HAVE_SECURITY_IINITSEC_QSTR, 1, - [security_inode_init_security takes a 'struct qstr' parameter]) - ]) -]) -]) # LC_HAVE_SECURITY_IINITSEC - -# -# 2.6.39 vfs_create takes a 'struct nameidata' parameter -# -AC_DEFUN([LC_VFS_CREATE_USE_NAMEIDATA], [ -LB_CHECK_COMPILE([if vfs_create takes a struct nameidata parameter], -vfs_create, [ - #include - #include -],[ - struct nameidata *nd; - vfs_create(NULL, NULL, 0, nd); -],[ - AC_DEFINE(HAVE_VFS_CREATE_USE_NAMEIDATA, 1, - [vfs_create use nameidata as parameter]) -]) -]) # LC_VFS_CREATE_USE_NAMEIDATA - -# -# LC_HAVE_MIGRATE_HEADER -# -# 3.3 introduces migrate_mode.h and migratepage has 4 args -# -AC_DEFUN([LC_HAVE_MIGRATE_HEADER], [ -LB_CHECK_FILE([$LINUX/include/linux/migrate.h], [ - AC_DEFINE(HAVE_MIGRATE_H, 1, - [kernel has include/linux/migrate.h]) -],[ - LB_CHECK_FILE([$LINUX/include/linux/migrate_mode.h], [ - AC_DEFINE(HAVE_MIGRATE_MODE_H, 1, - [kernel has include/linux/migrate_mode.h]) - ]) -]) -]) # LC_HAVE_MIGRATE_HEADER - -# -# LC_MIGRATEPAGE_4ARGS -# -AC_DEFUN([LC_MIGRATEPAGE_4ARGS], [ -LB_CHECK_COMPILE([if 'address_space_operations.migratepage' has 4 args], -address_space_ops_migratepage_4args, [ - #include -#ifdef HAVE_MIGRATE_H - #include -#elif defined(HAVE_MIGRATE_MODE_H) - #include -#endif -],[ - struct address_space_operations aops = { }; - aops.migratepage(NULL, NULL, NULL, MIGRATE_ASYNC); -],[ - AC_DEFINE(HAVE_MIGRATEPAGE_4ARGS, 1, - [address_space_operations.migratepage has 4 args]) -]) -]) # LC_MIGRATEPAGE_4ARGS - -# -# LC_SUPEROPS_USE_DENTRY -# -# 3.3 switchs super_operations to use dentry as parameter (but not vfsmount) -# see kernel commit 34c80b1d93e6e20ca9dea0baf583a5b5510d92d4 -# -AC_DEFUN([LC_SUPEROPS_USE_DENTRY], [ -tmp_flags="$EXTRA_KCFLAGS" -EXTRA_KCFLAGS="-Werror" -LB_CHECK_COMPILE([if 'super_operations' use 'dentry' as parameter], -super_ops_dentry, [ - #include - int show_options(struct seq_file *seq, struct dentry *root) { - return 0; - } -],[ - struct super_operations ops; - ops.show_options = show_options; -],[ - AC_DEFINE(HAVE_SUPEROPS_USE_DENTRY, 1, - [super_operations use dentry as parameter]) -]) -EXTRA_KCFLAGS="$tmp_flags" -]) # LC_SUPEROPS_USE_DENTRY - -# -# LC_INODEOPS_USE_UMODE_T -# -# 3.3 switchs inode_operations to use umode_t as parameter (but not int) -# see kernel commit 1a67aafb5f72a436ca044293309fa7e6351d6a35 -# -AC_DEFUN([LC_INODEOPS_USE_UMODE_T], [ -tmp_flags="$EXTRA_KCFLAGS" -EXTRA_KCFLAGS="-Werror" -LB_CHECK_COMPILE([if 'inode_operations' use 'umode_t' as parameter], -inode_ops_umode_t, [ - #include - #include - int my_mknod(struct inode *dir, struct dentry *dchild, - umode_t mode, dev_t dev) - { - return 0; - } -],[ - struct inode_operations ops; - ops.mknod = my_mknod; -],[ - AC_DEFINE(HAVE_INODEOPS_USE_UMODE_T, 1, - [inode_operations use umode_t as parameter]) -]) -EXTRA_KCFLAGS="$tmp_flags" -]) # LC_INODEOPS_USE_UMODE_T - -# -# LC_KMAP_ATOMIC_HAS_1ARG -# -# 3.4 kmap_atomic removes second argument -# see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f -# -AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG], [ -LB_CHECK_COMPILE([if 'kmap_atomic' has only 1 argument], -kmap_atomic_1arg, [ - #include -],[ - kmap_atomic(NULL); -],[ - AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1, - [have kmap_atomic has only 1 argument]) -]) -]) # LC_KMAP_ATOMIC_HAS_1ARG - -# -# LC_HAVE_D_MAKE_ROOT -# -# 3.4 converts d_alloc_root to d_make_root -# see kernel commit 32991ab305ace7017c62f8eecbe5eb36dc32e13b -# -AC_DEFUN([LC_HAVE_D_MAKE_ROOT], [ -LB_CHECK_COMPILE([if have 'd_make_root'], -d_make_root, [ - #include -],[ - d_make_root((struct inode *)NULL); -],[ - AC_DEFINE(HAVE_D_MAKE_ROOT, 1, - [have d_make_root]) -]) -]) # LC_HAVE_D_MAKE_ROOT - -# -# LC_HAVE_CACHE_REGISTER -# -# 3.4 cache_register/cache_unregister are removed -# see kernel commit 2c5f846747526e2b83c5f1b8e69016be0e2e87c0 -# Note, since 2.6.37 cache_register_net/cache_unregister_net -# are defined, but not exported. -# 3.3 cache_register_net/cache_unregister_net are -# exported and replacing cache_register/cache_unregister in 3.4 -# -AC_DEFUN([LC_HAVE_CACHE_REGISTER], [ -LB_CHECK_COMPILE([if have 'cache_register'], -cache_register, [ - #include -],[ - cache_register(NULL); -],[ - AC_DEFINE(HAVE_CACHE_REGISTER, 1, - [have cache_register]) -]) -]) # LC_HAVE_CACHE_REGISTER - -# -# LC_HAVE_CLEAR_INODE -# -# 3.5 renames end_writeback() back to clear_inode()... -# see kernel commit dbd5768f87ff6fb0a4fe09c4d7b6c4a24de99430 -# -AC_DEFUN([LC_HAVE_CLEAR_INODE], [ -LB_CHECK_COMPILE([if have 'clear_inode'], -clear_inode, [ - #include -],[ - clear_inode((struct inode *)NULL); -],[ - AC_DEFINE(HAVE_CLEAR_INODE, 1, - [have clear_inode]) -]) -]) # LC_HAVE_CLEAR_INODE - -# -# LC_HAVE_ENCODE_FH_PARENT -# -# 3.5 encode_fh has parent inode passed in directly -# see kernel commit b0b0382b -# -AC_DEFUN([LC_HAVE_ENCODE_FH_PARENT], [ -tmp_flags="$EXTRA_KCFLAGS" -EXTRA_KCFLAGS="-Werror" -LB_CHECK_COMPILE([if 'encode_fh' have parent inode as parameter], -encode_fh_parent_inode, [ - #include - #include - #include - int ll_encode_fh(struct inode *i, __u32 *a, int *b, struct inode *p) - { - return 0; - } -],[ - struct export_operations exp_op; - exp_op.encode_fh = ll_encode_fh; -],[ - AC_DEFINE(HAVE_ENCODE_FH_PARENT, 1, - [have parent inode as parameter]) -]) -EXTRA_KCFLAGS="$tmp_flags" -]) # LC_HAVE_ENCODE_FH_PARENT - -# -# LC_FILE_LLSEEK_SIZE_5ARG -# -# 3.5 has generic_file_llseek_size with 5 args -# -AC_DEFUN([LC_FILE_LLSEEK_SIZE_5ARG], [ -LB_CHECK_COMPILE([if Linux kernel has 'generic_file_llseek_size' with 5 args], -generic_file_llseek_size_5args, [ - #include -],[ - generic_file_llseek_size(NULL, 0, 0, 0, 0); -], [ - AC_DEFINE(HAVE_FILE_LLSEEK_SIZE_5ARGS, 1, - [kernel has generic_file_llseek_size with 5 args]) -]) -]) # LC_FILE_LLSEEK_SIZE_5ARG - -# -# LC_LLITE_DATA_IS_LIST -# -# 3.6 switch i_dentry/d_alias from list to hlist -# -# In the upstream kernels d_alias first changes -# to a hlist and then in later version, 3.11, gets -# moved to the union d_u. Due to some distros having -# d_alias in the d_u union as a struct list, which -# has never existed upstream stream, we can't test -# if d_alias is a list or hlist directly. If ever -# i_dentry and d_alias even up different combos then -# the build will fail. In that case then we will need -# to separate out the i_dentry and d_alias test below. -# -AC_DEFUN([LC_DATA_FOR_LLITE_IS_LIST], [ -tmp_flags="$EXTRA_KCFLAGS" -EXTRA_KCFLAGS="-Werror" -LB_CHECK_COMPILE([if 'i_dentry/d_alias' uses 'list'], -i_dentry_d_alias_list, [ - #include -],[ - struct inode inode; - INIT_LIST_HEAD(&inode.i_dentry); -],[ - AC_DEFINE(DATA_FOR_LLITE_IS_LIST, 1, - [both i_dentry/d_alias uses list]) -]) -EXTRA_KCFLAGS="$tmp_flags" -]) # LC_DATA_FOR_LLITE_IS_LIST - -# -# LC_DENTRY_OPEN_USE_PATH -# -# 3.6 dentry_open uses struct path as first argument -# see kernel commit 765927b2 -# -AC_DEFUN([LC_DENTRY_OPEN_USE_PATH], [ -tmp_flags="$EXTRA_KCFLAGS" -EXTRA_KCFLAGS="-Werror" -LB_CHECK_COMPILE([if 'dentry_open' uses 'struct path' as first argument], -dentry_open_path, [ - #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]) -]) -EXTRA_KCFLAGS="$tmp_flags" -]) # LC_DENTRY_OPEN_USE_PATH - -# -# LC_HAVE_IOP_ATOMIC_OPEN -# -# 3.6 vfs adds iop->atomic_open -# -AC_DEFUN([LC_HAVE_IOP_ATOMIC_OPEN], [ -LB_CHECK_COMPILE([if 'iop' has 'atomic_open'], -inode_ops_atomic_open, [ - #include -],[ - struct inode_operations iop; - iop.atomic_open = NULL; -],[ - AC_DEFINE(HAVE_IOP_ATOMIC_OPEN, 1, - [have iop atomic_open]) -]) -]) # LC_HAVE_IOP_ATOMIC_OPEN - -# -# LC_HAVE_SB_START_WRITE -# -# RHEL6 2.6.32, 3.6 or newer support wrapped FS freeze functions -# -AC_DEFUN([LC_HAVE_SB_START_WRITE], [ -LB_CHECK_COMPILE([if kernel supports wrapped FS freeze functions], -sb_start_write, [ - #include -],[ - sb_start_write(NULL); -],[ - AC_DEFINE(HAVE_SB_START_WRITE, 1, - [kernel supports wrapped FS freeze functions]) -]) -]) # LC_HAVE_SB_START_WRITE - -# -# LC_HAVE_POSIXACL_USER_NS -# -# 3.7 posix_acl_{to,from}_xattr take struct user_namespace -# -AC_DEFUN([LC_HAVE_POSIXACL_USER_NS], [ -LB_CHECK_COMPILE([if 'posix_acl_to_xattr' takes 'struct user_namespace'], -posix_acl_to_xattr_user_namespace, [ - #include - #include -],[ - posix_acl_to_xattr((struct user_namespace *)NULL, NULL, NULL, 0); -],[ - AC_DEFINE(HAVE_POSIXACL_USER_NS, 1, - [posix_acl_to_xattr takes struct user_namespace]) -]) -]) # LC_HAVE_POSIXACL_USER_NS - -# -# LC_HAVE_FILE_F_INODE -# -# 3.8 struct file has new member f_inode -# -AC_DEFUN([LC_HAVE_FILE_F_INODE], [ -LB_CHECK_COMPILE([if 'struct file' has member 'f_inode'], -file_f_inode, [ - #include -],[ - ((struct file *)0)->f_inode = NULL; -],[ - AC_DEFINE(HAVE_FILE_F_INODE, 1, - [struct file has member f_inode]) -]) -]) # LC_HAVE_FILE_F_INODE - -# -# LC_HAVE_FILE_INODE -# -# 3.8 has introduced inline function file_inode -# -AC_DEFUN([LC_HAVE_FILE_INODE], [ -LB_CHECK_COMPILE([if file_inode() exists], -file_inode, [ - #include -],[ - file_inode(NULL); -],[ - AC_DEFINE(HAVE_FILE_INODE, 1, - [file_inode() has been defined]) -]) -]) # LC_HAVE_FILE_INODE - -# -# LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS -# -AC_DEFUN([LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS], [ -LB_CHECK_COMPILE([if 'sunrpc_cache_pipe_upcall' takes 3 args], -sunrpc_cache_pipe_upcall_3args, [ - #include -],[ - sunrpc_cache_pipe_upcall(NULL, NULL, NULL); -],[ - AC_DEFINE(HAVE_SUNRPC_UPCALL_HAS_3ARGS, 1, - [sunrpc_cache_pipe_upcall takes 3 args]) -]) -]) # LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS - -# -# LC_HAVE_HLIST_FOR_EACH_3ARG -# -# 3.9 uses hlist_for_each_entry with 3 args -# b67bfe0d42cac56c512dd5da4b1b347a23f4b70a -# -AC_DEFUN([LC_HAVE_HLIST_FOR_EACH_3ARG], [ -LB_CHECK_COMPILE([if 'hlist_for_each_entry' has 3 args], -hlist_for_each_entry_3args, [ - #include - #include -],[ - struct hlist_head *head = NULL; - struct inode *inode; - - hlist_for_each_entry(inode, head, i_hash) { - continue; - } -],[ - AC_DEFINE(HAVE_HLIST_FOR_EACH_3ARG, 1, - [hlist_for_each_entry has 3 args]) -]) -]) # LC_HAVE_HLIST_FOR_EACH_3ARG - -# -# LC_HAVE_BIO_END_SECTOR -# -# 3.9 introduces bio_end_sector macro -# f73a1c7d117d07a96d89475066188a2b79e53c48 -# -AC_DEFUN([LC_HAVE_BIO_END_SECTOR], [ -LB_CHECK_COMPILE([if 'bio_end_sector' is defined], -bio_end_sector, [ - #include -],[ - struct bio bio = { }; - unsigned long long end; - - end = bio_end_sector(&bio); -],[ - AC_DEFINE(HAVE_BIO_END_SECTOR, 1, - [bio_end_sector is defined]) -]) -]) # LC_HAVE_BIO_END_SECTOR - -# -# 3.9 created is_sxid -# -AC_DEFUN([LC_HAVE_IS_SXID], [ -LB_CHECK_COMPILE([if 'is_sxid' is defined], -is_sxid, [ - #include -],[ - struct inode inode = { }; - - is_sxid(inode.i_mode); -],[ - AC_DEFINE(HAVE_IS_SXID, 1, [is_sxid is defined]) -]) -]) # LC_HAVE_IS_SXID - -# -# LC_HAVE_VFS_GETATTR_2ARGS -# -AC_DEFUN([LC_HAVE_VFS_GETATTR_2ARGS], [ -LB_CHECK_COMPILE([if vfs_getattr takes 2 args], -vfs_getattr, [ - #include -],[ - struct path path; - - vfs_getattr(&path, NULL); -],[ - AC_DEFINE(HAVE_VFS_GETATTR_2ARGS, 1, - [vfs_getattr takes 2 args]) -]) -]) # LC_HAVE_VFS_GETATTR_2ARGS - -# -# LC_HAVE_REMOVE_PROC_SUBTREE -# -# 3.10 introduced remove_proc_subtree -# -AC_DEFUN([LC_HAVE_REMOVE_PROC_SUBTREE], [ -LB_CHECK_COMPILE([if 'remove_proc_subtree' is defined], -remove_proc_subtree, [ - #include -],[ - remove_proc_subtree(NULL, NULL); -], [ - AC_DEFINE(HAVE_REMOVE_PROC_SUBTREE, 1, - [remove_proc_subtree is defined]) -]) -]) # LC_HAVE_REMOVE_PROC_SUBTREE - -# -# LC_HAVE_PROC_REMOVE -# -# 3.10 introduced proc_remove -# -AC_DEFUN([LC_HAVE_PROC_REMOVE], [ -LB_CHECK_COMPILE([if 'proc_remove' is defined], -proc_remove, [ - #include -],[ - proc_remove(NULL); -], [ - AC_DEFINE(HAVE_PROC_REMOVE, 1, - [proc_remove is defined]) -]) -]) # LC_HAVE_PROC_REMOVE - AC_DEFUN([LC_HAVE_PROJECT_QUOTA], [ LB_CHECK_COMPILE([if get_projid exists], get_projid, [ @@ -1107,39 +387,6 @@ get_projid, [ ]) ]) # LC_HAVE_PROJECT_QUOTA - -# -# LC_HAVE_SECURITY_DENTRY_INIT_SECURITY -# -# 3.10 introduced security_dentry_init_security() -# -AC_DEFUN([LC_HAVE_SECURITY_DENTRY_INIT_SECURITY], [ -LB_CHECK_COMPILE([if 'security_dentry_init_security' is defined], -security_dentry_init_security, [ - #include -],[ - security_dentry_init_security(NULL, 0, NULL, NULL, NULL); -],[ - AC_DEFINE(HAVE_SECURITY_DENTRY_INIT_SECURITY, 1, - [security_dentry_init_security' is defined]) -]) -]) # LC_HAVE_SECURITY_DENTRY_INIT_SECURITY - -# -# 3.10 exports security_inode_listsecurity -# -AC_DEFUN([LC_HAVE_SECURITY_INODE_LISTSECURITY], [ -LB_CHECK_COMPILE([if security_inode_listsecurity() is available/exported], -security_inode_listsecurity, [ - #include -],[ - security_inode_listsecurity(NULL, NULL, 0); -],[ - AC_DEFINE(HAVE_SECURITY_INODE_LISTSECURITY, 1, - [security_inode_listsecurity() is available/exported]) -]) -]) # LC_HAVE_SECURITY_INODE_LISTSECURITY - # # LC_INVALIDATE_RANGE # @@ -1908,32 +1155,6 @@ blk_integrity_interval_exp, [ ]) # LC_HAVE_INTERVAL_EXP_BLK_INTEGRITY # -# LC_HAVE_LOOP_CTL_GET_FREE -# -# 4.x kernel have moved userspace APIs to -# the separate directory and all of them -# support LOOP_CTL_GET_FREE -# -AC_DEFUN([LC_HAVE_LOOP_CTL_GET_FREE], [ -LB_CHECK_FILE([$LINUX/include/linux/loop.h], [ - LB_CHECK_COMPILE([if have 'HAVE_LOOP_CTL_GET_FREE'], - LOOP_CTL_GET_FREE, [ - #include - ],[ - int i; - - i = LOOP_CTL_GET_FREE; - ],[ - AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1, - [LOOP_CTL_GET_FREE exist]) - ]) -],[ - AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1, - [kernel has LOOP_CTL_GET_FREE]) -]) -]) # LC_HAVE_LOOP_CTL_GET_FREE - -# # LC_HAVE_CACHE_HEAD_HLIST # # 4.3 kernel swiched to hlist for cache_head @@ -2969,77 +2190,15 @@ AC_DEFUN([LC_PROG_LINUX], [ LC_CONFIG_FLOCK LC_CONFIG_HEALTH_CHECK_WRITE LC_CONFIG_LRU_RESIZE + LC_CONFIG_FHANDLE + LC_CONFIG_GSS LC_GLIBC_SUPPORT_FHANDLES - LC_CONFIG_GSS LC_OPENSSL_SSK LC_OPENSSL_GETSEPOL - # 2.6.39 - LC_HAVE_FHANDLE_SYSCALLS - LC_HAVE_FSTYPE_MOUNT - LC_HAVE_INODE_OWNER_OR_CAPABLE - LC_HAVE_SECURITY_IINITSEC - LC_VFS_CREATE_USE_NAMEIDATA - - # 3.0 - LC_DIRTY_INODE_WITH_FLAG - LC_SETNS - - # 3.1 - LC_LM_XXX_LOCK_MANAGER_OPS - LC_INODE_DIO_WAIT - LC_IOP_GET_ACL - LC_FILE_LLSEEK_SIZE - LC_INODE_PERMISION_2ARGS - LC_RADIX_EXCEPTION_ENTRY - LC_HAVE_LOOP_CTL_GET_FREE - - # 3.2 - LC_HAVE_PROTECT_I_NLINK - - # 3.3 - LC_HAVE_MIGRATE_HEADER - LC_MIGRATEPAGE_4ARGS - LC_SUPEROPS_USE_DENTRY - LC_INODEOPS_USE_UMODE_T - LC_HAVE_CACHE_REGISTER - - # 3.4 - LC_HAVE_D_MAKE_ROOT - LC_KMAP_ATOMIC_HAS_1ARG - - # 3.5 - LC_HAVE_CLEAR_INODE - LC_HAVE_ENCODE_FH_PARENT - LC_FILE_LLSEEK_SIZE_5ARG - - # 3.6 - LC_DATA_FOR_LLITE_IS_LIST - LC_DENTRY_OPEN_USE_PATH - LC_HAVE_IOP_ATOMIC_OPEN - LC_HAVE_SB_START_WRITE - - # 3.7 - LC_HAVE_POSIXACL_USER_NS - - # 3.8 - LC_HAVE_FILE_F_INODE - LC_HAVE_FILE_INODE - LC_HAVE_SUNRPC_UPCALL_HAS_3ARGS - - # 3.9 - LC_HAVE_HLIST_FOR_EACH_3ARG - LC_HAVE_BIO_END_SECTOR - LC_HAVE_IS_SXID - LC_HAVE_VFS_GETATTR_2ARGS - # 3.10 - LC_HAVE_REMOVE_PROC_SUBTREE - LC_HAVE_PROC_REMOVE LC_HAVE_PROJECT_QUOTA - LC_HAVE_SECURITY_DENTRY_INIT_SECURITY - LC_HAVE_SECURITY_INODE_LISTSECURITY # 3.11 LC_INVALIDATE_RANGE @@ -3182,6 +2341,7 @@ AC_DEFUN([LC_PROG_LINUX], [ LC___XA_SET_MARK LC_UAPI_LINUX_MOUNT_H LC_HAVE_SUNRPC_CACHE_HASH_LOCK_IS_A_SPINLOCK + LC_REPLACE_EXCEPTIONAL_ENTRIES # 5.1 LC_HAS_LINUX_SELINUX_ENABLED diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index feed2bd..93e7200 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -538,29 +538,6 @@ lprocfs_register(const char *name, struct proc_dir_entry *parent, extern void lprocfs_remove(struct proc_dir_entry **root); extern void lprocfs_remove_proc_entry(const char *name, struct proc_dir_entry *parent); -#ifndef HAVE_REMOVE_PROC_SUBTREE -extern int remove_proc_subtree(const char *name, - struct proc_dir_entry *parent); -#define PDE_DATA(inode) (PDE(inode)->data) - -static inline int LPROCFS_ENTRY_CHECK(struct inode *inode) -{ - struct proc_dir_entry *dp = PDE(inode); - int deleted = 0; - - spin_lock(&(dp)->pde_unload_lock); - if (dp->proc_fops == NULL) - deleted = 1; - spin_unlock(&(dp)->pde_unload_lock); - if (deleted) - return -ENODEV; - return 0; -} -#else -static inline int LPROCFS_ENTRY_CHECK(struct inode *inode) -{ return 0; } -#endif - extern int lprocfs_obd_setup(struct obd_device *obd, bool uuid_only); extern int lprocfs_obd_cleanup(struct obd_device *obd); #ifdef HAVE_SERVER_SUPPORT @@ -748,12 +725,6 @@ static const struct file_operations name##_fops = { \ #define __LPROC_SEQ_FOPS(name, custom_seq_write) \ static int name##_single_open(struct inode *inode, struct file *file) \ { \ - int rc; \ - \ - rc = LPROCFS_ENTRY_CHECK(inode); \ - if (rc < 0) \ - return rc; \ - \ return single_open(file, name##_seq_show, \ inode->i_private ? inode->i_private : \ PDE_DATA(inode)); \ diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h index 3ebef7a..1d16ac9 100644 --- a/lustre/include/lustre_compat.h +++ b/lustre/include/lustre_compat.h @@ -48,9 +48,6 @@ #include #include -#define current_ngroups current_cred()->group_info->ngroups -#define current_groups current_cred()->group_info->small_block - #ifdef HAVE_4ARGS_VFS_SYMLINK #define ll_vfs_symlink(dir, dentry, mnt, path, mode) \ vfs_symlink(dir, dentry, path, mode) @@ -59,22 +56,6 @@ vfs_symlink(dir, dentry, path) #endif -#if !defined(HAVE_FILE_LLSEEK_SIZE) || defined(HAVE_FILE_LLSEEK_SIZE_5ARGS) -#define ll_generic_file_llseek_size(file, offset, origin, maxbytes, eof) \ - generic_file_llseek_size(file, offset, origin, maxbytes, eof); -#else -#define ll_generic_file_llseek_size(file, offset, origin, maxbytes, eof) \ - generic_file_llseek_size(file, offset, origin, maxbytes); -#endif - -#ifdef HAVE_INODE_DIO_WAIT -/* inode_dio_wait(i) use as-is for write lock */ -# define inode_dio_write_done(i) do {} while (0) /* for write unlock */ -#else -# define inode_dio_wait(i) down_write(&(i)->i_alloc_sem) -# define inode_dio_write_done(i) up_write(&(i)->i_alloc_sem) -#endif - #ifndef HAVE_INIT_LIST_HEAD_RCU static inline void INIT_LIST_HEAD_RCU(struct list_head *list) { @@ -91,9 +72,6 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list) #define bio_idx(bio) (bio->bi_idx) #define bio_set_sector(bio, sector) (bio->bi_sector = sector) #define bio_sectors(bio) ((bio)->bi_size >> 9) -#ifndef HAVE_BIO_END_SECTOR -#define bio_end_sector(bio) (bio->bi_sector + bio_sectors(bio)) -#endif #define bvl_to_page(bvl) (bvl->bv_page) #endif @@ -103,18 +81,6 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list) #define bio_start_sector(bio) (bio->bi_sector) #endif -#ifdef HAVE_KMAP_ATOMIC_HAS_1ARG -#define ll_kmap_atomic(a, b) kmap_atomic(a) -#define ll_kunmap_atomic(a, b) kunmap_atomic(a) -#else -#define ll_kmap_atomic(a, b) kmap_atomic(a, b) -#define ll_kunmap_atomic(a, b) kunmap_atomic(a, b) -#endif - -#ifndef HAVE_CLEAR_INODE -#define clear_inode(i) end_writeback(i) -#endif - #ifndef HAVE_DENTRY_D_CHILD #define d_child d_u.d_child #endif @@ -123,29 +89,6 @@ static inline void INIT_LIST_HEAD_RCU(struct list_head *list) #define d_alias d_u.d_alias #endif -#ifndef DATA_FOR_LLITE_IS_LIST -#define ll_d_hlist_node hlist_node -#define ll_d_hlist_empty(list) hlist_empty(list) -#define ll_d_hlist_entry(ptr, type, name) hlist_entry(ptr.first, type, name) -#define ll_d_hlist_for_each(tmp, i_dentry) hlist_for_each(tmp, i_dentry) -# ifdef HAVE_HLIST_FOR_EACH_3ARG -# define ll_d_hlist_for_each_entry(dentry, p, i_dentry) \ - p = NULL; hlist_for_each_entry(dentry, i_dentry, d_alias) -# else -# define ll_d_hlist_for_each_entry(dentry, p, i_dentry) \ - hlist_for_each_entry(dentry, p, i_dentry, d_alias) -# endif -#define DECLARE_LL_D_HLIST_NODE_PTR(name) struct ll_d_hlist_node *name -#else -#define ll_d_hlist_node list_head -#define ll_d_hlist_empty(list) list_empty(list) -#define ll_d_hlist_entry(ptr, type, name) list_entry(ptr.next, type, name) -#define ll_d_hlist_for_each(tmp, i_dentry) list_for_each(tmp, i_dentry) -#define ll_d_hlist_for_each_entry(dentry, p, i_dentry) \ - list_for_each_entry(dentry, i_dentry, d_alias) -#define DECLARE_LL_D_HLIST_NODE_PTR(name) /* nothing */ -#endif /* !DATA_FOR_LLITE_IS_LIST */ - #ifndef HAVE_D_IN_LOOKUP static inline int d_in_lookup(struct dentry *dentry) { @@ -153,119 +96,14 @@ static inline int d_in_lookup(struct dentry *dentry) } #endif -#ifndef QUOTA_OK -# define QUOTA_OK 0 -#endif -#ifndef NO_QUOTA -# define NO_QUOTA (-EDQUOT) -#endif - -#ifndef SEEK_DATA -#define SEEK_DATA 3 /* seek to the next data */ -#endif -#ifndef SEEK_HOLE -#define SEEK_HOLE 4 /* seek to the next hole */ -#endif - -#ifndef FMODE_UNSIGNED_OFFSET -#define FMODE_UNSIGNED_OFFSET ((__force fmode_t)0x2000) -#endif - -#if !defined(_ASM_GENERIC_BITOPS_EXT2_NON_ATOMIC_H_) && !defined(ext2_set_bit) -# define ext2_set_bit __test_and_set_bit_le -# define ext2_clear_bit __test_and_clear_bit_le -# define ext2_test_bit test_bit_le -# define ext2_find_first_zero_bit find_first_zero_bit_le -# define ext2_find_next_zero_bit find_next_zero_bit_le -#endif - -#ifdef ATTR_TIMES_SET -# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) -#else -# define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET) -#endif - -#ifndef XATTR_NAME_POSIX_ACL_ACCESS -# define XATTR_NAME_POSIX_ACL_ACCESS POSIX_ACL_XATTR_ACCESS -#endif - -#ifndef XATTR_NAME_POSIX_ACL_DEFAULT -# define XATTR_NAME_POSIX_ACL_DEFAULT POSIX_ACL_XATTR_DEFAULT -#endif - -#ifndef HAVE_LM_XXX_LOCK_MANAGER_OPS -# define lm_compare_owner fl_compare_owner -#endif - -/* - * After 3.1, kernel's nameidata.intent.open.flags is different - * with lustre's lookup_intent.it_flags, as lustre's it_flags' - * lower bits equal to FMODE_xxx while kernel doesn't transliterate - * lower bits of nameidata.intent.open.flags to FMODE_xxx. - * */ -#include -static inline int ll_namei_to_lookup_intent_flag(int flag) -{ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 1, 0) - flag = (flag & ~O_ACCMODE) | OPEN_FMODE(flag); -#endif - return flag; -} - -#include -#ifndef HAVE_PROTECT_I_NLINK -static inline void set_nlink(struct inode *inode, unsigned int nlink) -{ - inode->i_nlink = nlink; -} -#endif - -#ifdef HAVE_INODEOPS_USE_UMODE_T -# define ll_umode_t umode_t -#else -# define ll_umode_t int -#endif - #ifndef HAVE_VM_FAULT_T #define vm_fault_t int #endif -#include -#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 - #ifndef HAVE_FOP_ITERATE_SHARED #define iterate_shared iterate #endif -#ifdef HAVE_DIRTY_INODE_HAS_FLAG -# define ll_dirty_inode(inode, flag) (inode)->i_sb->s_op->dirty_inode((inode), flag) -#else -# define ll_dirty_inode(inode, flag) (inode)->i_sb->s_op->dirty_inode((inode)) -#endif - -#ifdef HAVE_FILE_F_INODE -# define set_file_inode(file, inode) (file)->f_inode = inode -#else -# define set_file_inode(file, inode) -#endif - -#ifndef HAVE_FILE_INODE -static inline struct inode *file_inode(const struct file *file) -{ - return file->f_path.dentry->d_inode; -} -#endif - #ifdef HAVE_OLDSIZE_TRUNCATE_PAGECACHE #define ll_truncate_pagecache(inode, size) truncate_pagecache(inode, 0, size) #else @@ -286,20 +124,14 @@ static inline struct inode *file_inode(const struct file *file) #define ll_vfs_unlink(a, b) vfs_unlink(a, b) #endif -#ifndef HAVE_INODE_OWNER_OR_CAPABLE -#define inode_owner_or_capable(inode) is_owner_or_cap(inode) -#endif - static inline int ll_vfs_getattr(struct path *path, struct kstat *st) { int rc; #ifdef HAVE_INODEOPS_ENHANCED_GETATTR rc = vfs_getattr(path, st, STATX_BASIC_STATS, AT_STATX_SYNC_AS_STAT); -#elif defined HAVE_VFS_GETATTR_2ARGS - rc = vfs_getattr(path, st); #else - rc = vfs_getattr(path->mnt, path->dentry, st); + rc = vfs_getattr(path, st); #endif return rc; } @@ -311,25 +143,12 @@ static inline bool d_is_positive(const struct dentry *dentry) } #endif -#ifdef HAVE_VFS_CREATE_USE_NAMEIDATA -# define LL_VFS_CREATE_FALSE NULL -#else -# define LL_VFS_CREATE_FALSE false -#endif - #ifndef HAVE_INODE_LOCK # define inode_lock(inode) mutex_lock(&(inode)->i_mutex) # define inode_unlock(inode) mutex_unlock(&(inode)->i_mutex) # define inode_trylock(inode) mutex_trylock(&(inode)->i_mutex) #endif -#ifndef HAVE_RADIX_EXCEPTION_ENTRY -static inline int radix_tree_exceptional_entry(void *arg) -{ - return 0; -} -#endif - #ifndef HAVE_XA_IS_VALUE static inline bool xa_is_value(void *entry) { @@ -354,35 +173,6 @@ static inline int __must_check PTR_ERR_OR_ZERO(__force const void *ptr) } #endif -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - -#ifdef HAVE_SECURITY_IINITSEC_CALLBACK -# define ll_security_inode_init_security(inode, dir, name, value, len, \ - initxattrs, dentry) \ - security_inode_init_security(inode, dir, &((dentry)->d_name), \ - initxattrs, dentry) -#elif defined HAVE_SECURITY_IINITSEC_QSTR -# define ll_security_inode_init_security(inode, dir, name, value, len, \ - initxattrs, dentry) \ - security_inode_init_security(inode, dir, &((dentry)->d_name), \ - name, value, len) -#else /* !HAVE_SECURITY_IINITSEC_CALLBACK && !HAVE_SECURITY_IINITSEC_QSTR */ -# define ll_security_inode_init_security(inode, dir, name, value, len, \ - initxattrs, dentry) \ - security_inode_init_security(inode, dir, name, value, len) -#endif - -#ifndef bio_for_each_segment_all /* since kernel version 3.9 */ -#ifdef HAVE_BVEC_ITER -#define bio_for_each_segment_all(bv, bio, it) \ - for (it = 0, bv = (bio)->bi_io_vec; it < (bio)->bi_vcnt; it++, bv++) -#else -#define bio_for_each_segment_all(bv, bio, it) bio_for_each_segment(bv, bio, it) -#endif -#endif - #ifdef HAVE_PID_NS_FOR_CHILDREN # define ll_task_pid_ns(task) \ ((task)->nsproxy ? ((task)->nsproxy->pid_ns_for_children) : NULL) @@ -436,16 +226,6 @@ __vfs_setxattr(struct dentry *dentry, struct inode *inode, const char *name, } #endif /* HAVE_VFS_SETXATTR */ -#ifndef HAVE_POSIXACL_USER_NS -/* - * Mask out &init_user_ns so we don't jump - * through hoops to define it somehow only - * to have it ignored anyway. - */ -#define posix_acl_from_xattr(a, b, c) posix_acl_from_xattr(b, c) -#define posix_acl_to_xattr(a, b, c, d) posix_acl_to_xattr(b, c, d) -#endif - #ifndef HAVE_POSIX_ACL_VALID_USER_NS #define posix_acl_valid(a,b) posix_acl_valid(b) #endif @@ -482,17 +262,6 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count) } #endif -#ifndef HAVE_IS_SXID -static inline bool is_sxid(umode_t mode) -{ - return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); -} -#endif - -#ifndef IS_NOSEC -#define IS_NOSEC(inode) (!is_sxid(inode->i_mode)) -#endif - /* * mount MS_* flags split from superblock SB_* flags * if the SB_* flags are not available use the MS_* flags @@ -634,41 +403,10 @@ static inline struct timespec current_time(struct inode *inode) } #endif -#ifndef time_after32 -/** - * time_after32 - compare two 32-bit relative times - * @a: the time which may be after @b - * @b: the time which may be before @a - * - * time_after32(a, b) returns true if the time @a is after time @b. - * time_before32(b, a) returns true if the time @b is before time @a. - * - * Similar to time_after(), compare two 32-bit timestamps for relative - * times. This is useful for comparing 32-bit seconds values that can't - * be converted to 64-bit values (e.g. due to disk format or wire protocol - * issues) when it is known that the times are less than 68 years apart. - */ -#define time_after32(a, b) ((s32)((u32)(b) - (u32)(a)) < 0) -#define time_before32(b, a) time_after32(a, b) - -#endif - -#ifndef __GFP_COLD -#define __GFP_COLD 0 -#endif - -#ifndef alloc_workqueue -#define alloc_workqueue(name, flags, max_active) create_workqueue(name) -#endif - #ifndef smp_store_mb #define smp_store_mb(var, value) set_mb(var, value) #endif -#ifndef READ_ONCE -#define READ_ONCE ACCESS_ONCE -#endif - #if IS_ENABLED(CONFIG_BLK_DEV_INTEGRITY) static inline unsigned short blk_integrity_interval(struct blk_integrity *bi) { diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c index d8ed9d4..50bea97 100644 --- a/lustre/llite/dcache.c +++ b/lustre/llite/dcache.c @@ -224,7 +224,6 @@ void ll_intent_release(struct lookup_intent *it) void ll_invalidate_aliases(struct inode *inode) { struct dentry *dentry; - DECLARE_LL_D_HLIST_NODE_PTR(p); ENTRY; LASSERT(inode != NULL); @@ -233,7 +232,7 @@ void ll_invalidate_aliases(struct inode *inode) PFID(ll_inode2fid(inode)), inode); spin_lock(&inode->i_lock); - ll_d_hlist_for_each_entry(dentry, p, &inode->i_dentry) { + hlist_for_each_entry(dentry, &inode->i_dentry, d_alias) { CDEBUG(D_DENTRY, "dentry in drop %.*s (%p) parent %p " "inode %p flags %d\n", dentry->d_name.len, dentry->d_name.name, dentry, dentry->d_parent, @@ -292,6 +291,9 @@ static int ll_revalidate_dentry(struct dentry *dentry, { struct inode *dir = dentry->d_parent->d_inode; + CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n", + dentry->d_name.name, lookup_flags); + /* If this is intermediate component path lookup and we were able to get * to this dentry, then its lock has not been revoked and the * path component is valid. */ @@ -324,44 +326,8 @@ static int ll_revalidate_dentry(struct dentry *dentry, return 1; } -/* - * Always trust cached dentries. Update statahead window if necessary. - */ -#ifdef HAVE_IOP_ATOMIC_OPEN -static int ll_revalidate_nd(struct dentry *dentry, unsigned int flags) -{ - int rc; - ENTRY; - - CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n", - dentry->d_name.name, flags); - - rc = ll_revalidate_dentry(dentry, flags); - RETURN(rc); -} -#else -static int ll_revalidate_nd(struct dentry *dentry, struct nameidata *nd) -{ - int rc; - ENTRY; - - /* - * this is normally called from NFS export, and we don't know whether - * this is the last component. - */ - if (nd == NULL) - RETURN(1); - - CDEBUG(D_VFSTRACE, "VFS Op:name=%s, flags=%u\n", - dentry->d_name.name, nd->flags); - - rc = ll_revalidate_dentry(dentry, nd->flags); - RETURN(rc); -} -#endif - const struct dentry_operations ll_d_ops = { - .d_revalidate = ll_revalidate_nd, + .d_revalidate = ll_revalidate_dentry, .d_release = ll_release, .d_delete = ll_ddelete, .d_compare = ll_dcompare, diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 7c683b7..48ce0ac 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -422,14 +422,14 @@ static inline int ll_dom_readpage(void *data, struct page *page) struct niobuf_local *lnb = data; void *kaddr; - kaddr = ll_kmap_atomic(page, KM_USER0); + kaddr = kmap_atomic(page); memcpy(kaddr, lnb->lnb_data, lnb->lnb_len); if (lnb->lnb_len < PAGE_SIZE) memset(kaddr + lnb->lnb_len, 0, PAGE_SIZE - lnb->lnb_len); flush_dcache_page(page); SetPageUptodate(page); - ll_kunmap_atomic(kaddr, KM_USER0); + kunmap_atomic(kaddr); unlock_page(page); return 0; @@ -3981,73 +3981,6 @@ out_state: } } -#ifndef HAVE_FILE_LLSEEK_SIZE -static inline loff_t -llseek_execute(struct file *file, loff_t offset, loff_t maxsize) -{ - if (offset < 0 && !(file->f_mode & FMODE_UNSIGNED_OFFSET)) - return -EINVAL; - if (offset > maxsize) - return -EINVAL; - - if (offset != file->f_pos) { - file->f_pos = offset; - file->f_version = 0; - } - return offset; -} - -static loff_t -generic_file_llseek_size(struct file *file, loff_t offset, int origin, - loff_t maxsize, loff_t eof) -{ - struct inode *inode = file_inode(file); - - switch (origin) { - case SEEK_END: - offset += eof; - break; - case SEEK_CUR: - /* - * Here we special-case the lseek(fd, 0, SEEK_CUR) - * position-querying operation. Avoid rewriting the "same" - * f_pos value back to the file because a concurrent read(), - * write() or lseek() might have altered it - */ - if (offset == 0) - return file->f_pos; - /* - * f_lock protects against read/modify/write race with other - * SEEK_CURs. Note that parallel writes and reads behave - * like SEEK_SET. - */ - inode_lock(inode); - offset = llseek_execute(file, file->f_pos + offset, maxsize); - inode_unlock(inode); - return offset; - case SEEK_DATA: - /* - * In the generic case the entire file is data, so as long as - * offset isn't at the end of the file then the offset is data. - */ - if (offset >= eof) - return -ENXIO; - break; - case SEEK_HOLE: - /* - * There is a virtual hole at the end of the file, so as long as - * offset isn't i_size or larger, return i_size. - */ - if (offset >= eof) - return -ENXIO; - offset = eof; - break; - } - - return llseek_execute(file, offset, maxsize); -} -#endif - static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) { struct inode *inode = file_inode(file); @@ -4068,8 +4001,8 @@ static loff_t ll_file_seek(struct file *file, loff_t offset, int origin) eof = i_size_read(inode); } - retval = ll_generic_file_llseek_size(file, offset, origin, - ll_file_maxbytes(inode), eof); + retval = generic_file_llseek_size(file, offset, origin, + ll_file_maxbytes(inode), eof); if (retval >= 0) ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LLSEEK, ktime_us_delta(ktime_get(), kstart)); @@ -5104,9 +5037,7 @@ struct inode_operations ll_file_inode_operations = { #endif .listxattr = ll_listxattr, .fiemap = ll_fiemap, -#ifdef HAVE_IOP_GET_ACL .get_acl = ll_get_acl, -#endif #ifdef HAVE_IOP_SET_ACL .set_acl = ll_set_acl, #endif diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index 0782a84..4dac661 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -73,6 +73,8 @@ #define LL_IT2STR(it) ((it) ? ldlm_it2str((it)->it_op) : "0") +#define TIMES_SET_FLAGS (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET) + struct ll_dentry_data { struct lookup_intent *lld_it; unsigned int lld_sa_generation; @@ -403,19 +405,19 @@ int ll_xattr_cache_get(struct inode *inode, static inline bool obd_connect_has_secctx(struct obd_connect_data *data) { -#if defined(HAVE_SECURITY_DENTRY_INIT_SECURITY) && defined(CONFIG_SECURITY) +#ifdef CONFIG_SECURITY return data->ocd_connect_flags & OBD_CONNECT_FLAGS2 && data->ocd_connect_flags2 & OBD_CONNECT2_FILE_SECCTX; #else return false; -#endif /* HAVE_SECURITY_DENTRY_INIT_SECURITY */ +#endif } static inline void obd_connect_set_secctx(struct obd_connect_data *data) { -#if defined(HAVE_SECURITY_DENTRY_INIT_SECURITY) && defined(CONFIG_SECURITY) +#ifdef CONFIG_SECURITY data->ocd_connect_flags2 |= OBD_CONNECT2_FILE_SECCTX; -#endif /* HAVE_SECURITY_DENTRY_INIT_SECURITY */ +#endif } int ll_dentry_init_security(struct dentry *dentry, int mode, struct qstr *name, @@ -1092,11 +1094,7 @@ int ll_iocontrol(struct inode *inode, struct file *file, int ll_flush_ctx(struct inode *inode); void ll_umount_begin(struct super_block *sb); int ll_remount_fs(struct super_block *sb, int *flags, char *data); -#ifdef HAVE_SUPEROPS_USE_DENTRY int ll_show_options(struct seq_file *seq, struct dentry *dentry); -#else -int ll_show_options(struct seq_file *seq, struct vfsmount *vfs); -#endif void ll_dirty_page_discard_warn(struct page *page, int ioret); int ll_prep_inode(struct inode **inode, struct ptlrpc_request *req, struct super_block *, struct lookup_intent *); diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c index 5527d84..56204a12 100644 --- a/lustre/llite/llite_lib.c +++ b/lustre/llite/llite_lib.c @@ -1775,11 +1775,8 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr *attr, (s64)attr->ia_mtime.tv_sec, (s64)attr->ia_ctime.tv_sec, ktime_get_real_seconds()); - if (S_ISREG(inode->i_mode)) { - if (attr->ia_valid & ATTR_SIZE) - inode_dio_write_done(inode); + if (S_ISREG(inode->i_mode)) inode_unlock(inode); - } /* We always do an MDS RPC, even if we're only changing the size; * only the MDS knows whether truncate() should fail with -ETXTBUSY */ @@ -2759,21 +2756,12 @@ void ll_finish_md_op_data(struct md_op_data *op_data) OBD_FREE_PTR(op_data); } -#ifdef HAVE_SUPEROPS_USE_DENTRY int ll_show_options(struct seq_file *seq, struct dentry *dentry) -#else -int ll_show_options(struct seq_file *seq, struct vfsmount *vfs) -#endif { struct ll_sb_info *sbi; -#ifdef HAVE_SUPEROPS_USE_DENTRY - LASSERT((seq != NULL) && (dentry != NULL)); + LASSERT(seq && dentry); sbi = ll_s2sbi(dentry->d_sb); -#else - LASSERT((seq != NULL) && (vfs != NULL)); - sbi = ll_s2sbi(vfs->mnt_sb); -#endif if (sbi->ll_flags & LL_SBI_NOLCK) seq_puts(seq, ",nolock"); diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c index 6f0d511..e079eb4 100644 --- a/lustre/llite/llite_nfs.c +++ b/lustre/llite/llite_nfs.c @@ -177,17 +177,9 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren * 2 -- contains child file handle and parent file handle; * 255 -- error. */ -#ifndef HAVE_ENCODE_FH_PARENT -static int ll_encode_fh(struct dentry *de, u32 *fh, int *plen, - int connectable) -{ - struct inode *inode = de->d_inode; - struct inode *parent = de->d_parent->d_inode; -#else static int ll_encode_fh(struct inode *inode, u32 *fh, int *plen, struct inode *parent) { -#endif int fileid_len = sizeof(struct lustre_file_handle) / 4; struct lustre_file_handle *lfh = (void *)fh; diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c index edcaade..8098f27 100644 --- a/lustre/llite/namei.c +++ b/lustre/llite/namei.c @@ -157,10 +157,9 @@ struct inode *ll_iget(struct super_block *sb, ino_t hash, static void ll_invalidate_negative_children(struct inode *dir) { struct dentry *dentry, *tmp_subdir; - DECLARE_LL_D_HLIST_NODE_PTR(p); spin_lock(&dir->i_lock); - ll_d_hlist_for_each_entry(dentry, p, &dir->i_dentry) { + hlist_for_each_entry(dentry, &dir->i_dentry, d_alias) { spin_lock(&dentry->d_lock); if (!list_empty(&dentry->d_subdirs)) { struct dentry *child; @@ -538,15 +537,14 @@ void ll_i2gids(__u32 *suppgids, struct inode *i1, struct inode *i2) static struct dentry *ll_find_alias(struct inode *inode, struct dentry *dentry) { struct dentry *alias, *discon_alias, *invalid_alias; - DECLARE_LL_D_HLIST_NODE_PTR(p); - if (ll_d_hlist_empty(&inode->i_dentry)) + if (hlist_empty(&inode->i_dentry)) return NULL; discon_alias = invalid_alias = NULL; spin_lock(&inode->i_lock); - ll_d_hlist_for_each_entry(alias, p, &inode->i_dentry) { + hlist_for_each_entry(alias, &inode->i_dentry, d_alias) { LASSERT(alias != dentry); spin_lock(&alias->d_lock); @@ -921,7 +919,6 @@ out: return retval; } -#ifdef HAVE_IOP_ATOMIC_OPEN static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, unsigned int flags) { @@ -1119,111 +1116,6 @@ out_release: RETURN(rc); } -#else /* !HAVE_IOP_ATOMIC_OPEN */ -static struct lookup_intent * -ll_convert_intent(struct open_intent *oit, int lookup_flags, bool is_readonly) -{ - struct lookup_intent *it; - - OBD_ALLOC_PTR(it); - if (!it) - return ERR_PTR(-ENOMEM); - - if (lookup_flags & LOOKUP_OPEN) { - it->it_op = IT_OPEN; - /* Avoid file creation for ro bind mount point(is_readonly) */ - if ((lookup_flags & LOOKUP_CREATE) && !is_readonly) - it->it_op |= IT_CREAT; - it->it_create_mode = (oit->create_mode & S_IALLUGO) | S_IFREG; - it->it_flags = ll_namei_to_lookup_intent_flag(oit->flags & - ~(is_readonly ? O_CREAT : 0)); - it->it_flags &= ~MDS_OPEN_FL_INTERNAL; - } else { - it->it_op = IT_GETATTR; - } - - return it; -} - -static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry, - struct nameidata *nd) -{ - struct dentry *de; - ENTRY; - - if (nd && !(nd->flags & (LOOKUP_CONTINUE|LOOKUP_PARENT))) { - struct lookup_intent *it; - - if (ll_d2d(dentry) && ll_d2d(dentry)->lld_it) { - it = ll_d2d(dentry)->lld_it; - ll_d2d(dentry)->lld_it = NULL; - } else { - /* - * Optimize away (CREATE && !OPEN). Let .create handle - * the race. But only if we have write permissions - * there, otherwise we need to proceed with lookup. - * LU-4185 - */ - if ((nd->flags & LOOKUP_CREATE) && - !(nd->flags & LOOKUP_OPEN) && - (inode_permission(parent, - MAY_WRITE | MAY_EXEC) == 0)) - RETURN(NULL); - - it = ll_convert_intent(&nd->intent.open, nd->flags, - (nd->path.mnt->mnt_flags & MNT_READONLY) || - (nd->path.mnt->mnt_sb->s_flags & SB_RDONLY)); - if (IS_ERR(it)) - RETURN((struct dentry *)it); - } - - de = ll_lookup_it(parent, dentry, it, NULL, NULL, NULL); - if (de) - dentry = de; - if ((nd->flags & LOOKUP_OPEN) && !IS_ERR(dentry)) { /* Open */ - if (dentry->d_inode && - it_disposition(it, DISP_OPEN_OPEN)) { /* nocreate */ - if (S_ISFIFO(dentry->d_inode->i_mode)) { - /* We cannot call open here as it might - * deadlock. This case is unreachable in - * practice because of - * OBD_CONNECT_NODEVOH. */ - } else { - struct file *filp; - - nd->intent.open.file->private_data = it; - filp = lookup_instantiate_filp(nd, - dentry, - NULL); - if (IS_ERR(filp)) { - if (de) - dput(de); - de = (struct dentry *)filp; - } - } - } else if (it_disposition(it, DISP_OPEN_CREATE)) { - /* XXX This can only reliably work on assumption - * that there are NO hashed negative dentries.*/ - ll_d2d(dentry)->lld_it = it; - it = NULL; /* Will be freed in ll_create_nd */ - /* We absolutely depend on ll_create_nd to be - * called to not leak this intent and possible - * data attached to it */ - } - } - - if (it) { - ll_intent_release(it); - OBD_FREE(it, sizeof(*it)); - } - } else { - de = ll_lookup_it(parent, dentry, NULL, NULL, NULL, NULL); - } - - RETURN(de); -} -#endif /* HAVE_IOP_ATOMIC_OPEN */ - /* We depend on "mode" being set with the proper file type/umask by now */ static struct inode *ll_create_node(struct inode *dir, struct lookup_intent *it) { @@ -1478,7 +1370,7 @@ err_exit: return err; } -static int ll_mknod(struct inode *dir, struct dentry *dchild, ll_umode_t mode, +static int ll_mknod(struct inode *dir, struct dentry *dchild, umode_t mode, dev_t rdev) { struct qstr *name = &dchild->d_name; @@ -1519,7 +1411,6 @@ static int ll_mknod(struct inode *dir, struct dentry *dchild, ll_umode_t mode, RETURN(err); } -#ifdef HAVE_IOP_ATOMIC_OPEN /* * Plain create. Intent create is handled in atomic_open. */ @@ -1549,59 +1440,6 @@ static int ll_create_nd(struct inode *dir, struct dentry *dentry, return rc; } -#else /* !HAVE_IOP_ATOMIC_OPEN */ -static int ll_create_nd(struct inode *dir, struct dentry *dentry, - ll_umode_t mode, struct nameidata *nd) -{ - struct ll_dentry_data *lld = ll_d2d(dentry); - struct lookup_intent *it = NULL; - ktime_t kstart = ktime_get(); - int rc; - - CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_CREATE_FILE_PAUSE, cfs_fail_val); - - if (lld != NULL) - it = lld->lld_it; - - if (!it) { - /* LU-8559: use LUSTRE_OPC_CREATE for non atomic open case - * so that volatile file name is recoginized. - * Mknod(2), however, is designed to not recognize volatile - * file name to avoid inode leak under orphan directory until - * MDT reboot */ - return ll_new_node(dir, dentry, NULL, mode, 0, - LUSTRE_OPC_CREATE); - } - - lld->lld_it = NULL; - - /* Was there an error? Propagate it! */ - if (it->it_status) { - rc = it->it_status; - goto out; - } - - rc = ll_create_it(dir, dentry, it, NULL, 0); - if (nd && (nd->flags & LOOKUP_OPEN) && dentry->d_inode) { /* Open */ - struct file *filp; - - nd->intent.open.file->private_data = it; - filp = lookup_instantiate_filp(nd, dentry, NULL); - if (IS_ERR(filp)) - rc = PTR_ERR(filp); - } - -out: - ll_intent_release(it); - OBD_FREE(it, sizeof(*it)); - - if (!rc) - ll_stats_ops_tally(ll_i2sbi(dir), LPROC_LL_CREATE, - ktime_us_delta(ktime_get(), kstart)); - - return rc; -} -#endif /* HAVE_IOP_ATOMIC_OPEN */ static int ll_symlink(struct inode *dir, struct dentry *dchild, const char *oldpath) @@ -1660,7 +1498,7 @@ out: RETURN(err); } -static int ll_mkdir(struct inode *dir, struct dentry *dchild, ll_umode_t mode) +static int ll_mkdir(struct inode *dir, struct dentry *dchild, umode_t mode) { struct qstr *name = &dchild->d_name; ktime_t kstart = ktime_get(); @@ -1870,9 +1708,7 @@ static int ll_rename(struct inode *src, struct dentry *src_dchild, const struct inode_operations ll_dir_inode_operations = { .mknod = ll_mknod, -#ifdef HAVE_IOP_ATOMIC_OPEN .atomic_open = ll_atomic_open, -#endif .lookup = ll_lookup_nd, .create = ll_create_nd, /* We need all these non-raw things for NFSD, to not patch it. */ @@ -1891,9 +1727,7 @@ const struct inode_operations ll_dir_inode_operations = { .removexattr = ll_removexattr, #endif .listxattr = ll_listxattr, -#ifdef HAVE_IOP_GET_ACL .get_acl = ll_get_acl, -#endif #ifdef HAVE_IOP_SET_ACL .set_acl = ll_set_acl, #endif @@ -1909,9 +1743,7 @@ const struct inode_operations ll_special_inode_operations = { .removexattr = ll_removexattr, #endif .listxattr = ll_listxattr, -#ifdef HAVE_IOP_GET_ACL .get_acl = ll_get_acl, -#endif #ifdef HAVE_IOP_SET_ACL .set_acl = ll_set_acl, #endif diff --git a/lustre/llite/pcc.c b/lustre/llite/pcc.c index 8ab41b4..eeae234 100644 --- a/lustre/llite/pcc.c +++ b/lustre/llite/pcc.c @@ -1494,13 +1494,8 @@ int pcc_file_open(struct inode *inode, struct file *file) CDEBUG(D_CACHE, "opening pcc file '%.*s'\n", dname->len, dname->name); -#ifdef HAVE_DENTRY_OPEN_USE_PATH pcc_file = dentry_open(path, file->f_flags, pcc_super_cred(inode->i_sb)); -#else - pcc_file = dentry_open(path->dentry, path->mnt, file->f_flags, - pcc_super_cred(inode->i_sb)); -#endif if (IS_ERR_OR_NULL(pcc_file)) { rc = pcc_file == NULL ? -EINVAL : PTR_ERR(pcc_file); pcc_inode_put(pcci); @@ -2197,7 +2192,7 @@ pcc_create(struct dentry *base, const char *name, umode_t mode) if (d_is_positive(dentry)) goto out; - rc = vfs_create(dir, dentry, mode, LL_VFS_CREATE_FALSE); + rc = vfs_create(dir, dentry, mode, false); if (rc) { dput(dentry); dentry = ERR_PTR(rc); @@ -2472,12 +2467,7 @@ int pcc_readwrite_attach(struct file *file, struct inode *inode, path.mnt = dataset->pccd_path.mnt; path.dentry = dentry; -#ifdef HAVE_DENTRY_OPEN_USE_PATH pcc_filp = dentry_open(&path, O_WRONLY | O_LARGEFILE, current_cred()); -#else - pcc_filp = dentry_open(path.dentry, path.mnt, O_WRONLY | O_LARGEFILE, - current_cred()); -#endif if (IS_ERR_OR_NULL(pcc_filp)) { rc = pcc_filp == NULL ? -EINVAL : PTR_ERR(pcc_filp); GOTO(out_dentry, rc); diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index c719dae..7507d6e 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -44,12 +44,7 @@ #include #include #include - -#ifdef HAVE_MIGRATE_H #include -#elif defined(HAVE_MIGRATE_MODE_H) -#include -#endif #define DEBUG_SUBSYSTEM S_LLITE @@ -570,10 +565,10 @@ static int ll_prepare_partial_page(const struct lu_env *env, struct cl_io *io, * purposes here we can treat it like i_size. */ if (attr->cat_kms <= offset) { - char *kaddr = ll_kmap_atomic(vpg->vpg_page, KM_USER0); + char *kaddr = kmap_atomic(vpg->vpg_page); memset(kaddr, 0, cl_page_size(obj)); - ll_kunmap_atomic(kaddr, KM_USER0); + kunmap_atomic(kaddr); GOTO(out, result = 0); } @@ -866,11 +861,8 @@ out: #ifdef CONFIG_MIGRATION static int ll_migratepage(struct address_space *mapping, - struct page *newpage, struct page *page -#ifdef HAVE_MIGRATEPAGE_4ARGS - , enum migrate_mode mode -#endif - ) + struct page *newpage, struct page *page, + enum migrate_mode mode) { /* Always fail page migration until we have a proper implementation */ return -EIO; diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index fe49b59..c29c51a 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -753,7 +753,6 @@ static void vvp_io_setattr_end(const struct lu_env *env, /* Truncate in memory pages - they must be clean pages * because osc has already notified to destroy osc_extents. */ vvp_do_vmtruncate(inode, io->u.ci_setattr.sa_attr.lvb_size); - inode_dio_write_done(inode); inode_unlock(inode); trunc_sem_up_write(&lli->lli_trunc_sem); } else { diff --git a/lustre/llite/xattr_security.c b/lustre/llite/xattr_security.c index e2bfe61..f1c1ed9 100644 --- a/lustre/llite/xattr_security.c +++ b/lustre/llite/xattr_security.c @@ -54,7 +54,6 @@ int ll_dentry_init_security(struct dentry *dentry, int mode, struct qstr *name, const char **secctx_name, void **secctx, __u32 *secctx_size) { -#ifdef HAVE_SECURITY_DENTRY_INIT_SECURITY int rc; /* @@ -82,14 +81,12 @@ int ll_dentry_init_security(struct dentry *dentry, int mode, struct qstr *name, return rc; *secctx_name = XATTR_NAME_SELINUX; -#endif /* HAVE_SECURITY_DENTRY_INIT_SECURITY */ return 0; } -#ifdef HAVE_SECURITY_IINITSEC_CALLBACK /** - * A helper function for ll_security_inode_init_security() + * A helper function for security_inode_init_security() * that takes care of setting xattrs * * Get security context of @inode from @xattr_array, @@ -146,59 +143,13 @@ ll_inode_init_security(struct dentry *dentry, struct inode *inode, if (!selinux_is_enabled()) return 0; - rc = ll_security_inode_init_security(inode, dir, NULL, NULL, 0, - &ll_initxattrs, dentry); + rc = security_inode_init_security(inode, dir, NULL, + &ll_initxattrs, dentry); if (rc == -EOPNOTSUPP) return 0; return rc; } -#else /* !HAVE_SECURITY_IINITSEC_CALLBACK */ -/** - * Initializes security context - * - * Get security context of @inode in @dir, - * and put it in 'security.xxx' xattr of @dentry. - * - * \retval 0 success, or SELinux is disabled - * \retval -ENOMEM if no memory could be allocated for xattr name - * \retval < 0 failure to get security context or set xattr - */ -int -ll_inode_init_security(struct dentry *dentry, struct inode *inode, - struct inode *dir) -{ - char *full_name; - void *value; - char *name; - size_t len; - int err; - - if (!selinux_is_enabled()) - return 0; - - err = ll_security_inode_init_security(inode, dir, &name, &value, &len, - NULL, dentry); - if (err != 0) { - if (err == -EOPNOTSUPP) - return 0; - return err; - } - - full_name = kasprintf(GFP_KERNEL, "%s%s", XATTR_SECURITY_PREFIX, name); - if (!full_name) - GOTO(out_free, err = -ENOMEM); - - err = __vfs_setxattr(dentry, inode, full_name, value, len, - XATTR_CREATE); - kfree(full_name); -out_free: - kfree(name); - kfree(value); - - return err; -} -#endif /* HAVE_SECURITY_IINITSEC_CALLBACK */ /** * Get security context xattr name used by policy. @@ -214,21 +165,10 @@ ll_listsecurity(struct inode *inode, char *secctx_name, size_t secctx_name_size) if (!selinux_is_enabled()) return 0; -#ifdef HAVE_SECURITY_INODE_LISTSECURITY rc = security_inode_listsecurity(inode, secctx_name, secctx_name_size); if (rc >= secctx_name_size) rc = -ERANGE; else if (rc >= 0) secctx_name[rc] = '\0'; return rc; -#else /* !HAVE_SECURITY_INODE_LISTSECURITY */ - rc = sizeof(XATTR_NAME_SELINUX); - if (secctx_name && rc < secctx_name_size) { - memcpy(secctx_name, XATTR_NAME_SELINUX, rc); - secctx_name[rc] = '\0'; - } else { - rc = -ERANGE; - } - return rc; -#endif /* HAVE_SECURITY_INODE_LISTSECURITY */ } diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 4e503fe..f20f101 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -542,6 +542,9 @@ static int mdc_unpack_acl(struct ptlrpc_request *req, struct lustre_md *md) #else #define mdc_unpack_acl(req, md) 0 #endif +#ifdef HAVE_XA_IS_VALUE +# include +#endif int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req, struct obd_export *dt_exp, struct obd_export *md_exp, @@ -1348,8 +1351,7 @@ static int mdc_read_page_remote(void *data, struct page *page0) } for (npages = 1; npages < max_pages; npages++) { - page = __page_cache_alloc(mapping_gfp_mask(inode->i_mapping) - | __GFP_COLD); + page = page_cache_alloc(inode->i_mapping); if (page == NULL) break; page_pool[npages] = page; diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c index 8a24d05..4725f77 100644 --- a/lustre/obdclass/llog.c +++ b/lustre/obdclass/llog.c @@ -265,7 +265,7 @@ int llog_cancel_arr_rec(const struct lu_env *env, struct llog_handle *loghandle, CERROR("Can't cancel index 0 which is header\n"); GOTO(out_unlock, rc = -EINVAL); } - if (!ext2_clear_bit(index[i], LLOG_HDR_BITMAP(llh))) { + if (!__test_and_clear_bit_le(index[i], LLOG_HDR_BITMAP(llh))) { CDEBUG(D_RPCTRACE, "Catalog index %u already clear?\n", index[i]); GOTO(out_unlock, rc = -ENOENT); @@ -323,7 +323,7 @@ out_trans: if (subtract_count) loghandle->lgh_hdr->llh_count += num; for (i = i - 1; i >= 0; i--) - ext2_set_bit(index[i], LLOG_HDR_BITMAP(llh)); + set_bit_le(index[i], LLOG_HDR_BITMAP(llh)); mutex_unlock(&loghandle->lgh_hdr_mutex); } RETURN(rc); @@ -371,7 +371,7 @@ int llog_read_header(const struct lu_env *env, struct llog_handle *handle, memset(LLOG_HDR_BITMAP(llh), 0, llh->llh_hdr.lrh_len - llh->llh_bitmap_offset - sizeof(llh->llh_tail)); - ext2_set_bit(0, LLOG_HDR_BITMAP(llh)); + set_bit_le(0, LLOG_HDR_BITMAP(llh)); LLOG_HDR_TAIL(llh)->lrt_len = llh->llh_hdr.lrh_len; LLOG_HDR_TAIL(llh)->lrt_index = llh->llh_hdr.lrh_index; rc = 0; @@ -505,7 +505,7 @@ static int llog_process_thread(void *arg) /* skip records not set in bitmap */ while (index <= last_index && - !ext2_test_bit(index, LLOG_HDR_BITMAP(llh))) + !test_bit_le(index, LLOG_HDR_BITMAP(llh))) ++index; /* There are no indices prior the last_index */ @@ -647,7 +647,7 @@ repeat: chunk_offset; /* if set, process the callback on this record */ - if (ext2_test_bit(index, LLOG_HDR_BITMAP(llh))) { + if (test_bit_le(index, LLOG_HDR_BITMAP(llh))) { struct llog_cookie *lgc; __u64 tmp_off; int tmp_idx; @@ -729,7 +729,7 @@ out: "plain"), index, llh->llh_count); while (index <= last_index) { - if (ext2_test_bit(index, + if (test_bit_le(index, LLOG_HDR_BITMAP(llh)) != 0) llog_cancel_rec(lpi->lpi_env, loghandle, index); @@ -899,7 +899,7 @@ int llog_reverse_process(const struct lu_env *env, /* skip records not set in bitmap */ while (index >= first_index && - !ext2_test_bit(index, LLOG_HDR_BITMAP(llh))) + !test_bit_le(index, LLOG_HDR_BITMAP(llh))) --index; LASSERT(index >= first_index - 1); @@ -930,7 +930,7 @@ int llog_reverse_process(const struct lu_env *env, GOTO(out, rc = 0); /* no more records */ /* if set, process the callback on this record */ - if (ext2_test_bit(index, LLOG_HDR_BITMAP(llh))) { + if (test_bit_le(index, LLOG_HDR_BITMAP(llh))) { rec = (void *)tail - tail->lrt_len + sizeof(*tail); diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index 1369f53..4843ae4 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -1130,7 +1130,7 @@ static int llog_cat_set_first_idx(struct llog_handle *cathandle, int idx) while (idx != cathandle->lgh_last_idx) { idx = (idx + 1) % bitmap_size; - if (!ext2_test_bit(idx, LLOG_HDR_BITMAP(llh))) { + if (!test_bit_le(idx, LLOG_HDR_BITMAP(llh))) { /* update llh_cat_idx for each unset bit, * expecting the next one is set */ llh->llh_cat_idx = idx; diff --git a/lustre/obdclass/llog_osd.c b/lustre/obdclass/llog_osd.c index 798451f..4bcc402 100644 --- a/lustre/obdclass/llog_osd.c +++ b/lustre/obdclass/llog_osd.c @@ -437,7 +437,7 @@ static int llog_osd_write_rec(const struct lu_env *env, /* llog can be empty only when first record is being written */ LASSERT(ergo(idx > 0, lgi->lgi_attr.la_size > 0)); - if (!ext2_test_bit(idx, LLOG_HDR_BITMAP(llh))) { + if (!test_bit_le(idx, LLOG_HDR_BITMAP(llh))) { CERROR("%s: modify unset record %u\n", o->do_lu.lo_dev->ld_obd->obd_name, idx); RETURN(-ENOENT); @@ -611,7 +611,7 @@ static int llog_osd_write_rec(const struct lu_env *env, /* the lgh_hdr_mutex protects llog header data from concurrent * update/cancel, the llh_count and llh_bitmap are protected */ mutex_lock(&loghandle->lgh_hdr_mutex); - if (ext2_set_bit(index, LLOG_HDR_BITMAP(llh))) { + if (__test_and_set_bit_le(index, LLOG_HDR_BITMAP(llh))) { CERROR("%s: index %u already set in log bitmap\n", o->do_lu.lo_dev->ld_obd->obd_name, index); mutex_unlock(&loghandle->lgh_hdr_mutex); @@ -722,7 +722,7 @@ out_unlock: out: /* cleanup llog for error case */ mutex_lock(&loghandle->lgh_hdr_mutex); - ext2_clear_bit(index, LLOG_HDR_BITMAP(llh)); + clear_bit_le(index, LLOG_HDR_BITMAP(llh)); llh->llh_count--; mutex_unlock(&loghandle->lgh_hdr_mutex); diff --git a/lustre/obdclass/llog_test.c b/lustre/obdclass/llog_test.c index ac66301..7e14fde 100644 --- a/lustre/obdclass/llog_test.c +++ b/lustre/obdclass/llog_test.c @@ -67,7 +67,7 @@ static int verify_handle(char *test, struct llog_handle *llh, int num_recs) int active_recs = 0; for (i = 0; i < LLOG_HDR_BITMAP_SIZE(llh->lgh_hdr); i++) { - if (ext2_test_bit(i, LLOG_HDR_BITMAP(llh->lgh_hdr))) { + if (test_bit_le(i, LLOG_HDR_BITMAP(llh->lgh_hdr))) { last_idx = i; active_recs++; } diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c index 24b057d..e4aad7f 100644 --- a/lustre/obdclass/lprocfs_jobstats.c +++ b/lustre/obdclass/lprocfs_jobstats.c @@ -486,10 +486,6 @@ static int lprocfs_jobstats_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc; - rc = LPROCFS_ENTRY_CHECK(inode); - if (rc < 0) - return rc; - rc = seq_open(file, &lprocfs_jobstats_seq_sops); if (rc) return rc; diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 717c272..9399453 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -207,103 +207,6 @@ lprocfs_add_vars(struct proc_dir_entry *root, struct lprocfs_vars *list, } EXPORT_SYMBOL(lprocfs_add_vars); -#ifndef HAVE_REMOVE_PROC_SUBTREE -/* for b=10866, global variable */ -DECLARE_RWSEM(_lprocfs_lock); -EXPORT_SYMBOL(_lprocfs_lock); - -static void lprocfs_remove_nolock(struct proc_dir_entry **proot) -{ - struct proc_dir_entry *root = *proot; - struct proc_dir_entry *temp = root; - struct proc_dir_entry *rm_entry; - struct proc_dir_entry *parent; - - *proot = NULL; - if (!root || IS_ERR(root)) - return; - - parent = root->parent; - LASSERT(parent != NULL); - - while (1) { - while (temp->subdir) - temp = temp->subdir; - - rm_entry = temp; - temp = temp->parent; - - /* - * Memory corruption once caused this to fail, and - * without this LASSERT we would loop here forever. - */ - LASSERTF(strlen(rm_entry->name) == rm_entry->namelen, - "0x%p %s/%s len %d\n", rm_entry, temp->name, - rm_entry->name, (int)strlen(rm_entry->name)); - - remove_proc_entry(rm_entry->name, temp); - if (temp == parent) - break; - } -} - -int remove_proc_subtree(const char *name, struct proc_dir_entry *parent) -{ - struct proc_dir_entry *t = NULL; - struct proc_dir_entry **p; - int len, busy = 0; - - LASSERT(parent != NULL); - len = strlen(name); - - down_write(&_lprocfs_lock); - /* lookup target name */ - for (p = &parent->subdir; *p; p = &(*p)->next) { - if ((*p)->namelen != len) - continue; - if (memcmp(name, (*p)->name, len)) - continue; - t = *p; - break; - } - - if (t) { - /* verify it's empty: do not count "num_refs" */ - for (p = &t->subdir; *p; p = &(*p)->next) { - if ((*p)->namelen != strlen("num_refs")) { - busy = 1; - break; - } - if (memcmp("num_refs", (*p)->name, - strlen("num_refs"))) { - busy = 1; - break; - } - } - } - - if (busy == 0) - lprocfs_remove_nolock(&t); - - up_write(&_lprocfs_lock); - return 0; -} -#endif /* !HAVE_REMOVE_PROC_SUBTREE */ - -#ifndef HAVE_PROC_REMOVE -void proc_remove(struct proc_dir_entry *de) -{ -#ifndef HAVE_REMOVE_PROC_SUBTREE - down_write(&_lprocfs_lock); /* search vs remove race */ - lprocfs_remove_nolock(&de); - up_write(&_lprocfs_lock); -#else - if (de) - remove_proc_subtree(de->name, de->parent); -#endif -} -#endif - void lprocfs_remove(struct proc_dir_entry **rooth) { proc_remove(*rooth); @@ -1547,10 +1450,6 @@ static int lprocfs_stats_seq_open(struct inode *inode, struct file *file) struct seq_file *seq; int rc; - rc = LPROCFS_ENTRY_CHECK(inode); - if (rc < 0) - return rc; - rc = seq_open(file, &lprocfs_stats_seq_sops); if (rc) return rc; diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index 1d37c9d..0d27e95 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -1702,19 +1702,11 @@ void lustre_register_super_ops(struct module *mod, EXPORT_SYMBOL(lustre_register_super_ops); /***************** FS registration ******************/ -#ifdef HAVE_FSTYPE_MOUNT static struct dentry *lustre_mount(struct file_system_type *fs_type, int flags, const char *devname, void *data) { return mount_nodev(fs_type, flags, data, lustre_fill_super); } -#else -static int lustre_get_sb(struct file_system_type *fs_type, int flags, - const char *devname, void *data, struct vfsmount *mnt) -{ - return get_sb_nodev(fs_type, flags, data, lustre_fill_super, mnt); -} -#endif static void lustre_kill_super(struct super_block *sb) { @@ -1740,11 +1732,7 @@ static void lustre_kill_super(struct super_block *sb) static struct file_system_type lustre_fs_type_tgt = { .owner = THIS_MODULE, .name = "lustre_tgt", -#ifdef HAVE_FSTYPE_MOUNT .mount = lustre_mount, -#else - .get_sb = lustre_get_sb, -#endif .kill_sb = lustre_kill_super, .fs_flags = FS_REQUIRES_DEV | FS_RENAME_DOES_D_MOVE, }; @@ -1772,11 +1760,7 @@ do { \ static struct file_system_type lustre_fs_type = { .owner = THIS_MODULE, .name = "lustre", -#ifdef HAVE_FSTYPE_MOUNT .mount = lustre_mount, -#else - .get_sb = lustre_get_sb, -#endif .kill_sb = lustre_kill_super, .fs_flags = FS_RENAME_DOES_D_MOVE, }; diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index d3854db..cff638f 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -1723,23 +1723,13 @@ static int server_statfs(struct dentry *dentry, struct kstatfs *buf) RETURN(0); } -#ifdef HAVE_SUPEROPS_USE_DENTRY int server_show_options(struct seq_file *seq, struct dentry *dentry) -#else -int server_show_options(struct seq_file *seq, struct vfsmount *vfs) -#endif { struct lustre_sb_info *lsi; struct lustre_mount_data *lmd; -#ifdef HAVE_SUPEROPS_USE_DENTRY LASSERT(seq != NULL && dentry != NULL); lsi = s2lsi(dentry->d_sb); -#else - LASSERT(seq != NULL && vfs != NULL); - lsi = s2lsi(vfs->mnt_sb); -#endif - lmd = lsi->lsi_lmd; seq_printf(seq, ",svname=%s", lmd->lmd_profile); diff --git a/lustre/osc/osc_cache.c b/lustre/osc/osc_cache.c index 51b9905..be0a875 100644 --- a/lustre/osc/osc_cache.c +++ b/lustre/osc/osc_cache.c @@ -2395,7 +2395,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io, qid[USRQUOTA] = attr->cat_uid; qid[GRPQUOTA] = attr->cat_gid; qid[PRJQUOTA] = attr->cat_projid; - if (rc == 0 && osc_quota_chkdq(cli, qid) == NO_QUOTA) + if (rc == 0 && osc_quota_chkdq(cli, qid) == -EDQUOT) rc = -EDQUOT; if (rc) RETURN(rc); diff --git a/lustre/osc/osc_quota.c b/lustre/osc/osc_quota.c index a0aaae7..4320ae4 100644 --- a/lustre/osc/osc_quota.c +++ b/lustre/osc/osc_quota.c @@ -61,11 +61,11 @@ int osc_quota_chkdq(struct client_obd *cli, const unsigned int qid[]) * quota space on this OST */ CDEBUG(D_QUOTA, "chkdq found noquota for %s %d\n", type == USRQUOTA ? "user" : "grout", qid[type]); - RETURN(NO_QUOTA); + RETURN(-EDQUOT); } } - RETURN(QUOTA_OK); + RETURN(0); } static inline u32 md_quota_flag(int qtype) diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 6152adf..1fcf3d7 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1446,13 +1446,13 @@ no_bulk: LASSERT((pga[0]->flag & OBD_BRW_SRVLOCK) == (pg->flag & OBD_BRW_SRVLOCK)); if (short_io_size != 0 && opc == OST_WRITE) { - unsigned char *ptr = ll_kmap_atomic(pg->pg, KM_USER0); + unsigned char *ptr = kmap_atomic(pg->pg); LASSERT(short_io_size >= requested_nob + pg->count); memcpy(short_io_buf + requested_nob, ptr + poff, pg->count); - ll_kunmap_atomic(ptr, KM_USER0); + kunmap_atomic(ptr); } else if (short_io_size == 0) { desc->bd_frag_ops->add_kiov_frag(desc, pg->pg, poff, pg->count); @@ -1826,10 +1826,10 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) CDEBUG(D_CACHE, "page %p count %d\n", aa->aa_ppga[i]->pg, count); - ptr = ll_kmap_atomic(aa->aa_ppga[i]->pg, KM_USER0); + ptr = kmap_atomic(aa->aa_ppga[i]->pg); memcpy(ptr + (aa->aa_ppga[i]->off & ~PAGE_MASK), buf, count); - ll_kunmap_atomic((void *) ptr, KM_USER0); + kunmap_atomic((void *) ptr); buf += count; nob -= count; diff --git a/lustre/osd-ldiskfs/osd_handler.c b/lustre/osd-ldiskfs/osd_handler.c index 13e710c..51dae97 100644 --- a/lustre/osd-ldiskfs/osd_handler.c +++ b/lustre/osd-ldiskfs/osd_handler.c @@ -1013,7 +1013,7 @@ again: filp->f_op = fops; filp->private_data = NULL; filp->f_cred = current_cred(); - set_file_inode(filp, inode); + filp->f_inode = inode; rc = osd_security_file_alloc(filp); if (rc) goto out; @@ -1733,11 +1733,6 @@ static void osd_trans_commit_cb(struct super_block *sb, OBD_FREE_PTR(oh); } -#ifndef HAVE_SB_START_WRITE -# define sb_start_write(sb) do {} while (0) -# define sb_end_write(sb) do {} while (0) -#endif - static struct thandle *osd_trans_create(const struct lu_env *env, struct dt_device *d) { @@ -3039,7 +3034,7 @@ static int osd_attr_set(const struct lu_env *env, if (rc != 0) GOTO(out, rc); - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); osd_trans_exec_check(env, handle, OSD_OT_ATTR_SET); @@ -3346,7 +3341,7 @@ static void osd_attr_init(struct osd_thread_info *info, struct osd_object *obj, * enabled on ldiskfs (lquota takes care of it). */ LASSERTF(result == 0, "%d\n", result); - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); } attr->la_valid = valid; @@ -3608,7 +3603,7 @@ static int osd_destroy(const struct lu_env *env, struct dt_object *dt, spin_lock(&obj->oo_guard); clear_nlink(inode); spin_unlock(&obj->oo_guard); - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); } osd_trans_exec_op(env, th, OSD_OT_DESTROY); @@ -4104,7 +4099,7 @@ static int osd_ref_add(const struct lu_env *env, struct dt_object *dt, } spin_unlock(&obj->oo_guard); - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); LINVRNT(osd_invariant(obj)); osd_trans_exec_check(env, th, OSD_OT_REF_ADD); @@ -4177,7 +4172,7 @@ static int osd_ref_del(const struct lu_env *env, struct dt_object *dt, ldiskfs_dec_count(oh->ot_handle, inode); spin_unlock(&obj->oo_guard); - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); LINVRNT(osd_invariant(obj)); osd_trans_exec_check(env, th, OSD_OT_REF_DEL); @@ -4594,7 +4589,7 @@ static int osd_xattr_set(const struct lu_env *env, struct dt_object *dt, * Version is set after all inode operations are finished, * so we should mark it dirty here */ - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); RETURN(0); } @@ -4777,7 +4772,7 @@ static int osd_object_sync(const struct lu_env *env, struct dt_object *dt, file->f_path.dentry = dentry; file->f_mapping = inode->i_mapping; file->f_op = inode->i_fop; - set_file_inode(file, inode); + file->f_inode = inode; rc = vfs_fsync_range(file, start, end, 0); @@ -6460,7 +6455,7 @@ static struct dt_it *osd_it_ea_init(const struct lu_env *env, file->f_path.dentry = obj_dentry; file->f_mapping = obj->oo_inode->i_mapping; file->f_op = obj->oo_inode->i_fop; - set_file_inode(file, obj->oo_inode); + file->f_inode = obj->oo_inode; lu_object_get(lo); RETURN((struct dt_it *)oie); diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 5752917..7c47013 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -572,6 +572,8 @@ struct osd_iobuf { int osd_security_file_alloc(struct file *file); +#define osd_dirty_inode(inode, flag) (inode)->i_sb->s_op->dirty_inode((inode), flag) + #ifdef HAVE_INODE_TIMESPEC64 # define osd_timespec timespec64 # define osd_timespec_trunc(ts, gran) timespec64_trunc((ts), (gran)) @@ -702,6 +704,7 @@ struct osd_thread_info { extern int ldiskfs_pdo; +/* autoconf test is in lustre-build-ldiskfs.m4 */ #ifdef HAVE_BVEC_ITER_ALL #define DECLARE_BVEC_ITER_ALL(iter) struct bvec_iter_all iter #else diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 64b995d..26d9c3b 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -1307,7 +1307,7 @@ static int osd_write_commit(const struct lu_env *env, struct dt_object *dt, i_size_write(inode, isize); LDISKFS_I(inode)->i_disksize = isize; spin_unlock(&inode->i_lock); - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); } else { spin_unlock(&inode->i_lock); } @@ -1676,7 +1676,7 @@ static int osd_ldiskfs_writelink(struct inode *inode, char *buffer, int buflen) LDISKFS_I(inode)->i_disksize = buflen; i_size_write(inode, buflen); spin_unlock(&inode->i_lock); - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); return 0; } @@ -1817,7 +1817,7 @@ static int osd_ldiskfs_write_record(struct dt_object *dt, void *buf, } spin_unlock(&inode->i_lock); if (dirty_inode) - ll_dirty_inode(inode, I_DIRTY_DATASYNC); + osd_dirty_inode(inode, I_DIRTY_DATASYNC); } if (err == 0) diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c index 628771a..bd46b9e 100644 --- a/lustre/osd-ldiskfs/osd_scrub.c +++ b/lustre/osd-ldiskfs/osd_scrub.c @@ -2265,7 +2265,7 @@ osd_ios_general_scan(struct osd_thread_info *info, struct osd_device *dev, filp->f_op = fops; filp->private_data = NULL; filp->f_cred = current_cred(); - set_file_inode(filp, inode); + filp->f_inode = inode; rc = osd_security_file_alloc(filp); if (rc) RETURN(rc); diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c index 204cf7c..b15e1d0 100644 --- a/lustre/ptlrpc/gss/gss_keyring.c +++ b/lustre/ptlrpc/gss/gss_keyring.c @@ -428,11 +428,11 @@ static void kill_key_locked(struct key *key) */ static void dispose_ctx_list_kr(struct hlist_head *freelist) { - struct hlist_node __maybe_unused *pos, *next; + struct hlist_node *next; struct ptlrpc_cli_ctx *ctx; struct gss_cli_ctx *gctx; - cfs_hlist_for_each_entry_safe(ctx, pos, next, freelist, cc_cache) { + hlist_for_each_entry_safe(ctx, next, freelist, cc_cache) { hlist_del_init(&ctx->cc_cache); /* reverse ctx: update current seq to buddy svcctx if exist. @@ -475,14 +475,12 @@ struct ptlrpc_cli_ctx * sec_lookup_root_ctx_kr(struct ptlrpc_sec *sec) ctx = gsec_kr->gsk_root_ctx; if (ctx == NULL && unlikely(sec_is_reverse(sec))) { - struct hlist_node __maybe_unused *node; struct ptlrpc_cli_ctx *tmp; /* reverse ctx, search root ctx in list, choose the one * with shortest expire time, which is most possibly have * an established peer ctx at client side. */ - cfs_hlist_for_each_entry(tmp, node, &gsec_kr->gsk_clist, - cc_cache) { + hlist_for_each_entry(tmp, &gsec_kr->gsk_clist, cc_cache) { if (ctx == NULL || ctx->cc_expire == 0 || ctx->cc_expire > tmp->cc_expire) { ctx = tmp; @@ -511,7 +509,6 @@ void rvs_sec_install_root_ctx_kr(struct ptlrpc_sec *sec, struct key *key) { struct gss_sec_keyring *gsec_kr = sec2gsec_keyring(sec); - struct hlist_node __maybe_unused *hnode; struct ptlrpc_cli_ctx *ctx; time64_t now; @@ -523,7 +520,7 @@ void rvs_sec_install_root_ctx_kr(struct ptlrpc_sec *sec, now = ktime_get_real_seconds(); /* set all existing ctxs short expiry */ - cfs_hlist_for_each_entry(ctx, hnode, &gsec_kr->gsk_clist, cc_cache) { + hlist_for_each_entry(ctx, &gsec_kr->gsk_clist, cc_cache) { if (ctx->cc_expire > now + RVS_CTX_EXPIRE_NICE) { ctx->cc_early_expire = 1; ctx->cc_expire = now + RVS_CTX_EXPIRE_NICE; @@ -982,15 +979,15 @@ void flush_spec_ctx_cache_kr(struct ptlrpc_sec *sec, uid_t uid, int grace, { struct gss_sec_keyring *gsec_kr; struct hlist_head freelist = HLIST_HEAD_INIT; - struct hlist_node __maybe_unused *pos, *next; + struct hlist_node *next; struct ptlrpc_cli_ctx *ctx; ENTRY; gsec_kr = sec2gsec_keyring(sec); spin_lock(&sec->ps_lock); - cfs_hlist_for_each_entry_safe(ctx, pos, next, - &gsec_kr->gsk_clist, cc_cache) { + hlist_for_each_entry_safe(ctx, next, &gsec_kr->gsk_clist, + cc_cache) { LASSERT(atomic_read(&ctx->cc_refcount) > 0); if (uid != -1 && uid != ctx->cc_vcred.vc_uid) @@ -1050,15 +1047,15 @@ void gss_sec_gc_ctx_kr(struct ptlrpc_sec *sec) { struct gss_sec_keyring *gsec_kr = sec2gsec_keyring(sec); struct hlist_head freelist = HLIST_HEAD_INIT; - struct hlist_node __maybe_unused *pos, *next; + struct hlist_node *next; struct ptlrpc_cli_ctx *ctx; ENTRY; CWARN("running gc\n"); spin_lock(&sec->ps_lock); - cfs_hlist_for_each_entry_safe(ctx, pos, next, - &gsec_kr->gsk_clist, cc_cache) { + hlist_for_each_entry_safe(ctx, next, &gsec_kr->gsk_clist, + cc_cache) { LASSERT(atomic_read(&ctx->cc_refcount) > 0); atomic_inc(&ctx->cc_refcount); @@ -1081,15 +1078,15 @@ static int gss_sec_display_kr(struct ptlrpc_sec *sec, struct seq_file *seq) { struct gss_sec_keyring *gsec_kr = sec2gsec_keyring(sec); - struct hlist_node __maybe_unused *pos, *next; + struct hlist_node *next; struct ptlrpc_cli_ctx *ctx; struct gss_cli_ctx *gctx; time64_t now = ktime_get_real_seconds(); ENTRY; spin_lock(&sec->ps_lock); - cfs_hlist_for_each_entry_safe(ctx, pos, next, - &gsec_kr->gsk_clist, cc_cache) { + hlist_for_each_entry_safe(ctx, next, &gsec_kr->gsk_clist, + cc_cache) { struct key *key; char flags_str[40]; char mech[40]; diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index 4b82735..bfbea7f 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -113,28 +113,6 @@ static inline unsigned long hash_mem(char *buf, int length, int bits) return hash >> (BITS_PER_LONG - bits); } -/* This compatibility can be removed once kernel 3.3 is used, - * since cache_register_net/cache_unregister_net are exported. - * Note that since kernel 3.4 cache_register and cache_unregister - * are removed. -*/ -static inline int _cache_register_net(struct cache_detail *cd, struct net *net) -{ -#ifdef HAVE_CACHE_REGISTER - return cache_register(cd); -#else - return cache_register_net(cd, net); -#endif -} -static inline void _cache_unregister_net(struct cache_detail *cd, - struct net *net) -{ -#ifdef HAVE_CACHE_REGISTER - cache_unregister(cd); -#else - cache_unregister_net(cd, net); -#endif -} /**************************************** * rpc sec init (rsi) cache * ****************************************/ @@ -220,19 +198,6 @@ static void rsi_request(struct cache_detail *cd, (*bpp)[-1] = '\n'; } -#ifdef HAVE_SUNRPC_UPCALL_HAS_3ARGS -static int rsi_upcall(struct cache_detail *cd, struct cache_head *h) -{ - return sunrpc_cache_pipe_upcall(cd, h, rsi_request); -} -#else - -static int rsi_upcall(struct cache_detail *cd, struct cache_head *h) -{ - return sunrpc_cache_pipe_upcall(cd, h); -} -#endif - static inline void __rsi_init(struct rsi *new, struct rsi *item) { new->out_handle = RAWOBJ_EMPTY; @@ -411,10 +376,8 @@ static struct cache_detail rsi_cache = { .hash_table = rsi_table, .name = "auth.sptlrpc.init", .cache_put = rsi_put, -#ifndef HAVE_SUNRPC_UPCALL_HAS_3ARGS .cache_request = rsi_request, -#endif - .cache_upcall = rsi_upcall, + .cache_upcall = sunrpc_cache_pipe_upcall, .cache_parse = rsi_parse, .match = rsi_match, .init = rsi_init, @@ -1120,13 +1083,13 @@ int __init gss_init_svc_upcall(void) */ get_random_bytes(&__ctx_index, sizeof(__ctx_index)); - rc = _cache_register_net(&rsi_cache, &init_net); + rc = cache_register_net(&rsi_cache, &init_net); if (rc != 0) return rc; - rc = _cache_register_net(&rsc_cache, &init_net); + rc = cache_register_net(&rsc_cache, &init_net); if (rc != 0) { - _cache_unregister_net(&rsi_cache, &init_net); + cache_unregister_net(&rsi_cache, &init_net); return rc; } @@ -1152,8 +1115,8 @@ int __init gss_init_svc_upcall(void) void gss_exit_svc_upcall(void) { cache_purge(&rsi_cache); - _cache_unregister_net(&rsi_cache, &init_net); + cache_unregister_net(&rsi_cache, &init_net); cache_purge(&rsc_cache); - _cache_unregister_net(&rsc_cache, &init_net); + cache_unregister_net(&rsc_cache, &init_net); } diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index 33824a7..30e5f07 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -1081,10 +1081,6 @@ ptlrpc_lprocfs_svc_req_history_open(struct inode *inode, struct file *file) struct seq_file *seqf; int rc; - rc = LPROCFS_ENTRY_CHECK(inode); - if (rc < 0) - return rc; - rc = seq_open(file, &sops); if (rc) return rc; diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index 5ead685..0e79684 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -2579,7 +2579,7 @@ int sptlrpc_current_user_desc_size(void) { int ngroups; - ngroups = current_ngroups; + ngroups = current_cred()->group_info->ngroups; if (ngroups > LUSTRE_MAX_GROUPS) ngroups = LUSTRE_MAX_GROUPS; @@ -2590,6 +2590,7 @@ EXPORT_SYMBOL(sptlrpc_current_user_desc_size); int sptlrpc_pack_user_desc(struct lustre_msg *msg, int offset) { struct ptlrpc_user_desc *pud; + int ngroups; pud = lustre_msg_buf(msg, offset, 0); @@ -2601,8 +2602,9 @@ int sptlrpc_pack_user_desc(struct lustre_msg *msg, int offset) pud->pud_ngroups = (msg->lm_buflens[offset] - sizeof(*pud)) / 4; task_lock(current); - if (pud->pud_ngroups > current_ngroups) - pud->pud_ngroups = current_ngroups; + ngroups = current_cred()->group_info->ngroups; + if (pud->pud_ngroups > ngroups) + pud->pud_ngroups = ngroups; #ifdef HAVE_GROUP_INFO_GID memcpy(pud->pud_groups, current_cred()->group_info->gid, pud->pud_ngroups * sizeof(__u32)); diff --git a/lustre/quota/lproc_quota.c b/lustre/quota/lproc_quota.c index cfe7b9b..977079f 100644 --- a/lustre/quota/lproc_quota.c +++ b/lustre/quota/lproc_quota.c @@ -300,10 +300,6 @@ static int lprocfs_quota_seq_open(struct inode *inode, struct file *file) goto out_lqp; } - rc = LPROCFS_ENTRY_CHECK(inode); - if (rc < 0) - goto out_env; - rc = seq_open(file, &lprocfs_quota_seq_sops); if (rc) goto out_env; diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index 0558a63..dd2ec2e 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -1769,13 +1769,12 @@ static int tgt_checksum_niobuf(struct lu_target *tgt, struct page *np = tgt_page_to_corrupt; if (np) { - char *ptr = ll_kmap_atomic(local_nb[i].lnb_page, - KM_USER0); + char *ptr = kmap_atomic(local_nb[i].lnb_page); char *ptr2 = page_address(np); memcpy(ptr2 + off, ptr + off, len); memcpy(ptr2 + off, "bad3", min(4, len)); - ll_kunmap_atomic(ptr, KM_USER0); + kunmap_atomic(ptr); /* LU-8376 to preserve original index for * display in dump_all_bulk_pages() */ @@ -1802,13 +1801,12 @@ static int tgt_checksum_niobuf(struct lu_target *tgt, struct page *np = tgt_page_to_corrupt; if (np) { - char *ptr = ll_kmap_atomic(local_nb[i].lnb_page, - KM_USER0); + char *ptr = kmap_atomic(local_nb[i].lnb_page); char *ptr2 = page_address(np); memcpy(ptr2 + off, ptr + off, len); memcpy(ptr2 + off, "bad4", min(4, len)); - ll_kunmap_atomic(ptr, KM_USER0); + kunmap_atomic(ptr); /* LU-8376 to preserve original index for * display in dump_all_bulk_pages() */ @@ -1957,9 +1955,9 @@ static int tgt_pages2shortio(struct niobuf_local *local, int npages, if (len > size) return -EINVAL; - ptr = ll_kmap_atomic(local[i].lnb_page, KM_USER0); + ptr = kmap_atomic(local[i].lnb_page); memcpy(buf + off, ptr, len); - ll_kunmap_atomic(ptr, KM_USER0); + kunmap_atomic(ptr); buf += len; size -= len; } @@ -2012,13 +2010,12 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt, struct page *np = tgt_page_to_corrupt; if (np) { - char *ptr = ll_kmap_atomic(local_nb[i].lnb_page, - KM_USER0); + char *ptr = kmap_atomic(local_nb[i].lnb_page); char *ptr2 = page_address(np); memcpy(ptr2 + off, ptr + off, len); memcpy(ptr2 + off, "bad3", min(4, len)); - ll_kunmap_atomic(ptr, KM_USER0); + kunmap_atomic(ptr); /* LU-8376 to preserve original index for * display in dump_all_bulk_pages() */ @@ -2093,13 +2090,12 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt, struct page *np = tgt_page_to_corrupt; if (np) { - char *ptr = ll_kmap_atomic(local_nb[i].lnb_page, - KM_USER0); + char *ptr = kmap_atomic(local_nb[i].lnb_page); char *ptr2 = page_address(np); memcpy(ptr2 + off, ptr + off, len); memcpy(ptr2 + off, "bad4", min(4, len)); - ll_kunmap_atomic(ptr, KM_USER0); + kunmap_atomic(ptr); /* LU-8376 to preserve original index for * display in dump_all_bulk_pages() */ @@ -2402,11 +2398,11 @@ static int tgt_shortio2pages(struct niobuf_local *local, int npages, CDEBUG(D_PAGE, "index %d offset = %d len = %d left = %d\n", i, off, len, size); - ptr = ll_kmap_atomic(local[i].lnb_page, KM_USER0); + ptr = kmap_atomic(local[i].lnb_page); if (ptr == NULL) return -EINVAL; memcpy(ptr + off, buf, len < size ? len : size); - ll_kunmap_atomic(ptr, KM_USER0); + kunmap_atomic(ptr); buf += len; size -= len; } diff --git a/lustre/utils/mount_utils.c b/lustre/utils/mount_utils.c index 5f3c296..64547eb 100644 --- a/lustre/utils/mount_utils.c +++ b/lustre/utils/mount_utils.c @@ -423,7 +423,6 @@ int loop_setup(struct mkfs_opts *mop) char cmd[PATH_MAX]; int cmdsz = sizeof(cmd); -#ifdef HAVE_LOOP_CTL_GET_FREE ret = open("/dev/loop-control", O_RDWR); if (ret < 0) { fprintf(stderr, "%s: can't access loop control\n", @@ -439,11 +438,7 @@ int loop_setup(struct mkfs_opts *mop) return EACCES; } sprintf(l_device, "%s%d", loop_base, i); -#else - sprintf(l_device, "%s%d", loop_base, i); - if (access(l_device, F_OK | R_OK)) - break; -#endif + snprintf(cmd, cmdsz, "losetup %s > /dev/null 2>&1", l_device); ret = system(cmd); -- 1.8.3.1