LU-4746 libcfs: Use Linux kernel current_umask() function

Lustre not using kernel current_umask() function breaks GRSecurity
umask handling. This is also needed for the linux api cleanup.

Replaces current->fs->umask with more secure current_umask() function

Change-Id: Ide0b83eb3e6c69e1e2178ede37ce708227f1c107
Signed-off-by: Andrew Prout <ajprout@hotmail.com>
Signed-off-by: Cliff White <cliffwhi@intel.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-on: http://review.whamcloud.com/11642
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
LU-5596 lnet: Remove obsolete LNET variable

For Lustre version 2.6.50 and later, the variable
session_features is defined as "LST_FEATS_MASK". For
earlier versions of Lustre, the same variable is defined
as "LST_FEATS_EMPTY.

Since Lustre master is at 2.6.52 or later, the second
definition of "session_features" can be removed.

Signed-off-by: James Nunez <james.a.nunez@intel.com>
Change-Id: I52e7a914880509cfcd4961032ab7775bbaf626a8
Reviewed-on: http://review.whamcloud.com/11825
Tested-by: Jenkins
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5610 tests: Handle quoted module options

When test-framework.sh translates module options to environment
variables for remote nodes, quotes sould be escaped to the subshell.

Signed-off-by: Stephen Champion <schamp@sgi.com>
Change-Id: I937cc28b96b54ea75082c7d8789c762b4db16c5f
Reviewed-on: http://review.whamcloud.com/11887
Tested-by: Jenkins
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5508 osp: RPC adjustment for remote transaction

1) For remote transaction, the set_attr/set_xattr RPC should not be
   prepared in declare phase. According to our current transaction/
   dt_object_lock framework, the transaction sponsor will start the
   transaction firstly, then try to acquire related dt_object_lock
   if needed. That is a general rule, and the LFSCK needs to follow
   such rule when repair inconsistent linkEA, in spite of local or
   remote MDT-object.

   For linkEA repairing case, before the LFSCK thread obtained the
   dt_object_lock on the target MDT-object, it cannot know whether
   the MDT-object has linkEA or not, neither invalid or not.

   Since the LFSCK cannot hold dt_object_lock before the (remote)
   transaction start (otherwise there will be potential deadlock),
   it cannot prepare related RPC for repairing during the declare
   phase as other normal transactions do.

   To resolve the trouble, we will make OSP to prepare related RPC
   (set_attr/set_xattr/del_xattr) after remote transaction started,
   and trigger the remote updating (RPC sending) when trans_stop.
   Then the up layer users, such as LFSCK, can follow the general
   rule to handle trans_start/dt_object_lock for repairing linkEA
   inconsistency without distinguishing remote MDT-object.

2) Some adjustment for OSP object attributes cache maintainig to make
   the logic more clear and reasonable.
2.1) Update the cached attribute in osp_attr_set(), but not in the
     osp_declare_attr_set().
2.2) Update the cached extended attribute in osp_xattr_set(), but not
     in the osp_declare_xattr_set().
2.3) Drop the cached extended attribute in osp_xattr_del().

3) Typo fixing and code cleanup.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I43c88a8fd3b184c91a4b3cbd4104e35f9915ee24
Reviewed-on: http://review.whamcloud.com/11382
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5509 osd: get PFID from linkEA for remote dir on ldiskfs

On the ldiskfs backend, for a directory which parent resides on
remote MDT, to satisfy the local e2fsck, we insert it into the
/REMOTE_PARENT_DIR locally. On the other hand, to make the lookup(..)
on the directory can return the real parent FID, we append the real
parent FID after its ".." name entry in the /REMOTE_PARENT_DIR.

Unfortunately, such PFID-in-dirent cannot be preserved via file-level
backup. So after the restore, we cannot get the right parent FID from
its ".." name entry in the /REMOTE_PARENT_DIR. Under such case, since
we have stored the real parent FID in the directory object's linkEA,
we can parse the linkEA for the real parent FID.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Icf1e24ec911818b3a49a253f67c72334a4b75712
Reviewed-on: http://review.whamcloud.com/11485
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4788 lfsck: verify .lustre/lost+found at the LFSCK start

/ROOT/.lustre/lost+found/ is a special directory to hold the
objects that the LFSCK does not exactly know how to handle,
such as orphans. So before the LFSCK scanning the system,
the consistency of such directory needs to be verified firstly
to allow the users it during the LFSCK.

fid_seq_is_dot_lustre() is a duplication of fid_seq_is_dot(),
drop it and cleanup the code.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I95cac84bed1ae16c8c86e495db0120d964395b5e
Reviewed-on: http://review.whamcloud.com/10987
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2675 llite: remove generic operations from llite/namei.c

Remove the llite inode operation wrappers ll_mknod(), ll_unlink(),
ll_mkdir(), ll_rmdir(), ll_symlink(), ll_link(), and ll_rename(),
replacing them with calls to ll_mknod_generic(), but rename these
functions to drop the _generic suffix. Remove several variables that
are always NULL after this transformation. Simplify some control flow,
using the knowledge that certain variables are never NULL. Replace
calls to ll_d_mountpoint() with equivalent calls to d_mountpoint() and
remove the then unused function ll_d_mountpoint(). Remove the
effectively unused lookup_flags parameter from ll_create_it().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: Ib1757399c66a119e842d3361f184128ce2b96a78
Reviewed-on: http://review.whamcloud.com/10769
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5453 mdt: mdt_reint_setattr() and mdt_attr_set() fixes

In mdt_reint_setattr() add early checks that the object exists and is
local. Remove the invalid assertion in mdt_attr_set() that the object
is local. Replace several assertions on wire data with -EPROTO
returns. In mdt_attr_set() when locking the slaves of a striped
directory use a PW lock for slave 0. Remove the unused flags parameter
of mdt_attr_set().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I2aa5a645b8398c1e2890291cb61ffa280ec82443
Reviewed-on: http://review.whamcloud.com/11353
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-2675 lustre: remove linux/lustre_lib.h

Remove lustre/include/linux/lustre_lib.h. Remove some unused
declarations from lustre/include/lustre_lib.h and move some others to
more natural headers.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I30b032e5e766cc052dbf6af34eb2e5d3f1af589e
Reviewed-on: http://review.whamcloud.com/11500
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5521 grant: quiet message on grant waiting timeout

Use at_max in osc_enter_cache() to bound how long we wait for grant
space before switching to synchronous I/Os. Do not print a message
on the console when the timeout is hit since such long wait can
be legitimate with flaky network (i.e. BRW is resent multiple times).

Signed-off-by: Johann Lombardi <johann.lombardi@intel.com>
Change-Id: I9c507a11ea4a3612e932e22bebb5087dbdcf248a
Reviewed-on: http://review.whamcloud.com/11716
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5556 target: limit bulk transfer time

Messages lost during bulk transfer are not resent, so there is no
point in waiting for a very long time (up to at_max/600s has been
seen). This patch adds a new static timeout for the bulk transfer
(100s by default).

Signed-off-by: Johann Lombardi <johann.lombardi@intel.com>
Change-Id: I3926a7a8f2bce4cbd00b8fe54094a8e9cbec1508
Reviewed-on: http://review.whamcloud.com/11717
Tested-by: Jenkins
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Li Wei <wei.g.li@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5588 mdt: fix NULL pointer 'obd' can be dereferenced

Pointer 'obd' checked for NULL at line 3992 will be dereferenced
at line 4040. Pointer 'obd' checked for NULL at line 4120 will be
dereferenced at line 4170.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Change-Id: I1478cb67f3b17646e631ab38b4a9bbadf82fac31
Reviewed-on: http://review.whamcloud.com/11768
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
LU-3963 libcfs: remove last of cfs list wrappers

Delete the cfs wrappers for linux list and hlist api.
Removal of these wrappers exposed last remaining
unconverted list operators.

Signed-off-by: James Simmons <uja.ornl@gmail.com>
Change-Id: If72e68e93663174c5c3540e2444cc50d37d04a48
Reviewed-on: http://review.whamcloud.com/11797
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-5396 lov: add sparse annotation __user wherever needed

This fixes sparse warnings such as:

  .../api-ni.c:1639:33: warning: incorrect type in argument 3
                             (different address spaces)
  .../api-ni.c:1639:33:    expected struct lnet_process_id_t
                             [noderef] [usertype] <asn:1>*ids
  .../api-ni.c:1639:33:    got struct lnet_process_id_t
                             [usertype] *<noident>

There is no code change.

Change-Id: I67c89e141a30d175091673034d48c1aa75148891
Signed-off-by: frank zago <fzago@cray.com>
Reviewed-on: http://review.whamcloud.com/11823
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>