[go: nahoru, domu]

History log of /drivers/staging/lustre/lustre/llite/file.c
Revision Date Author Comments
496a51bd64eb15f14cee3519f5b75b28d09567e3 18-Sep-2014 Julia Lawall <Julia.Lawall@lip6.fr> staging: lustre: llite: Use kzalloc and rewrite null tests

This patch removes some kzalloc-related macros and rewrites the
associated null tests to use !x rather than x == NULL.

A simplified version of the semantic patch that makes this change is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
@@
expression ptr;
statement S,S1;
@@

\(OBD_ALLOC\|OBD_ALLOC_WAIT\|OBD_ALLOC_PTR\|OBD_ALLOC_PTR_WAIT\)(ptr,...);
if (
+ !
ptr
- == NULL
) S else S1

@@
expression ptr,size;
@@

- OBD_ALLOC(ptr,size)
+ ptr = kzalloc(size, GFP_NOFS)

@@
expression ptr,size;
@@

- OBD_ALLOC_WAIT(ptr,size)
+ ptr = kzalloc(size, GFP_KERNEL)

@@
expression ptr,size;
@@

- OBD_ALLOC_PTR(ptr)
+ ptr = kzalloc(sizeof(*ptr), GFP_NOFS)

@@
expression ptr,size;
@@

- OBD_ALLOC_PTR_WAIT(ptr,size)
+ ptr = kzalloc(sizeof(*ptr), GFP_KERNEL)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16e0631db72cf70e6be1abb8892ec2928a16f716 09-Sep-2014 John L. Hammond <john.hammond@intel.com> staging/lustre: remove linux/lustre_common.h

Expand the two uses of ll_inode_blksize() and remove the then
unnecessary header lustre/include/linux/lustre_common.h.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/11495
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1cc30ab907dbb6222891cb277e4eb5605f17246f 09-Sep-2014 Greg Donald <gdonald@gmail.com> drivers: staging: lustre: Fix 'code indent should use tabs where possible' errors

Fix checkpatch.pl 'code indent should use tabs where possible' errors

Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
bdbb0512205f717301e93421c08765c9af2bbe1c 30-Aug-2014 Julia Lawall <Julia.Lawall@lip6.fr> staging: lustre: adjust spacing within pointer casts

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
type T;
expression e;
@@
(
- T *
+ T *
)
e
// </smpl>

This semantic patch just removes the cast and adds it back, but when it
does so, it follows the spacing conventions of Linux.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
34e1f2bb1e7ab87c2b950189f7ccae57a72f25a8 30-Aug-2014 Julia Lawall <Julia.Lawall@lip6.fr> staging: lustre: llite: expand the GOTO macro

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
identifier lbl;
@@

if (...)
GOTO(lbl,...);
+else
GOTO(lbl,...);

@@
identifier lbl,rc;
constant c;
expression e,e1;
@@

if (
- e
+ !e
)
- GOTO(lbl,\(rc\|c\));
-else GOTO(lbl,e1);
+ e1;
+goto lbl;

@@
identifier lbl,rc;
constant c;
expression e,e1;
@@

if (e)
- GOTO(lbl,e1);
-else GOTO(lbl,\(rc\|c\));
+ e1;
+goto lbl;

@@
identifier lbl;
expression e,e1,e2;
@@

if (e)
- GOTO(lbl,e1);
-else GOTO(lbl,e2);
+ e1;
+else e2;
+goto lbl;

// ------------------------------------------------------------------------

@@
identifier lbl,rc;
constant c;
@@

- GOTO(lbl,\(rc\|c\));
+ goto lbl;

@@
identifier lbl;
expression rc;
@@

- GOTO(lbl,rc);
+ rc;
+ goto lbl;
// </smpl>

The rules above the line deal with the case where the goto desination is
the same whether or not the the branch is taken. In that case, the goto is
created in just one instance after the if. This affects only the files
namei.c and llite_lib.c.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
376ef86bfa38137d6c50ca1a5e63fee69682c0d8 29-Aug-2014 John L. Hammond <john.hammond@intel.com> staging/lustre: remove linux/lustre_lib.h

Inline the only call to inode_init_lvb(). Move some definitions from
lustre/include/linux/lustre_lib.h to lustre/include/lustre_lib.h and
remove the first header.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a58a38ac0d94ccafdc1ae3c0ece750cbb9ca34c9 21-Aug-2014 Greg Donald <gdonald@gmail.com> drivers: staging: lustre: Fix space required before the open parenthesis '(' errors

Fix checkpatch.pl space required before the open parenthesis '(' errors

Signed-off-by: Greg Donald <gdonald@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21aef7d9d654416b8167ad8047a628d3968a97da 15-Aug-2014 Oleg Drokin <green@linuxhacker.ru> staging/lustre: get rid of obd_* typedefs

We have a bunch of typedefs for common things that made no sense
and hid the actual type from plain view.
Replace them with proper uXX or sXX types.
Exception is in lustre_idl.h where
they are replaced with __uXX and __sXX to be able to be included
in userspace

Signed-off-by: Oleg Drokin <green@linuxhacker.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c7b09efacf54210be511450768c0ee98071feb7f 15-Aug-2014 Oleg Drokin <green@linuxhacker.ru> staging/lustre/llite: Fix integer overflow in ll_fid2path

Reported by Dan Carpenter <dan.carpenter@oracle.com>

outsize = sizeof(*gfout) + gfin->gf_pathlen;

Where outsize is int and gf_pathlen is u32 from userspace
can lead to integer overflowwhere outsize is some small number
less than sizeof(*gfout)

Add a check for pathlen to be of sensical size.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/11412
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5476
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2b358b4ea5b2912726d872611089e790a8388b62 15-Aug-2014 Frank Zago <fzago@cray.com> staging/lustre/llite: optimize ll_fid2path()

The only parameter from userspace that matters is the length of the
buffer. We don't need to allocate then import the whole structure. By
importing only that length, we can save a memory allocation.

Add sparse annotations to that function.

Signed-off-by: frank zago <fzago@cray.com>
Reviewed-on: http://review.whamcloud.com/11167
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5389
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
b6ee56fe2afe10cf855de8d11b6097fa82c26163 15-Aug-2014 John L. Hammond <john.hammond@intel.com> staging/lustre/llite: hold inode mutex around ll_setattr_raw()

ll_setattr_raw() expects to be called with the inode mutex held so do
when calling it from ll_hsm_import().

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/11349
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5456
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
55f5a824b9e727eb159905475028d3cb52370276 13-Jul-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: remove LPX64 define

Just use the proper modifier type...

Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
b0f5aad587ea1fc3563d056609ee54a961ee1256 13-Jul-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: remove LPU64 define

Just use the proper modifier type...

Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
67a235f5e5893bc7dc86cf0e867fdb3f9041df18 12-Jul-2014 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: llite: remove ccflags from Makefile

Fix up the relative paths in the .c files to properly build with the
Makefile change.

Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Oleg Drokin <oleg.drokin@intel.com>
Cc: hpdd-discuss <hpdd-discuss@lists.01.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
875332d47f8c3a0c23ebe469bd8b31efb77d997a 23-Jun-2014 Dmitry Eremin <dmitry.eremin@intel.com> staging/lustre: fix frong ldlm flags type used

Fixed implicit conversion from 'unsigned long long' to 'int'.

Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-on: http://review.whamcloud.com/7799
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4023
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
130d1f956ab367bab855336279afa3b19acdc9a1 09-May-2014 Jeff Layton <jlayton@poochiereds.net> locks: ensure that fl_owner is always initialized properly in flock and lease codepaths

Currently, the fl_owner isn't set for flock locks. Some filesystems use
byte-range locks to simulate flock locks and there is a common idiom in
those that does:

fl->fl_owner = (fl_owner_t)filp;
fl->fl_start = 0;
fl->fl_end = OFFSET_MAX;

Since flock locks are generally "owned" by the open file description,
move this into the common flock lock setup code. The fl_start and fl_end
fields are already set appropriately, so remove the unneeded setting of
that in flock ops in those filesystems as well.

Finally, the lease code also sets the fl_owner as if they were owned by
the process and not the open file description. This is incorrect as
leases have the same ownership semantics as flock locks. Set them the
same way. The lease code doesn't actually use the fl_owner value for
anything, so this is more for consistency's sake than a bugfix.

Reported-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (Staging portion)
Acked-by: J. Bruce Fields <bfields@fieldses.org>
b42b15fdad3ebb790250041d1517acebb9bd56d9 04-Apr-2014 Al Viro <viro@zeniv.linux.org.uk> lustre: get rid of messing with iovecs

* switch to ->read_iter/->write_iter
* keep a pointer to iov_iter instead of iov/nr_segs
* do not modify iovecs; use iov_iter_truncate()/iov_iter_advance() and
a new primitive - iov_iter_reexpand() (expand previously truncated
iterator) istead.
* (racy) check for lustre VMAs intersecting with iovecs kept for now as
for_each_iov() loop.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
cb66a7a1f149ff705fa37cad6d1252b046e0ad4f 04-Mar-2014 Al Viro <viro@zeniv.linux.org.uk> kill generic_segment_checks()

all callers of ->aio_read() and ->aio_write() have iov/nr_segs already
checked - generic_segment_checks() done after that is just an odd way
to spell iov_length().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
7bc3dfa37ba6f6ea81c362eb1993bd20c0828eae 26-Apr-2014 Vitaly Osipov <vitaly.osipov@gmail.com> staging: lustre: check for integer overflow

In ll_ioctl_fiemap(), a user-supplied value is used to calculate a
length of a buffer which is later allocated with user data.

Signed-off-by: Vitaly Osipov <vitaly.osipov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ebdc4fc54d5defaa20417eabeb7a8d7b400fd53c 27-Apr-2014 Bobi Jam <bobijam.xu@intel.com> staging/lustre/llite: prevent buffer overflow in fiemap

lov_fiemap() does not take consider its @vallen parameter, which is
the max buffer size the caller can hold for the fiemap extents.

This patch fixes this and limits the max mapped fiemap extent count
to fit in the preallocted buffer.

This patch also fixes a memory out of bound write issue when the
fiemap call is only for detecting the number of existing extent.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Reviewed-on: http://review.whamcloud.com/9834
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4619
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Patrick Farrell <paf@cray.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
05289927d029ffed093424acac0b12f8ee06bfc2 27-Apr-2014 Andreas Dilger <andreas.dilger@intel.com> staging/lustre: pass fsync() range through RPC/IO stack

The Linux VFS and Lustre OST_SYNC RPC are both capable of specifying
fsync() on a sub-extent of the file {start, end} instead of the full
file. This allows less than the full amount of data to be flushed,
reducing or possibly eliminating the work needed before the syscall
can return.

However, the handling of sub-extent of the file for fsync was lost
with the move to CLIO on the client and OSD API on the server. They
were ignoring the passed {start, end} and using {0, OBD_OBJECT_EOF}
instead.

Return the ability to pass a sub-extent for fsync() from the client,
to the specific stripes/OSTs that need the sync operation, and pass
it down to the OSD. The ZFS OSD doesn't handle this yet, but there
is room for improvement in a separate patch.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-on: http://review.whamcloud.com/8626
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4388
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2d95f10e50da3eadd3f0a54f8b4b03db37ce879c 27-Apr-2014 John L. Hammond <john.hammond@intel.com> staging/lustre/llite: remove dead code

In llite remove unused declarations, parameters, types, and unused,
get-only, or set-only structure members. Add static and const
qualifiers to declarations where possible.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/9767
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
09aed8a59cb659f6cbdf5b1f5c3174e7e3d306aa 27-Apr-2014 Jinshan Xiong <jinshan.xiong@intel.com> staging/lustre/llite: access layout version under a lock

We used to access layout version under the protection of ldlm
lock, this introduces extra overhead for dlm lock matching.

In this patch, lli_layout_lock is introduced to access the layout
version. Also, when a layout lock is losing, we should tear down
mmap of the correspoding inode to avoid stale data accessing in the
future.

This is part of technical verification of replication.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-on: http://review.whamcloud.com/8689
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3254
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
44779340c6dcb8c858955c02b3aeef7d6b28a684 27-Apr-2014 Brian Behlendorf <behlendorf1@llnl.gov> staging/lustre: Limit reply buffer size

When allocating a reply buffer for the striping information don't
assume the unlikely worst case. Instead, assume the common case
and size the buffer based on the observed default ea/cookie size.

The default size is initialized to a single stripe and allowed to
grow up to an entire page if needed. This means that for smallish
filesystems (less than ~21 OSTs) where the worst case striping
information can fit in a single page there is effectively no
change. Only for larger filesystem will the default be less than
the maximum. This has a number of advantages.

* By limiting the default reply buffer size we avoid always
vmalloc()'ing the buffer because it exceeds four pages in size
and instead kmalloc() it. This prevents the client from
thrashing on the global vmalloc() spin lock.

* A reply buffer of exactly the right size (no larger) is allocated
in the overflow case. These larger reply buffers are still
unlikely to exceed the 16k limit where a vmalloc() will occur.

* Saves memory in the common case. Wide striped files exceeded
the default are expected to be the exception.

The reason this patch works is because the ptlrpc layer is smart
enough to reallocate the reply buffer when an overflow occurs.
Therefore the client doesn't have to drop the incoming reply and
send a new request with a larger reply buffer.

It's also worth mentioning that the reply buffer always contains
a significant amount of extra padding because they are rounded up
to the nearest power of two. This means that even files striped
wider than the default have a good chance of fitting in the
allocated reply buffer.

Also remove client eadatasize check in mdt xattr packing because
as said above client can handle -EOVERFLOW.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-on: http://review.whamcloud.com/6339
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3338
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8d97deb97dde884eb08d0c3b69ccfcc5a43b1350 27-Apr-2014 Bobi Jam <bobijam.xu@intel.com> staging/lustre/llite: issue OST_SYNC for fsync()

The last parameter @datasync of fsync() has following indication:
* if datasync=0, we'd always flush data and metadata
* if datasync=1, we'd always flush data while does not flush modifed
metadata unless that metadata is needed in order to allow a
subsequent data retrieval to be correctly handled. For example, a
change to the file size would require a metadata flush.

Lustre client can not tell the difference easily, and would issue
MDS_SYNC and OST_SYNC in all cases.

Signed-off-by: Bobi Jam <bobijam.xu@intel.com>
Reviewed-on: http://review.whamcloud.com/8684
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4388
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
e49634bbf2eb3d4cd31b562433af2104b25021c1 27-Apr-2014 Andreas Dilger <andreas.dilger@intel.com> staging/lustre: quiet console permission error messages

Quiet some common console error messages for permission errors
that can be hit in common cases.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-on: http://review.whamcloud.com/8988
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4522
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Faccini Bruno <bruno.faccini@intel.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0be19afa74b73a2132dc02b4fea0c6b5a2e29151 27-Apr-2014 Ann Koehler <amk@cray.com> staging/lustre: restore __GFP_WAIT flag to memalloc calls

In Lustre 2.4, the flags passed to the memory allocation functions are
translated from CFS enumeration values types to the kernel GFP
values by calling cfs_alloc_flags_to_gfp(). This function adds
__GFP_WAIT to all flags except CFS_ALLOC_ATOMIC. In 2.5, when
the cfs wrappers were dropped, cfs_alloc_flags_to_gfp() was
removed and the CFS_ALLOC_xxxx was simply replaced with __GFP_xxxx.
This means that most memory allocation calls are missing the
__GFP_WAIT flag. The result is that Lustre experiences more ENOMEM
errors, many of which the higher levels of Lustre do not handle
robustly.
Notes GFP_NOFS = __GFP_WAIT | __GFP_IO. So the patch replaces
__GFP_IO with GFP_NOFS.
Patch does not add __GFP_WAIT to GFP_IOFS. GFP_IOFS was not used in
Lustre 2.4 so it has never been used with __GFP_WAIT.

Signed-off-by: Ann Koehler <amk@cray.com>
Signed-off-by: Emoly Liu <emoly.liu@intel.com>
Reviewed-on: http://review.whamcloud.com/9223
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4357
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d0a0acc3ccf5a45c976fe94b15a1f9e9c4c78414 08-Mar-2014 Masanari Iida <standby24x7@gmail.com> staging: luster: Fix typo in lustre/llite

Fix spelling typo in lustre/lustre/llite

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f236f69b48727d6459c02bfabcadb9bfaacbe504 01-Mar-2014 Lai Siyao <lai.siyao@intel.com> lustre/llite: simplify dentry revalidate

Lustre client dentry validation is protected by LDLM lock, so
any time a dentry is found, it's valid and no need to revalidate
from MDS, and even it does, there is race that it may be
invalidated after revalidation is finished.

Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-on: http://review.whamcloud.com/7475
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3544
Reviewed-by: Peng Tao <bergwolf@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
63d42578d5797fb6aa77d44d33d4d6f3ed330b40 01-Mar-2014 Hongchao Zhang <hongchao.zhang@intel.com> lustre/recovery: free open/close request promptly

- For the non-create open or committed open, the open request
should be freed along with the close request as soon as the
close done, despite that the transno of open/close is
greater than the last committed transno known by client or not.

- Move the committed open request into another dedicated list,
that will avoid scanning a huge replay list on receiving each
reply (when there are many open files).

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/6665
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2613
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ec9bca9c51f98cb4ad43c738f2783f4e2bba2421 01-Mar-2014 John L. Hammond <john.hammond@intel.com> lustre/clio: honor O_NOATIME

Add a ci_noatime bit to struct cl_io. In ll_io_init() set this bit if
O_NOATIME is set in f_flags. Ensure that this bit is propagated down
to lower layers. In osc_io_read_start() don't update atime if this bit
is set. Add sanity test 39n to check that passing O_NOATIME to open()
is honored.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/7442
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3832
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
588de43a9b3ce72cb04b4b75e7b265b1d7c427a8 01-Mar-2014 Oleg Drokin <green@linuxhacker.ru> lustre/llite: Do not send parent dir fid in getattr by fid

Sending getattr by fid in this case is pointless, as the parent
might havelong changed and we have no control over it, but it's
irrelevant anyway, since we already have the child fid.

Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/7910
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3240
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: wangdi <di.wang@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
45b2a01074c54bdc00449ab8ad6f7af4a777b139 01-Mar-2014 John L. Hammond <john.hammond@intel.com> staging/lustre/llite: fix open lock matching in ll_md_blocking_ast()

In ll_md_blocking_ast() match open locks before all others, ensuring
that MDS_INODELOCK_OPEN is not cleared from bits by another open lock
with a different mode. Change the int flags parameter of
ll_md_real_close() to fmode_t fmode. Clean up verious style issues in
both functions.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-on: http://review.whamcloud.com/8718
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4429
Reviewed-by: Niu Yawei <yawei.niu@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
74c0da19c4ee842bf2ec880d4cef92858844934d 12-Feb-2014 Jinshan Xiong <jinshan.xiong@intel.com> staging/lustre/llite: remove lustre_generic_file_{read,write}

It looks like lustre_generic_file_{read,write} are a holdover from
2.6.19 where generic_file_aio_read() replaced generic_file_readv()
and cross-kernel interoperability was required for some period of
time. Lustre has since removed support for those older kernels, but
it looks like the wrappers were not deleted at that time. This patch
will delete them.

Pass &iocb->ki_pos as the last argument for these functions instead
of crw_pos, since this is the convention for other callers. Verify
that this is the same as the current crw_pos argument. This code can
likely be cleaned up further in a later patch.

Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38585ccc4627a9da381af9e912b756cfceb615a5 11-Feb-2014 Andreas Dilger <andreas.dilger@intel.com> staging/lustre/llite: fix O_TMPFILE/O_LOV_DELAY_CREATE conflict

In kernel 3.11 O_TMPFILE was introduced, but the open flag value
conflicts with the O_LOV_DELAY_CREATE flag 020000000 previously used
by Lustre-aware applications. O_LOV_DELAY_CREATE allows applications
to defer file layout and object creation from open time (the default)
until it can instead be specified by the application using an ioctl.

Instead of trying to find a non-conflicting O_LOV_DELAY_CREATE flag
or define a Lustre-specific flag that isn't of use to most/any other
filesystems, use (O_NOCTTY|FASYNC) as the new value. These flags
are not meaningful for newly-created regular files and should be
OK since O_LOV_DELAY_CREATE is only meaningful for new files.

I looked into using O_ACCMODE/FMODE_WRITE_IOCTL, which allows calling
ioctl() on the minimally-opened fd and is close to what is needed,
but that doesn't allow specifying the actual read or write mode for
the file, and fcntl(F_SETFL) doesn't allow O_RDONLY/O_WRONLY/O_RDWR
to be set after the file is opened.

Lustre-change: http://review.whamcloud.com/8312
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4209
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2eb90a757e9d953c9e2a8fce530422189992fb1b 22-Jan-2014 Peng Tao <bergwolf@gmail.com> staging/lustre/libcfs: remove cfs_capable

Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a720b790627c2e840f7eb58cf53fefc0428cc758 09-Dec-2013 JC Lafoucriere <jacques-charles.lafoucriere@cea.fr> staging/lustre/api: HSM import uses new released pattern

Import creates a released file using new RAID pattern flag
Import used a new ioctl() to implement the import in the
client kernel.

Lustre-change: http://review.whamcloud.com/6536
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3363
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
[Fix up kuid_t/guid_t conversion in llite/file.c -- Peng Tao]
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
960edbe307b1f23fa481bed2c6fa492649ea3f30 03-Dec-2013 Peng Tao <bergwolf@gmail.com> staging/lustre/llite: remove ll_file_get_iov_count

It exactly copies generic_segment_checks() except wrongly calling
access_ok(VERIFY_READ) for aio read range. Drop it and just call
generic_segment_checks() instead.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f4b406dc43af155715ad6bfd72d742db7d9c01ac 03-Dec-2013 Peng Tao <bergwolf@gmail.com> staging/lustre/llite: fix used uninitialized warning

Got below warning when building with sparc:
drivers/staging/lustre/lustre/llite/file.c: In function 'll_file_aio_write':
drivers/staging/lustre/lustre/llite/file.c:1247:9: warning: 'count' may be used uninitialized in this function [-Wuninitialized]
drivers/staging/lustre/lustre/llite/file.c: In function 'll_file_aio_read':
drivers/staging/lustre/lustre/llite/file.c:1188:9: warning: 'count' may be used uninitialized in this function [-Wuninitialized]

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7fc1f831d83f5abfebab964a6bdbc057ff1205a6 03-Dec-2013 Andrew Perepechko <andrew_perepechko@xyratex.com> staging/lustre/llite: extended attribute cache

This patch implements an extended attribute cache for
a Lustre client. It is organized as a write-through
cache: reads are performed from cache, updates are sent
synchronously to the MDS. An additional inode bit
MDS_INODELOCK_XATTR is added to protect the cache.

Lustre-change: http://review.whamcloud.com/5537
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2869
Signed-off-by: Andrew Perepechko <andrew_perepechko@xyratex.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
[remove extra GPL notice in original patch as kernel already has one
and it causes checkpatch error. -- Peng Tao]
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
48d23e612721d7e08dd8b13f5b8fbd12c6f88181 03-Dec-2013 Jinshan Xiong <jinshan.xiong@intel.com> staging/lustre/hsm: Add hsm_release feature.

HSM Release is one of the key feature of HSM. To perform HSM
release, clients need to acquire the file lease exclusivelt and
flush dirty cache from clients. A special close REQ will be sent
to the MDT to release the lease and get rid of OST objects.

Lustre-change: http://review.whamcloud.com/7028
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1333
Signed-off-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8cc93bc357cae8ace3e223bd584c382bee61a053 03-Dec-2013 Peng Tao <bergwolf@gmail.com> Revert "staging/lustre/nfs: writing to new files will return ENOENT"

This reverts commit ad8dbc93a464869f64365a2123b3491965df3b3e.

The original commit was reverted in Lustre tree this due to
interoperability problems with 2.1 servers. But I forgot to remove
it from my patch queue. sorry for the noise.

Cc: Patrick Farrell <paf@cray.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ad8dbc93a464869f64365a2123b3491965df3b3e 26-Nov-2013 Patrick Farrell <paf@cray.com> staging/lustre/nfs: writing to new files will return ENOENT

This happend with SLES11SP2 Lustre client, which in turn acts as an
NFS server, exporting a subtree of an Lustre fs through NFS.

We detected that whenever we are writing to a new file using, fx,
'echo blah > newfile', it will return ENOENT error. We found
out that this was caused by the anonymous dentry. In SLESS11SP2,
anonymous dentries are assigned '/' as the name, instead of an
empty string. When MDT handles the intent_open call, it will look
up the obj by the name if it is not an empty string, and thus
couldn't find it.

As MDS_OPEN_BY_FID is always set on this request, we never need
to send the name in this request. The fid is already available
and should be used in case the file has been renamed.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3544
Lustre-change: http://review.whamcloud.com/6920
Signed-off-by: Cheng Shao <cheng_shao@xyratex.com>
Signed-off-by: Patrick Farrell <paf@cray.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Alexey Shvetsov <alexxy@gentoo.org>
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5ea17d6cb9a72fbb7e5ab75868369bade2c5f2bc 21-Nov-2013 JC Lafoucriere <jacques-charles.lafoucriere@cea.fr> staging/lustre/llite: Access to released file triggers a restore

When a client accesses data in a released file,
or truncate it, client must trig a restore request.
During this restore, the client must not glimpse and
must use size from MDT. To bring the "restore is running"
information on the client we add a new t_state bit field
to mdt_info which will be used to carry transient file state.
To memorise this information in the inode we add a new flag
LLIF_FILE_RESTORING.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3432
Lustre-change: http://review.whamcloud.com/6537
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Tested-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d3a8a4e2d5e42e80625d734bb2bc5f71ecd9ffc1 19-Nov-2013 Jinshan Xiong <jinshan.xiong@intel.com> staging/lustre/hsm: Implementation of exclusive open

Proposed way to do exclusive open:

0. First of all, we have to perform most of the work in kernel space;

1. Client exclusively opens the file with IT_RELEASE_OPEN.
1.1 exclusive open means the open will fail if the file is being opened by somebody else;

2. the MDT will handle IT_RELEASE as follows:
2.1 Revoke OPEN_LOCK on this file, just request EX mode of MDS_INODELOCK_OPEN lock and
release it;
2.2 Acquire a rwsem, say open_rwsem, with write mode before trying to the file; for the
normal open, it should acquire read mode of open_rwsem;
2.3 Check if the file is already being opened by others, if not return with -EBUSY;
2.4 Check if the file can be released;
2.5 Set a special flag in struct mdt_file_data to mark this open is exclusive;
2.5 Release open rwsem.

>From now on, if the file is opened by others, it will mark mdt_file_data that the
exclusive open is broken.

3. Client: if IT_RELEASE_OPEN is finished successfully, and do followings:
3.1 Acquire full PW or EX extent lock to flush dirty cache;
3.2 Pack the handle of layout lock, data version and other attars;
3.3 Close the file with IT_RELEASE_CLOSE.

4. Back to MDT to handle IT_RELEASE CLOSE:
4.1 Grab the open_rwsem
4.2 Check if the exclusive open has ever been broken, in that case, the RELEASE process
will fail;
4.3 Verify the data version matches archive;
4.4 Grab EX layout lock
4.5 Swap the layout
4.6 Release EX layout lock
4.7 Close the exclusive open

Basically we avoid granting EX layout lock back to client and introduce exclusive open so
that we know it if the file has ever being accessed. I hope this can simplify things
a little bit. Also, exclusive open can be used to implement file lease.

In this patch, a framework of lease is implemented. However,
only exclusive lease is supported right now.

To apply a lease, MDS_OPEN_LEASE must be set to open the file, EX
mode open lock is returned to the client side to hold a lease. From
that time on, if this file is opened again by other processes, the
open lock will be revoked so the client who holds the lease will
know the lease is already broken by checking that open lock.

To release a lease, normal close is used. The client will revoke the
open lock before sending CLOSE request.

Lease can be applied in two ways. ll_lease_open()/close() can be
called directly if the lease holder is in kernel space; or if the
lease holder lives in user space, it has to open the file first and
then use ioctl() with command LL_IOC_SET_LEASE to apply a lease. The
lease holder has to poll the lease status itself.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2919
Lustre-change: http://review.whamcloud.com/6730
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
aa363d6a1c2c3e8260d9ec3f88bbecebcf276b2c 14-Nov-2013 James Simmons <uja.ornl@gmail.com> staging/lustre/autoconf: remove vectored fops tests

file_operations.readv/writev have been removed since v2.6.19
We can remove the test and the dead code.

Lustre-change: http://review.whamcloud.com/5343
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2800
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Christopher J. Morrone <chris.morrone.llnl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ea1db0814cbcf5e68ec948723d519f6a04e5e3f3 14-Nov-2013 John L. Hammond <john.hammond@intel.com> staging/lustre/llite: use correct FID in ll_och_fill()

When ll_intent_file_open() is called on a file with a stale dentry,
ll_och_fill() may incorrectly use the FID from the struct
ll_inode_info rather than the FID from the response body (which is the
correct FID for the close). Fix this, remove the ll_inode_info
parameter from ll_och_fill(), and move the call to ll_ioepoch_open()
from ll_och_fill() to ll_local_open().

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3233
Lustre-change: http://review.whamcloud.com/6695
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
89580e3792ee74b4873efbfdd5e2df1c3ae01d67 14-Nov-2013 Peng Tao <tao.peng@emc.com> staging/lustre/llite: restore ll_fiemap

It was removed by coan by mistake when first porting the code.

Signed-off-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ec83e611c21592c38744a5b86e1c8286ed1c4f90 14-Oct-2013 Joe Perches <joe@perches.com> staging: lustre: Use parenthesis around sizeof

Convert sizeof foo to sizeof(foo) to be more kernel style compatible.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
bef31c78041f3104a6ccf2cdba0825dc88a2d457 15-Sep-2013 Masanari Iida <standby24x7@gmail.com> staging: lustre: Fix typo in lustre/llite

Correct spelling typo in lustre/llite
Correct double words "to to"

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0bdd5ca553ebc15060dd72684710e0a0af4481b4 06-Aug-2013 Peng Tao <tao.peng@emc.com> staging/lustre: kiocb->ki_left is removed

We also missed ki_nbytes...

Cc: Kent Overstreet <koverstreet@google.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
0a3bdb00710bf253ba8ba8f645645f22297c7a04 03-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: remove RETURN macro

We have a kernel-wide function tracing system, so use that instead of
rolling a custom one just for one filesystem.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
23f14e79ace301c1e46b52344ce02e72254c57b6 03-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: remove EXIT macro

We have a kernel-wide function tracing system, so use that instead of
rolling a custom one just for one filesystem.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29aaf4962a3bce337d37176858ef1025b9f29cc4 02-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: remove ENTRY macro

We have a kernel-wide function tracing system, so use that instead of
rolling a custom one just for one filesystem.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8707c96e960d34f9dfee15240b1797084512fcef 02-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: remove ll_generic_permission()

It was a wrapper around generic_permission(), totally useless.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9c5fb72cc87a00262207d243aeb93e9c61f33573 02-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: remove ll_permission()

It was a wrapper around inode_permission(), totally useless.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6f014339718fac7597a53d155a2aa1714091a9af 02-Aug-2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org> staging: lustre: remove ll_generic_file_llseek_size()

It was a wrapper around generic_file_llseek_size(), totally useless.

Cc: Peng Tao <tao.peng@emc.com>
Cc: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
e2335e5d52b271dcc907db750b66aed6c021b594 22-Jul-2013 jcl <jacques-charles.lafoucriere@cea.fr> staging/lustre/llite: force lvb_data update after layout change

When a file is restored the layout lock is first
associated with the released layout and after restore
it has to be assocaited with the new layout. This patch
forces lvb_data update in ll_layout_fetch() even if one
is present (case for released->normal state change)

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3299
Lustre-change: http://review.whamcloud.com/6291
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5dd16419919787eed5a3ade9f03a58ecfc9e8630 22-Jul-2013 Jinshan Xiong <jinshan.xiong@intel.com> staging/lustre/layout: introduce new layout for released files

Released files now have a standard layout (with generation, pool, ...)
and a stripe count 0 and lmm_pattern flag LOV_PATTERN_F_RELEASED.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2482
Lustre-change: http://review.whamcloud.com/4816
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Signed-off-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f2145eae3d4d7c93fcbd7013bbf31db76bdd0ad4 22-Jul-2013 Bruce Korb <bruce_korb@xyratex.com> staging/lustre/dlmlock: compress out unused space

* lustre/include/lustre_dlm.h: Remove all bit fields and the unused
weighing callback procedure. respell LDLM_AST_DISCARD_DATA as
LDLM_FL_AST_DISCARD_DATA to match other flags.
* .gitignore: ignore emacs temporary files
* autogen.sh: rebuild the lock bits, if autogen is available.
* contrib/bit-masks/lustre_dlm_flags.def: define the ldlm_lock flags
* contrib/bit-masks/lustre_dlm_flags.tpl: template for emitting text
* contrib/bit-masks/Makefile: construct the .c and .h files
The .c file is for constructing a crash extension and is not
preserved.
* contrib/bit-masks/.gitignore: ignore built products
* lustre/contrib/wireshark/packet-lustre.c: use built files instead
of local versions of the defines.

In the rest of the modified sources, replace flag field references
with bit mask references.

* lustre/osc/osc_lock.c: removed osc_lock_weigh, too

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2771
Lustre-change: http://review.whamcloud.com/5312
Signed-off-by: Bruce Korb <bruce_korb@xyratex.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-by: Keith Mannthey <Keith.Mannthey@intel.com>
Reviewed-by: Keith Mannthey <keith.mannthey@intel.com>
Reviewed-by: <bruce.korb@gmail.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
79a8726a8453a2350f463fc3182bae43a5417181 22-Jul-2013 John L. Hammond <john.hammond@intel.com> staging/lustre/llite: check ll_prep_md_op_data() using IS_ERR()

In ll_file_ioctl() and ll_swap_layouts() check the result of
ll_prep_md_op_data() using IS_ERR().

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3283
Lustre-change: http://review.whamcloud.com/6275
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
e06c9dfec0f3738409b3936dcd0a4ae126acac07 22-Jul-2013 Dmitry Eremin <dmitry.eremin@intel.com> staging/lustre/llite: A not locked mutex can be unlocked.

In case of memory pressure a not locked mutex can be unlocked
in function ll_file_open(). This is not allowed and subsequent
behavior is not defined.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3157
Lustre-change: http://review.whamcloud.com/6028
Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John Hammond <johnlockwoodhammond@gmail.com>
Reviewed-by: Nikitas Angelinas <nikitas_angelinas@xyratex.com>
Reviewed-by: Sebastien Buisson <sebastien.buisson@bull.net>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
73863d83b8066b3f7973fd5671162c846b7aea8f 22-Jul-2013 John L. Hammond <john.hammond@intel.com> staging/lustre/llite: check alloc in ll_file_data_get, ll_dir_ioctl

In ll_file_data_get() and ll_dir_ioctl() return error on failed
allocations.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2753
Lustre-change: http://review.whamcloud.com/5845
Signed-off-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Sebastien Buisson <sebastien.buisson@bull.net>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1253b2e850850a66a71a512d2f830d4e0205ac72 22-Jul-2013 wang di <di.wang@intel.com> staging/lustre/llite: missing last bit in ll_have_md_lock

Missing the last bit during INODELOCK check in ll_have_md_lock.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3385
Lustre-change: http://review.whamcloud.com/6438
Signed-off-by: wang di <di.wang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
b1d2a127a98c2724129218eccd9431d342898da8 03-Jun-2013 Peng Tao <bergwolf@gmail.com> staging/lustre: silence lockdep warning in ll_md_blocking_ast

Got bellow lockdep warning during tests. It is false alarm though.

[ 1184.479097] =============================================
[ 1184.479187] [ INFO: possible recursive locking detected ]
[ 1184.479277] 3.10.0-rc3+ #13 Tainted: G C
[ 1184.479355] ---------------------------------------------
[ 1184.479444] mkdir/2215 is trying to acquire lock:
[ 1184.479521] (&(&dentry->d_lock)->rlock){+.+...}, at: [<ffffffffa06cc27c>] ll_md_blocking_ast+0x55c/0x655 [lustre]
[ 1184.479801]
but task is already holding lock:
[ 1184.479895] (&(&dentry->d_lock)->rlock){+.+...}, at: [<ffffffffa06cc1b1>] ll_md_blocking_ast+0x491/0x655 [lustre]
[ 1184.480101]
other info that might help us debug this:
[ 1184.480206] Possible unsafe locking scenario:

[ 1184.480300] CPU0
[ 1184.480340] ----
[ 1184.480380] lock(&(&dentry->d_lock)->rlock);
[ 1184.480458] lock(&(&dentry->d_lock)->rlock);
[ 1184.480536]
*** DEADLOCK ***

[ 1184.480761] May be due to missing lock nesting notation

[ 1184.480936] 4 locks held by mkdir/2215:
[ 1184.481037] #0: (sb_writers#11){.+.+.+}, at: [<ffffffff811531a9>] mnt_want_write+0x24/0x4b
[ 1184.481273] #1: (&type->i_mutex_dir_key#3/1){+.+.+.}, at: [<ffffffff81144fce>] kern_path_create+0x8c/0x144
[ 1184.481513] #2: (&sb->s_type->i_lock_key#19){+.+...}, at: [<ffffffffa06cc180>] ll_md_blocking_ast+0x460/0x655 [lustre]
[ 1184.481778] #3: (&(&dentry->d_lock)->rlock){+.+...}, at: [<ffffffffa06cc1b1>] ll_md_blocking_ast+0x491/0x655 [lustre]
[ 1184.482050]

Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f57d9a72d478e5278163eb1104e45ae69c92095c 03-Jun-2013 Emoly Liu <emoly.liu@intel.com> staging/lustre/mdt: set ATTR_xTIME_SET to make atime update properly

To make atime update properly between 1.8 client and 2.x server,
this patch includes the following fixes:
- if MDS_ATTR_xTIME is set without MDS_ATTR_xTIME_SET and the client
does not have OBD_CONNECT_FULL20, convert it to LA_xTIME in
mdt_setattr_unpack().
- set both MDS_ATTR_xTIME | MDS_ATTR_xTIME_SET for timestamps in
ll_prepare_close(). This allows us to fix the server-side timestamp
setting in the future.
- remove attr_unpack() and convert the flags from MDS_ATTR_ to LA_*
directly in mdt_attr_valid_xlate() instead.
- improve sanityn.sh test_23().

[picked llite part for upstream kernel submission]
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3036
Lustre-change: http://review.whamcloud.com/6327
Signed-off-by: Liu Ying <emoly.liu@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
bc9691761818e72527d67c5f9a01cc09df3c04cf 03-Jun-2013 JC Lafoucriere <jacques-charles.lafoucriere@cea.fr> staging/lustre/ldlm: suppress useless lock RPC for layout

In ldlm_lock_decref_internal() when l_lvb_data is freed to
reduce memory consumption, LDLM_FL_LVB_READY is not
cleared, so later when the lock is reused lvb is not
updated. But clearing LDLM_FL_LVB_READY forces layout refetch
at each file access, so the better is to remove the optimization.
The use case is after a restore in HSM.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3280
Lustre-change: http://review.whamcloud.com/6268
Signed-off-by: JC Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
65fb55d19421b9862beea398063816d2cb047907 03-Jun-2013 Niu Yawei <yawei.niu@intel.com> staging/lustre/clio: don't ignore layout on writeback

In some cases such as kernel writeback, we shouldn't ignore the
layout, otherwise, it could race with layout change undergoing.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3160
Lustre-change: http://review.whamcloud.com/6154
Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Signed-off-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Fan Yong <fan.yong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d7e09d0397e84eefbabfd9cb353221f3c6448d83 02-May-2013 Peng Tao <bergwolf@gmail.com> staging: add Lustre file system client support

Lustre is the most deployed distributed file system
in the HPC (High Performance Computing) world. The patch
adds its client side support.

The code is not very clean and needs to live in drivers/staging
for some time for continuing cleanup work. See
drivers/staging/lustre/TODO for details.

The code is based on Lustre master commit faefbfc04

commit faefbfc0460bc00f2ee4c1c1c86aa1e39b9eea49
Author: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Date: Tue Apr 30 23:05:21 2013 +0400

LU-3244 utils: tunefs.lustre should preserve virgin label

Plus a few under-review patches on Whamcloud gerrit:
3.8 kernel support:
http://review.whamcloud.com/#change,5973
http://review.whamcloud.com/#change,5974
http://review.whamcloud.com/#change,5768
http://review.whamcloud.com/#change,5781
http://review.whamcloud.com/#change,5763
http://review.whamcloud.com/#change,5613
http://review.whamcloud.com/#change,5655

3.9 kernel support:
http://review.whamcloud.com/#change,5898
http://review.whamcloud.com/#change,5899

Kconfig/Kbuild:
http://review.whamcloud.com/#change,4646
http://review.whamcloud.com/#change,4644

libcfs cleanup:
http://review.whamcloud.com/#change,2831
http://review.whamcloud.com/#change,4775
http://review.whamcloud.com/#change,4776
http://review.whamcloud.com/#change,4777
http://review.whamcloud.com/#change,4778
http://review.whamcloud.com/#change,4779
http://review.whamcloud.com/#change,4780

All starting/trailing whitespaces are removed, to match kernel
coding style. Also ran scripts/cleanfile on all lustre source files.

[maked the Kconfig depend on BROKEN as the recent procfs changes causes
this to fail - gregkh]

Signed-off-by: Peng Tao <tao.peng@emc.com>
Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>