LU-2744 build: fix 'data race condition' issues

Fix 'data race condition' defects found by Coverity version
6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.

Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: Ie23e735c630b45006e02f6dd04e682dabffb844f
Reviewed-on: http://review.whamcloud.com/6571
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3483 llite: Null deref in ll_revalidate_nd on NFSmount

In calls to ll_revalidate_nd, the nameidata pointer nd is
sometimes null.  The core code of the function tests for
this case and handles it by calling ll_node_revalidate_it.
However, immediately before that code, there is a test to
see if the LOOKUP_RCU flag is set in nd->flags.  This test
does NOT check to see if the nd pointer is null.  Per
the comment, LOOKUP_RCU was added in kernel 2.6.38, and
this code is #ifdefed accordingly.
The fix is to test if nd is null in the LOOKUP_RCU check.

Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: I2b5d1718721f76943c3998f359dc83ad3a1590e6
Reviewed-on: http://review.whamcloud.com/6715
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Tested-by: Hudson
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3499 kernel: kernel update [SLES11 SP2 3.0.80-0.5]

Update of config and build file to new kernel version.

Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Change-Id: I1c65cff0fde98e602b0e50af05091610d20777bd
Reviewed-on: http://review.whamcloud.com/6805
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3503 test: only create single directory by test_mkdir()

Force test_mkdir() to create single directory instead of
multiple directories.

Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: I222f2bc5e6578b1cd8c4049a10f5ca1790c2c5ad
Reviewed-on: http://review.whamcloud.com/6796
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Robert Read <robert.read@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2800 autoconf: remove obsolete autoconf options

This commit combines 53 previous commits that only remove tests and
the corresponding dead code. The only exceptions are whitespace
removal in lustre/autoconf/lustre-core.m4 and removal of dead code
shrinking an if/else in lustre/llite/dir.c.

Summary follows:

autoconf: remove d_rehash_cond and __d_rehash tests

- d_rehash_cond and __d_rehash were never exported in a mainline
  release.

- A check of the RHEL6 and SLES11 SP2 sources shows they don't export
  them either.

autoconf: remove LC_TASK_CLENV_STORE

- LC_TASK_CLENV_STORE checks to see if task_struct->tux_info exists.

- That was only the case on RHEL5, so we can drop it. The rest of the
  code is untouched since liblustre uses the same infrastructure.

autoconf: remove filemap_populate, vm_ops->fault tests

- filemap_populate and the vm_ops->fault have been deprecated or
  removed since v2.6.23.

autoconf: remove LC_UMOUNTBEGIN_HAS_VFSMOUNT test

- super_operations.umount_begin has taken a super_block since v2.6.26.

autoconf: remove LC_CANCEL_DIRTY_PAGE test

- cancel_dirty_page was added in v2.6.20

autoconf: remove crypto API checks

- The block_cipher, hash_desc, and blkcipher_desc APIs have been
  added since v2.6.19.

autoconf: remove LC_KERNEL_SPLICE_READ test

- file_operations.splice_read has upstream since v2.6.23.

autoconf: remove LC_KERNEL_SENDFILE test

- file_operations.sendfile has been removed since v2.6.23.

- RHEL4 versions had both APIs, but RHEL4 has been out of scope
  for some time.

autoconf: remove LC_HAVE_EXPORTFS_H test

- <linux/exportfs.h> has been in the upstream kernel since v2.6.23.

autoconf: remove unused LC_EXPORTFS_DECODE_FH test

- exportfs_decode_fh has been upstream since v2.6.23.

autoconf: remove unused LC_HAVE_MMTYPES_H test

- <linux/mm_types.h> has been upstream since v2.6.24.

autoconf: remove LC_FH_TO_DENTRY test

- export_operations.fh_to_dentry has been upstream since v2.6.24.

autoconf: remove LC_EXPORT_BDI_INIT test

- bdi_init has been in the upstream kernel since v2.6.24.

autoconf: remove LC_PGMKWRITE_USE_VMFAULT test

- vm_ops->page_mkwrite has taken a vm_fault pointer since v2.6.27.

autoconf: remove LC_PGMKWRITE_COMPACT

- The vm_operation_struct._pmkw variant of page_mkwrite never
  existed upstream.

autoconf: remove LC_TRYLOCKPAGE test

- trylock_page has been in the upstream kernel since v2.6.27.

autoconf: remove unused LC_READ_INODE_IN_SBOPS test

- super_operations->read_inode hasn't been in the upstream kernel
  since v2.6.26.

autoconf: remove LC_EXPORT_INODE_PERMISSION test

- inode_permission has been in the upstream kernel since v2.6.27.

autoconf: remove LC_VFS_DQ_OFF test

- vfs_dq_off was in the upstream kernel from v2.6.27..v2.6.33

- Commit 86097b23 (LU-2642 quota: update quota APIs) introduced
  support for the APIs used in v2.6.34.

autoconf: remove LC_SB_HAS_QUOTA_ACTIVE test

- sb_has_quota_active has been in the upstream kernel since v2.6.29.

autoconf: remove LC_BDI_NAME test

- backing_dev_info.name has been in the upstream kernel since v2.6.32.

autoconf: remove LC_EXPORT_ADD_TO_PAGE_CACHE_LRU test

- add_to_page_cache_lru has been in the upstream kernel since v2.6.30.

- Also remove the now unused LC_PAGEVEC_LRU_ADD_FILE test.

autoconf: remove LC_SB_ANY_QUOTA_ACTIVE test

- sb_any_quota_active has been removed from the upstream kernel
  since v2.6.27.

autoconf: remove LC_BLK_QUEUE_LOG_BLK_SIZE test

- blk_queue_logical_block_size replaced blk_queue_hardsect_size
  in v2.6.31.

autoconf: remove LC_VFS_INODE_NEWSIZE_OK test

- inode_newsize_ok has been upstream since v2.6.32.

autoconf: remove LC_CACHE_UPCALL test

- cache_detail.cache_request was renamed to cache_detail.cache_upcall
  in v2.6.32.

autoconf: remove LC_REQUEST_QUEUE_LIMITS test

- request_queue.limits has been upstream since v2.6.32.

autoconf: remove LC_EXPORT_BDI_REGISTER test

- bdi_register has been upstream since v2.6.32.

autoconf: remove LC_SB_BDI test

- super_block.s_bdi was added to the upstream kernel in v2.6.32.

autoconf: remove LC_BLK_QUEUE_MAX_SECTORS test

- blk_queue_max_sectors was replaced with blk_queue_max_hw_sectors
  in v2.6.32.

autoconf: remove LC_EXPORT_GENERIC_ERROR_REMOVE_PAGE test

- generic_error_remove_page has been upstream since v2.6.32.

autoconf: remove LC_EXPORT_ACCESS_PROCESS_VM test

- access_process_vm has been exported from the kernel since v2.6.24.

autoconf: remove LC_SELINUX_IS_ENABLED test

- selinux_is_enabled has been in the upstream kernel since v2.6.32.

autoconf: remove LC_D_OBTAIN_ALIAS test

- d_obtain_alias has been upstream since v2.6.28.

autoconf: remove LC_WRITE_BEGIN_END test

- address_space_operations.write_begin/end have been upstream
  since v2.6.29.

autoconf: remove LC_DENTRY_OPEN_4ARGS test

- dentry_open took 4 arguments between v2.6.29..v3.5.

- The new 3 argument version is tested with LC_DENTRY_OPEN_USE_PATH.

autoconf: remove LIBCFS_TASKLIST_LOCK test

- tasklist_lock hasn't been exported since v2.6.18.

autoconf: remove LIBCFS_DIGEST_SETKEY_FLAGS test

- digest_alt.dia_setkey took 4 arguments from v2.6.18..v2.6.32.

- The code protected by this test was made obsolete by the
  LIBCFS_STRUCT_SHASH_ALG test.

autoconf: remove LIBCFS_KMEM_CACHE_DESTROY_INT test

- kmem_cache_destroy has returned void since v2.6.19.

autoconf: remove LIBCFS_3ARGS_INIT_WORK test

- INIT_WORK has taken two arguments since v2.6.20.

autoconf: remove LIBCFS_2ARGS_REGISTER_SYSCTL test

- register_sysctl_table has taken one argument since v2.6.21.

autoconf: remove LIBCFS_KMEM_CACHE_CREATE_DTOR tests

- kmem_cache_create hasn't had a dtor argument since v2.6.22.

autoconf: remove LC_REGISTER_SHRINKER test

- register_shrinker has been upstream since v2.6.23.

autoconf: remove LIBCFS_SCATTERLIST_SETPAGE test

- sg_set_page has been upstream since v2.6.24.

autoconf: remove LIBCFS_SCATTERLIST_INITTABLE test

- sg_init_table has been upstream since v2.6.24.

autoconf: remove unused LIBCFS_NETWORK_NAMESPACE test

- init_net has been upstream since v2.6.24.

autoconf: remove unused LIBCFS_SEM_COUNT test

- semaphores haven't used an atomic since v2.6.25.

autoconf: remove LIBCFS_CRED_WRAPPERS test

- The cred wrappers have been upstream since v2.6.29.

autoconf: remove LIBCFS_STRUCT_CRED_IN_TASK test

- struct cred has been a member of task_struct since v2.6.29.

autoconf: remove LIBCFS_STRUCT_SHASH_ALG test

- struct shash_alg has been upstream since v2.6.29.

autoconf: remove LIBCFS_FUNC_UNSHARE_FS_STRUCT test

- unshare_fs_struct has been upstream since v2.6.30.

autoconf: remove LIBCFS_HAVE_SET_MEMS_ALLOWED test

- set_mems_allowed has been upstream since v2.6.31.

We can remove the tests and dead code.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I1e8c24bfc8e86169543ac41939d4d33317665b14
Reviewed-on: http://review.whamcloud.com/5505
Tested-by: Hudson
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alexey Shvetsov <alexxy@gentoo.org>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3421 grant: more aggressively book space for precreate

- ofd_grant() should not round sub-block allocation to 0.
- ofd_grant_create() should be more aggressive in reserving space.
  Precreation should try to always have enough grant space to process
  a very large preallocation request.

Signed-off-by: Johann Lombardi <johann.lombardi@intel.com>
Change-Id: I5803b2d5fae216edcaae124d3b50b589c02e7251
Reviewed-on: http://review.whamcloud.com/6546
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
LU-3547 tests: skip unsupported subtest on old servers

chmod of .lustre/fid is unsupported on servers older than v2.4.
Add a version check to skip the unsupported op in sanity test 154a
on old servers for interop testing of 2.4+ clients on 2.3 servers.

Signed-off-by: Bob Glossman <bob.glossman@intel.com>
Change-Id: I353c93e8d1501944cad8f638de69a0432539249f
Reviewed-on: http://review.whamcloud.com/6879
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-1347 style: removes obsolete EXPORT_SYMTAB macros v2

EXPORT_SYMTAB is obsolete after 2.4 kernel, this patch removes
EXPORT_SYMTAB from the source code again.

Signed-off-by: Keith Mannthey <keith.mannthey@intel.com>
Change-Id: Idac9983d42b2c3e645def54628b6bc34d28aa3af
Reviewed-on: http://review.whamcloud.com/6739
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Reviewed-by: Liu Xuezhao <xuezhao.liu@emc.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-3339 mdt: HSM on disk actions record

HSM coordinator memorizes all actions in a llog
This patch implements the methods needed to create
update display these records.

Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Change-Id: I58bdbbd52a75a841c30e4477f3cb4c942d6d2a20
Reviewed-on: http://review.whamcloud.com/6529
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3335 scrub: purge inconsistenct objects after OI scrub

When OI scrub repaired the found inconsistency, it needs to purge the
old object out of cache; otherwise, others may still use those cached
stale information.

Test-Parameters: testlist=sanity-scrub
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Id3607c38952da9bfec01139743e817c95a854047
Reviewed-on: http://review.whamcloud.com/6697
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3305 quota: avoid unnecessary dqget/dqput calls

Because of the global lock contention inside the dqget()/dqput(),
we'd try to avoid dqget()/dqput() calls in dquot_initialize().

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I4335d880f3b912f3de70816a9bd87841605f8907
Reviewed-on: http://review.whamcloud.com/6440
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>