LU-4476 kernel: support process namespace containers

PID namespace was introduce to linux to allow the
migration of containers between hosts. This way running
processes could be migrated to a new machine without
interruption due to pid collisions. User namespace creates
a new enviroment for a exist process where in this new
namespace it will have different uid/gid. Outside that
namespace the default uid/gid. For example a unprivileged
application can create user namespace for itself which has
root privilages. Those privilages don't exist outside of
the created namespace. Both of these changed the traditonal
one to one kernel mapping for pids/gids has changed. Since
userland can now have multiple PID namespaces this means that
each namespace in userland could have the same pid assigned.
This is possible since each namespace will be isolated from
each other. In the case of User namespace the application can
report to the kernel its namespace uid/gid instead of its real
uid/gid. Since the same running kernel is used between all
namespaces on a host the pid/gid data that is pushed into a
kernel context will have to map to a unique pid/gid in kernel
space to avoid collisions. This very similar to Lustre using
FIDs to avoid inode collisions. An example of where the mapping
needs to take place are when pid/gid data is pushed via a ioctl.
Also the internal structures of the kernel store uid/gid in the
kernel internal format. Lastly even with lustre userland uid/gid
namespace being consistant to applications the transmitted
uid/gid will be represented in the kernel differently from
server to server. Lustre wire protocols transmitting uid/gid
must handle these cases.

Change-Id: I207492b9a8a762e43ac2dd8fd1fb1b7397505304
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-on: http://review.whamcloud.com/8817
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4699 libcfs: unify ERR_PTR definitions

Add libcfs/err.h which either includes linux/err.h or defines
equiavlent functions (including ERR_CAST()) for use by userspace or
any of Lustre's other imaginary platforms. Modify the definition of
__container_of() to remove the pre-call explicit cast. Remove two
unused function that used container_of0() on an already dereferenced
pointer.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I26b454f835b51f1fb17b94eec7cf184f0a82071e
Reviewed-on: http://review.whamcloud.com/9519
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4813 lfsck: reuse OUT_PORTAL for orphan iteration

It is unnecessary to use independent request portal for LFSCK
orphan iteration, which will cause trouble for UT work in the
future and also may cause interoperability issues. So we will
reuse the existing OUT_PORTAL for the same purpose.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I721977adb58ef35651775bacab6b5f9e325eb26a
Reviewed-on: http://review.whamcloud.com/9772
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4815 lfsck: pause LFSCK before server stack fini

To avoid the LFSCK to access the devices/objects during
the targets stopping.

Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: Ifd8c1b1f878ac00a3c92ab6f2ab11e46003f584c
Reviewed-on: http://review.whamcloud.com/9774
Tested-by: Jenkins
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4791 lod: subtract xattr overhead when calculate max EA size.

1. It needs to subtract the xattr overhead when calculate the max
EA size, otherwise, it might get oversize stripe_count, which cause
ENOSPC error in the following xattr_set.
2. Release stripe information, if xattr set fails.

Signed-off-by: wang di <di.wang@intel.com>
Change-Id: Ibe46b8cbc161f151eae4eb14878af4406fc78d41
Reviewed-on: http://review.whamcloud.com/9835
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4799 llite: Do not rate limit dirty page discard warning

Messages which are printed by ll_dirty_page_discard_warn() should not
be rate limited.  If they are rate limited, some files which may be
corrupted on client eviction will not be reported to the user.

This patch changes the CWARN to a CDEBUG to disable console message
rate limiting for this message.  The dirty page discard warnings are
already limited on a per-file basis by the function vvp_vmpage_error
which calls ll_dirty_page_discard_warn only if the ccc_object's
cob_discard_page_warned == 0.

Signed-off-by: Ryan Haasken <haasken@cray.com>
Change-Id: Ia8a13c7add89c890014170254e462ae861de0fc5
Reviewed-on: http://review.whamcloud.com/9752
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Cory Spitz <spitzcor@cray.com>
Reviewed-by: Ann Koehler <amk@cray.com>
Reviewed-by: Chris Horn <hornc@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4826 lmv: Ensure lmv_intent_lookup cleans up reqp

Ensure there aren't invalid pointers hanging around after
ptlrpc_req_finished is called.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: Ieb16e70958d899a2d9320491dfd6276143accc55
Reviewed-on: http://review.whamcloud.com/9841
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
LU-4853 ldiskfs: fix race in ldiskfs_ext_new_extent_cb

In ldiskfs_ext_calc_credits_for_insert(), we should use the 'depth'
stored in the 'path' instead from inode, because the extent tree
could have been changed when ldiskfs_ext_calc_credits_for_insert()
is called (by ldiskfs_ext_new_extent_cb()).

It was fixed in LU-2555, but the fix is missed in
sles11sp2/ext4-misc.patch

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: I9ca349ba52060f10fc980721317ba47e10572473
Reviewed-on: http://review.whamcloud.com/9868
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>