LU-1290 quota: transfer quota in osd_attr_set()

Move the ll_vfs_dquot_transfer() out of the osd_inode_setattr(),
since ll_vfs_dquot_transfer() will hold the dqptr_sem, whereas
the osd_inode_setattr() is protected by spin lock oo_guard.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Ib36231fb30eabfd39fe0baf16e982357113c6121
Reviewed-on: http://review.whamcloud.com/2463
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1347 build: use kernel checkpatch.pl and check for tabs

We need to enforce kernel coding style, and check for tabs
instead of spaces by default.

Signed-off-by: Peng Tao <peng_tao@emc.com>
Change-Id: I26fc5a5c6d2e629eb284ac604977d09ebe41dc53
Reviewed-on: http://review.whamcloud.com/2610
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
LU-1193 tests: test script fixes for incompatibility

test script incompatibility when running server as
2.1 and client as 2.2

 - conf-sanity: 61
 - recovery-small: 100, 101, 102, 103, 104, 105
 - santiy: 133a, 133d, 160, 225a, 225b

Signed-off-by: yang sheng <ys@whamcloud.com>
Change-Id: I97dea88cdebb2f229aa6d2852a653619145e59a2
Reviewed-on: http://review.whamcloud.com/2441
Reviewed-by: Yu Jian <yujian@whamcloud.com>
Reviewed-by: Wei Liu <sarah@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1259 mgs: avoid cancelling IR lock twice

There is a race that if IR shared lock is revoked fastly the
completion ast can be called twice with the lock granted. The
IR lock should be cancelled only once in this case.

Signed-off-by: Jinshan Xiong <jinshan.xiong@whamcloud.com>
Change-Id: Ie1b2742d436fb6f549cfcb25dc50fbbabcd1f008
Reviewed-on: http://review.whamcloud.com/2390
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1283 utils: Use variable without initialize

We need to initialize char *savept before use it

Signed-off-by: Minh Diep <mdiep@whamcloud.com>
Change-Id: I0c8155d84e255fcf55e98f5b84a09faf8f8487ef
Reviewed-on: http://review.whamcloud.com/2448
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Cliff White <cliffw@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
LU-1214 ldlm: splits server specific lock handling from client

Splits/removes these server-side specific lock handlings:
1. Server-side blocking/completion/glimpse AST
2. ldlm_cancel_service
3. Resource policy functions
4. ldlm_handle_enqueue /ldlm_handle_convert etc.

Uses "HAVE_SERVER_SUPPORT" to comment out those server-side codes.

Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Change-Id: Ia5b607715a45737182932bf5ec90bda9199eaf07
Reviewed-on: http://review.whamcloud.com/2361
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1214 ptlrpc: removes client lu_target.h/target.c dependency

Needs not include lu_target.h or compile target.c for client.

Signed-off-by: Liu Xuezhao <xuezhao.liu@emc.com>
Change-Id: I332864158839a8ed1f1df3b24477f5e68ef4ecb7
Reviewed-on: http://review.whamcloud.com/2362
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-911 osd: osd_ldiskfs_read returns short reads

osd_ldiskfs_read returned always the requested size even if short
read occurs hiding possible problems. Now it returns real size.

dt_read() helper returns just the same result and can be used to read
any data.

dt_record_read() must be used only for fixed length records

Fix mdt_getattr_internal() code related to readlink, it always tried
to read link of size + 1, so now we need to take this into account.

Signed-off-by: Mikhail Pershin <tappro@whamcloud.com>
Change-Id: Ib603c5cbe5b06f3f6a9aef74c52bb78cdbd4c3eb
Reviewed-on: http://review.whamcloud.com/2263
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-425 tests: fix the issue of using "grep -w"

This patch fixes the following issue while using "grep -w"
to do exact match:

$ echo /mnt/nbp0-2 | grep -w /mnt/nbp0
/mnt/nbp0-2

Per the description of "-w" option:
-w, --word-regexp
Select only those lines containing matches that form whole words.
The test is that the matching substring must either be at the
beginning of the line, or preceded by a non-word constituent
character. Similarly, it must be either at the end of the line
or followed by a non-word constituent character. Word-constituent
characters are letters, digits, and the underscore.

So, the hyphen "-" character is a non-word constituent character
and "grep -w" does not do exact match on strings which contain it.

Signed-off-by: Yu Jian <yujian@whamcloud.com>
Change-Id: I53d306d38b05408c351db10dc545120f2f9dabce
Reviewed-on: http://review.whamcloud.com/2529
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Minh Diep <mdiep@whamcloud.com>
Reviewed-by: Wei Liu <sarah@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-911 obdclass: new context tags for future use

- Add new thread tags: local, mgs and osp
- use LCT_LOCAL to avoid extra keys allocation when just local
  server update is needed.
- target_recovery_thread() is capable to serve OFD.

Signed-off-by: Alex Zhuravlev <bzzz@whamcloud.com>
Change-Id: Ic41673c91b8d519c95a8740c418070f9e14aa3a6
Signed-off-by: Mikhail Pershin <tappro@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/1851
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-506 statahead: revalidating dentry may be stale

The revalidating dentry may be stale (other client recreated this
file), so the statahead inode can be different from dentry inode.
Return -ESTALE instead of LASSERT here.

And for this kind of dentry, it shouldn't be revalidated, but dropped
and re-lookup. To achieve this, if ll_statahead_enter() fails to get
a valid dentry, and the return value is not 0 or -EAGAIN,
ll_revalidate_it() should return 0 directly, and let VFS calls
.lookup to get a new dentry.

Signed-off-by: Lai Siyao <laisiyao@whamcloud.com>
Change-Id: I3eae450069a59d18d138d0cf7538a225e6d6deb8
Reviewed-on: http://review.whamcloud.com/2492
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Peng Tao <tao.peng@emc.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-904 ptlrpc: redo io on -EINPROGRESS

When server return -EINPROGRESS for a write RPC, the client
should keep resending the RPC until server return other
error code or the client is evicted.

This is required by the new quota design: when a write on
OST can't acquire quota from master for broken network, it
should return -EINPROGRESS to inform the client to retry
write infinitely.

This patch also fixed the defect of redo io RPC can't be
aborted during eviction, in a lightweight manner.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Iea393cb1ea55e9d006f52dbfc39a2b9a3670d682
Reviewed-on: http://review.whamcloud.com/1962
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1329 ptlrpc: handle -EINPROGRESS for create

If some metadata operation get -EINPROGRESS from server, client
should retry the operation infinitely. Which is required by
the new quota design in the DNE environment.

We handle -EINPROGRESS only for create operation for now, if
necessary, it can be extended for other operations later.

Signed-off-by: Niu Yawei <niu@whamcloud.com>
Change-Id: Iad568afeff0af1d4df840d3acf2df161df6f7690
Reviewed-on: http://review.whamcloud.com/2572
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
Reviewed-by: Fan Yong <yong.fan@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1311 Disable local irqs when locking tcds while walking them

This helps us to avoid a deadlock with other threads that goes like this:
thread doint the walking = (1)
other thread = (2)

(1) get some non-irq type tcd locked while walking the tcds
(2) get some irq/bh lock
(2) try to print a debugging message and block on the tcd lock held by (1)
(1) irq/bh arrives, tries to get irq/bh lock held by (2) == BAM!

Change-Id: If1e1cc57c0f2e287b453e34db0c894c1ca830b9a
Signed-off-by: Oleg Drokin <green@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/2605
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Liang Zhen <liang@whamcloud.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
LU-1306 ldlm: LBUG at ldlm_lock.c:213

Protect l_flags with locking to prevent race on
signal reception.

Xyratex-bug-id: MRP-420
Signed-off-by: Andriy Skulysh <Andriy_Skulysh@xyratex.com>
Reviewed-by: Vitaly Fertman <vitaly_fertman@xyratex.com>
Reviewed-by: Iurii Golovach <iurii_golovach@xyratex.com>
Change-Id: Ifbf9e668bfeba30c9f9f206086186ad7d499a871
Reviewed-on: http://review.whamcloud.com/2511
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1264 quota: reserve FID sequences for quota

This patch reserves 2 FID sequences for quota.

Slave indexes will be allocated an unique FID from the FID_SEQ_QUOTA
sequence.

As for FID_SEQ_QUOTA_GLB, it will be used to uniquely identify the
global quota indexes. For the global index, the sequence will thus be
set to FID_SEQ_QUOTA_GLB and the 32-bit object ID divided into 3
fields:
- 16-bit pool identifier
- 8-bit quota type (user or group quota)
- 8-bit target type (data or metadata)

Thanks to this static FID scheme, slave can enqueue global quota lock
directly on the right FID without requiring a first readdir or to
change the resource ID on the fly when the lock is granted.
As for the slave index FID, it is allocated dynamically from
FID_SEQ_QUOTA and is returned to the slave in the quota LVB when the
global quota lock is granted.

Signed-off-by: Johann Lombardi <johann@whamcloud.com>
Change-Id: I27552256cb96bbb88c0eeb3e7e3584d97476c9f1
Reviewed-on: http://review.whamcloud.com/2396
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Niu Yawei <niu@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1351 llapi: Handle special file types in llapi_path2fid()

In llapi_path2fid() check for errors from open() and ioctl() that
occur on special file types (device, socket, fifo).  Add a test in
sanity.sh that lfs path2fid will handle each type.

Change-Id: Ib411038179b3eff4191e25ac7320558a0ee1c76b
Signed-off-by: John L. Hammond <jhammond@tacc.utexas.edu>
Reviewed-on: http://review.whamcloud.com/2606
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
2.2.52

Change-Id: Ia2a129c0cb3103c94591869759b4a16ed19901a6
LU-1358 kernel: Kernel update [RHEL6.2 2.6.32-220.13.1.el6]

Update RHEL6.2 kernel to 2.6.32-220.13.1.el6.

Signed-off-by: yang sheng <ys@whamcloud.com>
Change-Id: Id6a1c8ef918d9df8f5948caedfd45688f73d4747
Reviewed-on: http://review.whamcloud.com/2653
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
LU-1347 build: remove the vim/emacs modelines

Delete all of the vim/emacs modelines.
Add copyright information for a few files.

Signed-off-by: Liang Zhen <liang@whamcloud.com>
Change-Id: Ic22ce8d8cc7786ffdb19937eb9f93a2d49aa2581
Reviewed-on: http://review.whamcloud.com/2658
Tested-by: Hudson
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>