LU-2827 ldlm: wrong handling of ldlm resends

If a successful reply is lost for an intent
lock request, MDS will not correctly recover
from this situation on resend. Instead, a new
lock is created.

Signed-off-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Reviewed-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Tested-by: Elena Gryaznova <elena_gryaznova@xyratex.com>
Reviewed-by: Alexey Lyashkov <alexey_lyashkov@xyratex.com>
Change-Id: I9a23c13313d5168d0c232fdc0acbdab330089356
Tested-by: Andrey Bondarenko <andrey_bondarenko@xyratex.com>
Xyratex-bug-id: MRP-975 MRP-1798
Reviewed-on: http://review.whamcloud.com/5978
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2827 mdt: Also handle resend for layout-lock

This patch is an add-on to the generic fix for resends
handling known as :
Lustre-commit: I9a23c13313d5168d0c232fdc0acbdab330089356
Lustre-change: http://review.whamcloud.com/5978/
This patch adds handling of resend during layout-lock

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: Ideb551779a884d77ded8036c513f62557b2dfcde
Reviewed-on: http://review.whamcloud.com/10378
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3544 fid: do open-by-fid by default

Currently client open-by-fid often packs name into the request,
but the name may be invalid, eg. NFS export, and even if it's
valid, it may cause inconsistency because this operation is done
on this fid, which is globally unique, but name not.

Since open-by-fid doesn't pack name, for striped dir we can't know
parent stripe fid on client, so we set parent fid the same as
child fid, and MDT has to find its parent fid from linkea (this is
already supported by MDT).

M_CHECK_STALE becomes obsolete.

Unset MDS_OPEN_FL_INTERNAL from open syscall flags, because these
flags are internally used, and should not be set from user space.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: Id8d32a26497b2df944c7f9ef51a418ec136a6a9b
Reviewed-on: http://review.whamcloud.com/7476
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3544 nfs: don't store parent fid

It's not necessary to store parent fid in lli_pfid, because MDT
can get it's parent fid from linkea, and now that DNE stripe
directory stores master inode fid in lli_pfid, stop storing parent
fid to avoid conflict.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: I924c29a1d58b008026d37265978c81ca1aa21ebb
Reviewed-on: http://review.whamcloud.com/10692
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-3544 xattr: xattr data may be gone with lock held

Xattr cached data may be gone, but lock still held, in this case,
refetch xattr from server, otherwise client will return error.

Test-Parameters: alwaysuploadlogs envdefinitions=SLOW=yes testlist=parallel-scale-nfs,parallel-scale-nfs
Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: Id6fbbef339fea540728b181b2ae91799b8151fbd
Reviewed-on: http://review.whamcloud.com/10693
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4629 libcfs: fix buffer overflow of string buffer

Buffer overflow of string buffer due to non null terminated string.
Use strlcpy() when it's justifiable.
Use sizeof(var) instead of constants.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ib8d5493898a292e3c764170d0a0870bee26b23a0
Reviewed-on: http://review.whamcloud.com/9389
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4629 utils: fix input format specifier error

Width is not specified for 's' conversion specifier. This can result in
an overflow of the buffer provided in arguments of a call to 'sscanf'.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: Ic9f37c19461a28a51bd1a0a1a42685b137773a41
Reviewed-on: http://review.whamcloud.com/10667
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4887 lfsck: run all LFSCK scan types by default

When running "lctl lfsck_start" run all available scan types by
default (scrub, layout, and namespace currently) if none is given.
If '-t' is given, run only the specified scan types. 'scrub' is
always run.

Rename the lfsck_type constants to use a LFSCK_TYPE_ prefix to be
more descriptive.  Add LFSCK_TYPE_ constants to wirecheck.
Add ltn_ prefix to lfsck_type_name structure.

Print the available types from the lfsck_types_names[] array in
the help message instead of hard-coding them in the help message.

Don't return an error if "lctl lfsck_stop" is used when stopped.

Fix up lfsck_namespace /proc stats to use more descriptive names.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: I106483ade0bf07c2920dd95a263acdbe4e500c1e
Reviewed-on: http://review.whamcloud.com/10278
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
LU-4610 lfsck: fix lfsck, osd-ldiskfs, osd-zfs debug messages

Fix the debug subsystems for osd-ldiskfs, and osd-zfs to use S_OSD
instead of S_MDS for easier debug message filtering, except
osd_scrub.c which is using S_LFSCK instead of S_MDS.

Do not print a D_LFSCK message in osd_otable_it_preload(), since this
is being printed for every inode in the filesystem and fills the logs
if D_LFSCK is enabled.

Fix lfsck_pos_dump() to print the directory hash cookie in hex and
fix up sanity-lfsck test_6a to be able to handle this.

More D_LFSCK debug message for LFSCK check/repair processing. This
is the first step for logging all the LFSCK changes. The next step
will collect these LFSCK debug message and save them in some files
automatically.

Enable D_LFSCK debug by default.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Change-Id: Iff3143f22d3c4750ebe95fbeba8883a325300c1e
Reviewed-on: http://review.whamcloud.com/10579
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: James Nunez <james.a.nunez@intel.com>
LU-4861 osc: a deadlock problem in osc completion ast

In osc_ldlm_completion_ast(), it tries to hold mutex of cl_lock
and update the lock even it's known that the lock is not granted,
this can introduce a deadlock case if the process is matching a
dlm lock with the calling stack:
  osc_lock_enqueue()
    -> osc_enqueue_base()
      -> ldlm_lock_match()
        -> osc_ldlm_completion_ast()
          -> cl_lock_mutex_get()
The enqueuing lock and the lock for completion_ast() are different
lock. This is a deadlock case because we're holding a lock's mutex
and then request the other.

It's not necessary to acquire the lock in completion_ast() if it's
known that the lock has not been granted.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Change-Id: Ia8c0a4cb1e48c9f7fd921052174ce4d8d07713b1
Reviewed-on: http://review.whamcloud.com/10581
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5220 llite: fix a flag bug of vvp_io_kernel_fault()

After vvp_io_kernel_fault() locked the page, it should set
VM_FAULT_LOCKED.

Signed-off-by: Li Xi <lixi@ddn.com>
Change-Id: Ic63f1b830360b127df6ae3220d63bef3ebf0b89c
Reviewed-on: http://review.whamcloud.com/10740
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Tested-by: Jenkins
Reviewed-by: Emoly Liu <emoly.liu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5205 mdc: Add config check for Xeon Phi build

Add config check for radix_tree_exception_entry()
to not broken Xeon Phi build.

Signed-off-by: Yang Sheng <yang.sheng@intel.com>
Change-Id: I2f405e392003162e779ffbf9055e410917940df7
Reviewed-on: http://review.whamcloud.com/10734
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5124 lod: use S_IS{REG,DIR} in lod_load_striping_locked()

In lod_load_striping_locked() use S_ISREG(mode) rather than testing
(mode & S_IFREG) and similarly for S_ISDIR().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I040a50b485fc2b45d74daf403c041f05968e573b
Reviewed-on: http://review.whamcloud.com/10702
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
LU-4713 test: Add a check to test_237 in sanity.sh

This patch adds a check to test_237 in sanity.sh to check whether
write to the file succeeded or not.

Test-Parameters: clientdistro=sles11sp3 testlist=sanity envdefinitions=ONLY=237
Signed-off-by: Swapnil Pimpale <spimpale@ddn.com>
Change-Id: Id81f9bf01ead516c3b0e7f247ff71550d4a9847e
Reviewed-on: http://review.whamcloud.com/10088
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-2059 mgs: fix a bug in mgs_llog_open

- don't calculate len for NULL ptr
- check the logname is PARAMS_FILENAME inside 'if (ptr == NULL ...)
clause so all cases with NULL ptr will end there.

Signed-off-by: Mikhail Pershin <mike.pershin@intel.com>
Change-Id: Ib87ecb3245833fc8f9d069898a1b80c44bbfd9f0
Reviewed-on: http://review.whamcloud.com/10589
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5179 libcfs: do not leak mm_struct

cfs_get_environ might leak an mm_struct if LU-1735 race condition
hits.
Make sure to mmput in such a case.

Change-Id: I49499c14027358961743d8928ab2edbe54bf72f7
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/10759
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
LU-5188 osp: Correctly check for invalid setattr record

Patch for LU-4345 (commit 80f90fcde73e2faff8b7b0ffc7c19bc52982e027 )
has a correct comment about lsr_valid member being either 0 or
having UID and GID fields set, but the check has a typo causing
it to check for lsr_valid to be both 0 and have the bits set which
is impossible.

The osp_sync_new_setattr_job() should return 0 for invalid record,
so that sync thread can continue processing on other records.

Change-Id: I32e6f261b4707391d6e96f8434aae7bf8f55bf8e
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/10706
Tested-by: Jenkins
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>