LU-3404 build: fix 'incorrect expression' errors

Fix 'program hangs' defects found by Coverity version 6.5.1:
Array compared against 0 (NO_EFFECT)
Comparing an array to null is not useful.
Copy-paste error (COPY_PASTE_ERROR)
This line looks like a copy-paste error.
Self assignment (NO_EFFECT)
Assignment operation has no effect.
Side effect in assertion (ASSERT_SIDE_EFFECT)
Assignment has a side effect. This code will work differently in a
non-debug build. You might have intended to use a comparison instead.
Wrong sizeof argument (SIZEOF_MISMATCH)
Passing argument is suspicious.

Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: Iad370305cb8540f7c1b918e53ceae32e9ccbba8f
Reviewed-on: http://review.whamcloud.com/6465
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-3375 test: use available mdc for replay-single test_44

This patch corrects that to only look for the available mdc device
whose status is "UP".

Test-Parameters: clientdistro=fc18 clientarch=x86_64 serverdistro=el6 serverarch=x86_64 testlist=replay-single envdefinitions=SLOW=yes
Signed-off-by: Liu Ying <emoly.liu@intel.com>
Change-Id: Ia4013e68f44b0c1c5eb173b04af4c8c67e4961cf
Reviewed-on: http://review.whamcloud.com/6425
Tested-by: Hudson
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3357 mgs: Initialize uuid of llogs created by replace_nids

Initialize "Target uuid" with same data as in record_start_log().

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: If7f49eda6bf2f4143d86b71392e215528ebcbf92
Reviewed-on: http://review.whamcloud.com/6395
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Artem Blagodarenko <artem_blagodarenko@xyratex.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2200 obdclass: be more careful processing server name

Because whole options line gets passed to exclude processing, don't
search from end of passed in argument to determine fsname at
beginning.

Re-enable conf-sanity/32 but do replace_nids on IB.

Test-Parameters: nettypes=o2ib testlist=conf-sanity
Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: Ibc43417cb71581198e3516c1e431c0d3f668f1e0
Reviewed-on: http://review.whamcloud.com/6197
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
LU-3220 quota: warning on setting small limits

When user try to set quota limits smaller than the minimal qunit
size (1M bytes for block limit, 1K inodes for inode limit), we'd
warn user that limit is too small.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I26e2e682500628211e2f2bedf65e534f3b214422
Reviewed-on: http://review.whamcloud.com/6182
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
LU-2904 llite: return valid fsid for statfs

Lustre uses 64-bits inode number to identify object on client side.
When re-export Lustre via NFS, NFS will detect whether support fsid
via statfs(). For the non-support case, it will only recognizes and
packs low 32-bits inode number in nfs handle. Such handle cannot be
used to locate the object properly.

To avoid patch linux kernel, Lustre client should generate fsid and
return it via statfs() to up layer.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Ie292b26726a1b2aa7a763ef7c0507e3ed089323b
Reviewed-on: http://review.whamcloud.com/6493
Tested-by: Hudson
Tested-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3101 mgs: deregister the mount for failed case

in server_start_mgs, the mount of MGS should be put if MGS
failed to start up.

Change-Id: I03c7c3c8e0c578391b637fe0bcdf48da5e318db8
Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/6035
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-3413 scrub: NOT create new files in test_11 during scrub

In sanity-scrub test_11, there may be new files created between two
cycles OI scrub. The test scripts cannot distinguish whether the OI
scrub skipped objects are new created or caused by OI scrub issues.

So we umount the clients after the test environment preparation to
prevent new files to be created from client during OI scrub.

On the other hand, enable full debug to check whether some internal
files creating during the OI scrub.

Test-Parameters: testlist=sanity-scrub,sanity-lfsck

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Ie1bdebd12ea456bab07bd4c3a55776fa9451144e
Reviewed-on: http://review.whamcloud.com/6485
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
LU-3435 util: Improvement to error logging for l_getidentity

The LU-2107 patch to l_getidentity does not set the data->idd_err
value to errno, and does not log the uid when getgrouplist() fails.
This patch fixes both of those concerns.

Signed-off-by: Patrick Farrell <paf@cray.com>
Change-Id: I8a5715bada61a4c69d4d875b60097f9414a25f1c
Reviewed-on: http://review.whamcloud.com/6533
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-1199 build: Fix paths after move to contrib dir

Fix usage of lbuild's support files from the directory where
lbuild and support files are realy palced.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ie0bb4f98ee0adcbf1643b15a9d131f69a47b7360
Reviewed-on: http://review.whamcloud.com/6497
Tested-by: Hudson
Reviewed-by: Christopher J. Morrone <chris.morrone.llnl@gmail.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3441 build: Allow for native KNC compilation

The cross-compilation support (LU-2752) assumes that K1OM will
only be built in a cross-compile environment. To allow for
native compilation we only perform the cross compilation check
if $cross_compile is defined to yes.

Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: I93fd9c2f7d29dd9567cfcd93013df09271d65dc2
Reviewed-on: http://review.whamcloud.com/6558
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3427 build: fix 'error handling' issues

Fix 'error handling' issues found by Coverity version 6.5.1:
Unchecked return value (CHECKED_RETURN)
Calling function without checking return value.

Signed-off-by: Sebastien Buisson <sebastien.buisson@bull.net>
Change-Id: Id0d7c6f5fdddcc5ba9b78f9410f30d9bfc39dac8
Reviewed-on: http://review.whamcloud.com/6510
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
LU-3403 llite: error of listxattr when buffer is small

According to the standard, listxattr(2) should return -1
and errno should be set to ERANGE if the size of the list
buffer is too small to hold the result. However ll_listxattr()
will return a value bigger than the size of buffer in some cases.

Let's assume listxattr(2) returns SIZE when it is called with a
large enough list buffer. If it's called again with a list buffer
whose size is smaller than SIZE but bigger than (SIZE - 12), then
listxattr(2) will return SIZE too. This patch fixes the problem.
Original patch by Li Xi <pkuelelixi@gmail.com>

Signed-off-by: Keith Mannthey <keith.mannthey@intel.com>
Change-Id: Ifb29ae900a5ee57dfde8781f7a008b6129c7bf91
Reviewed-on: http://review.whamcloud.com/6463
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Li Xi <pkuelelixi@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2489 hsm: remove hsm_nl proc file

Remove the file /proc/fs/lustre/mdc/*/hsm_nl which was introduced "for
testing purposes."

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I646c74de00084a54d528b059633512381e7097f0
Reviewed-on: http://review.whamcloud.com/6656
Tested-by: Hudson
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3021 ldiskfs: to not verify preallocation in umount path

When recovery test is running, device rdonly flag is set and all
updates will be erred out so on-disk data can be inconsistent with
memory data.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: I69d3fa462c69f5f85978265075165b488661e863
Reviewed-on: http://review.whamcloud.com/5883
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3334 quota: use different names for reint threads

Use different thread names for the quota reint threads.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I54a4d074106e6f0fa9a21a0fd91a9096c54035f4
Reviewed-on: http://review.whamcloud.com/6341
Tested-by: Hudson
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-3460 quota: don't schedule adjust when qsd stopped

When the qsd is stopped, we should not schedule quota adjust or
index update anymore, because the writeback thread has been stopped,
and those scheduled requests will never be processed.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I33e0bbc7eb22be8a7edbc031f36ceff666575ebe
Reviewed-on: http://review.whamcloud.com/6731
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
LU-3173 build: Incorrect detection of ldiskfs series to use

Extract correct upstream kernel release for RHEL kernels and
form it into RHEL_KERNEL_VERSION as
$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)-$(RHEL_RELEASE)
Then use this string for correct ldiskfs series selection.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Idda0a4b02a5090b7be6fb81b8f98175559e575aa
Reviewed-on: http://review.whamcloud.com/6056
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
LU-3446 mdd: changelog index to survive MDT restart

If all changelog records are cleared the current changelog index is
initialized to zero when the MDT starts. This confuses applications
that rely on the index to track their position in the changelog
history. To avoid this, initialize the current index from the
registered user with the highest end record index.

Add a sanity.sh regression test. Update changelog test function
test_160() and its helpers according to current style guidelines.

Signed-off-by: Ned Bass <bass6@llnl.gov>
Change-Id: I841bbf84c718bac560b6eea4b18de9918b889a90
Reviewed-on: http://review.whamcloud.com/6642
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2655 obdclass: selinux support

add ability to start lustre targers on selinux enabled nodes
provide a fake xattr functions for a lustre mounts,
add security context to mkfs mountpoint.

Xyratex-bug-id: MPR-558
Signed-off-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Change-Id: Iee8701912e71da21eb7e2417ebdc123f88ab86fa
Reviewed-on: http://review.whamcloud.com/5135
Tested-by: Hudson
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>