LU-1129 obdfilter: handle race condition of recreating objects

During OST recovery, a race can happen while handling replayed
OST_WRITE request during the MDS->OST orphan recovery period to
recreate missing objects, which can trigger ASSERTION(diff >= 0)
failure.

This patch handles the above issue by adding obd->obd_recovering
into the assertion to check whether the OST is in recovery or not.
If it's in recovery and diff < 0, then no assertion failure occurs,
the object has been recreated. If the OST is not in recovery and
diff < 0, then the assertion failure occurs.

Signed-off-by: Yu Jian <yujian@whamcloud.com>
Change-Id: If486bc8221cf4b9d53b6de53e8ec14a4f3174b45
Reviewed-on: http://review.whamcloud.com/3391
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1600 lnet: another race in lnet_nid2peer_locked

We fixed a race for the case that LNet is shutdown while the second
thread is in progress of creating a peer, but there is another race
if LNet is shutdown _before_ lnet_nid2peer_locked is called by the
second thread, for example: called from lnet_parse() by LND thread,
in this case, we should return error w/o trying to create peer,
otherwise the shuttingdown thread could think peer-table is empty
and move to the next step with leaving a peer on deathrow list.

This patch also passed error code into lnet_finalize() when it's
called from lnet_drop_delayed_msg_list, otherwise lnet_finalize()
will treat the message as a complete message and hit assertion
because the message is actually incomplet.

We also did some coding style cleanup in this patch.

Signed-off-by: Liang Zhen <liang@whamcloud.com>
Change-Id: I445298d639173840687412b11da41006ddc20c10
Reviewed-on: http://review.whamcloud.com/3369
Tested-by: Hudson
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-by: Doug Oucharek <doug@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1614 ptlrpc: fix for AT proc read

This patch fixed a couple of issues in AT proc read:
- calculate of buffer offset is wrong
- current lustre proc read must be less than one page

Signed-off-by: Liang Zhen <liang@whamcloud.com>
Change-Id: Ieef8ad458ca70a4146e0b61fbe8a32b35577ccdf
Reviewed-on: http://review.whamcloud.com/3365
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-by: wangdi <di.wang@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1432 ptlrpc: LBUG in lprocfs_free_client_stats()

* serialize connect and target obd cleanup to avoid connect
  accessing unexisted data structure.
* connect export refcounting cleanup.

Signed-off-by: Hiroya Nozaki <nozaki.hiroya@jp.fujitsu.com>
Signed-off-by: Lai Siyao <laisiyao@whamcloud.com>
Change-Id: I0a9e8a58ecdc1212565a478f4a758755a1b95f99
Reviewed-on: http://review.whamcloud.com/3244
Tested-by: Hudson
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-709 build: clean up quota_read, follow_link and RCU

1. super_operations.quota_read exists since v2.6.12
2. inode_operations->follow_link returns a cookie since v2.6.13
3. RCU exists since v2.6.12

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: Id79df5dcb0e3db9eb424337fd71d896ed8fefcd6
Reviewed-on: http://review.whamcloud.com/2316
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
LU-709 build: clean up percpu_counter and sb.s_time_gran

1. linux/percpu_counter.h exists since v2.6.12,
   percpu_counter_init() takes two arguments since v2.6.17,
   and percpu_counter is not used in lustre
2. superblock.s_time_gran exists since v2.6.12
3. get_sb_time_gran() doesn't exist since v2.6.12

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: Id80b0bfc702f509218fcf29d01334894d122b9c8
Reviewed-on: http://review.whamcloud.com/2317
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
LU-709 build: clean up i_mutex/i_private/quota_info macros

1. struct inode has i_mutex instead of i_sem since v2.6.16
2. struct inode has i_private since v2.6.17
3. struct quota_info uses mutex instead semaphore since v2.6.17
4. move LC_SECURITY_PLUG to under v2.6.27

Signed-off-by: Peng Tao <tao.peng@emc.com>
Change-Id: I587d18a8d63927aa0a668268d252f71e7f224b50
Reviewed-on: http://review.whamcloud.com/2318
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
LU-1415 tests: Explain refresh_disk()

Following Brian's suggestion in http://review.whamcloud.com/2981, this
patch adds a brief comment on refresh_disk(), which could be a bit
tricky to understand at first sight.

Change-Id: I83d583b5149c7648be4c68e31b6ff31f57410d9f
Signed-off-by: Li Wei <liwei@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/3430
Tested-by: Hudson
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Mike Pershin <tappro@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
New version 2.2.91

Change-Id: I4da67fd6e61749478a4eeecf9667116f4a64d077
Signed-off-by: Oleg Drokin <green@whamcloud.com>