#include <linux/list.h>
-#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 */
])])
]) # 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
#
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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/radix-tree.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/security.h>
-],[
- 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 <linux/security.h>
- ],[
- 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 <linux/namei.h>
- #include <linux/fs.h>
-],[
- 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 <linux/fs.h>
-#ifdef HAVE_MIGRATE_H
- #include <linux/migrate.h>
-#elif defined(HAVE_MIGRATE_MODE_H)
- #include <linux/migrate_mode.h>
-#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 <linux/fs.h>
- 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 <linux/fs.h>
- #include <linux/types.h>
- 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 <linux/highmem.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/sunrpc/cache.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/exportfs.h>
- #include <linux/fs.h>
- #include <linux/types.h>
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
- #include <linux/path.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
- #include <linux/posix_acl_xattr.h>
-],[
- 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 <linux/fs.h>
-],[
- ((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 <linux/fs.h>
-],[
- 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 <linux/sunrpc/cache.h>
-],[
- 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 <linux/list.h>
- #include <linux/fs.h>
-],[
- 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 <linux/bio.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/fs.h>
-],[
- 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 <linux/proc_fs.h>
-],[
- 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 <linux/proc_fs.h>
-],[
- 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, [
])
]) # 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 <linux/security.h>
-],[
- 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 <linux/security.h>
-],[
- 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
#
]) # 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 <linux/loop.h>
- ],[
- 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
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
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
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
#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)); \
#include <libcfs/linux/linux-fs.h>
#include <obd_support.h>
-#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)
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)
{
#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
#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
#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)
{
}
#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 <linux/version.h>
-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 <linux/fs.h>
-#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 <linux/dcache.h>
-#ifndef HAVE_D_MAKE_ROOT
-static inline struct dentry *d_make_root(struct inode *root)
-{
- struct dentry *res = d_alloc_root(root);
-
- if (res == NULL && root)
- iput(root);
-
- return res;
-}
-#endif
-
#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
#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;
}
}
#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)
{
}
#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)
}
#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
}
#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
}
#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)
{
void ll_invalidate_aliases(struct inode *inode)
{
struct dentry *dentry;
- DECLARE_LL_D_HLIST_NODE_PTR(p);
ENTRY;
LASSERT(inode != NULL);
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,
{
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. */
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,
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;
}
}
-#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);
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));
#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
#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;
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,
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 *);
(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 */
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");
* 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;
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;
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);
return retval;
}
-#ifdef HAVE_IOP_ATOMIC_OPEN
static struct dentry *ll_lookup_nd(struct inode *parent, struct dentry *dentry,
unsigned int flags)
{
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)
{
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;
RETURN(err);
}
-#ifdef HAVE_IOP_ATOMIC_OPEN
/*
* Plain create. Intent create is handled in atomic_open.
*/
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)
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();
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. */
.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
.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
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);
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);
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);
#include <linux/string.h>
#include <linux/unistd.h>
#include <linux/writeback.h>
-
-#ifdef HAVE_MIGRATE_H
#include <linux/migrate.h>
-#elif defined(HAVE_MIGRATE_MODE_H)
-#include <linux/migrate_mode.h>
-#endif
#define DEBUG_SUBSYSTEM S_LLITE
* 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);
}
#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;
/* 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 {
const char **secctx_name, void **secctx,
__u32 *secctx_size)
{
-#ifdef HAVE_SECURITY_DENTRY_INIT_SECURITY
int rc;
/*
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,
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.
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 */
}
#else
#define mdc_unpack_acl(req, md) 0
#endif
+#ifdef HAVE_XA_IS_VALUE
+# include <linux/xarray.h>
+#endif
int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
struct obd_export *dt_exp, struct obd_export *md_exp,
}
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;
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);
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);
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;
/* 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 */
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;
"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);
/* 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);
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);
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;
/* 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);
/* 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);
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);
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++;
}
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;
}
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);
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;
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)
{
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,
};
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,
};
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);
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);
* 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)
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);
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;
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;
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)
{
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);
* 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;
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);
}
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);
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);
* 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);
}
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);
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);
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))
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
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);
}
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;
}
}
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)
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);
*/
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.
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;
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;
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;
{
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)
{
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);
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];
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 *
****************************************/
(*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;
.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,
*/
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;
}
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);
}
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;
{
int ngroups;
- ngroups = current_ngroups;
+ ngroups = current_cred()->group_info->ngroups;
if (ngroups > LUSTRE_MAX_GROUPS)
ngroups = LUSTRE_MAX_GROUPS;
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);
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));
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;
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() */
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() */
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;
}
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() */
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() */
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;
}
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",
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);