Commit Graph

75 Commits

Author SHA1 Message Date
Mike Marshall
1808f8cc6c Orangefs: add verification to decode_dirents
Also add comments to decode_dirents and make it more readable.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-15 13:10:52 -05:00
Mike Marshall
be57366e14 Orangefs: make .statfs gossip_debug more complete.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-13 11:38:14 -05:00
Mike Marshall
569dbfc6b3 Orangefs: define a minimum compatible userspace version.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-13 11:36:25 -05:00
Mike Marshall
4c27b327b8 Orangefs: change ORANGEFS_VERSION from "Unknown" to "upstream"
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-13 11:34:59 -05:00
Mike Marshall
c817e266e4 Orangefs: rename orangefs_kernel_op_s.aio_ref_count to just ref_count.
The op structure's ref_count member hasn't got anything to do with
asynchronous I/O.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-13 11:29:05 -05:00
Mike Marshall
b3ae4755f5 Orangefs: implement .write_iter
Until now, orangefs_devreq_write_iter has just been a wrapper for
the old-fashioned orangefs_devreq_writev... linux would call
.write_iter with "struct kiocb *iocb" and "struct iov_iter *iter"
and .write_iter would just:

        return pvfs2_devreq_writev(iocb->ki_filp,
                                   iter->iov,
                                   iter->nr_segs,
                                   &iocb->ki_pos);

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-13 11:18:12 -05:00
Martin Brandenburg
7d2214858f orangefs: Fix some more global namespace pollution.
This only changes the names of things, so there is no functional change.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-04 16:21:46 -05:00
Richard Weinberger
c146c0b87f orangefs: Don't pollute global namespace
Prefix public functions with "orangefs_" do don't
pollute the global namespace.

This fixes a build issue on UML which also has block_signals().

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-04 16:21:37 -05:00
Julia Lawall
acaca36dd9 OrangeFS: constify export_operations structures
This export_operations structure is never modified, so declare it as const.
Most other structures of this type are already const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2016-01-04 11:06:12 -05:00
Mike Marshall
f987f4c28a Orangefs: don't trigger copy_attributes_to_inode from d_revalidate.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-30 13:04:28 -05:00
Arnd Bergmann
eb57bcc271 orangefs: fix typo in ornagefs_inode_lock
Orangefs fails to build on 32-bit SMP configurations due to a simple
misspelling, this does the obvious fix.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 575e946125 ("Orangefs: change pvfs2 filenames to orangefs")
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-28 10:31:21 -05:00
Nicholas Mc Guire
dde58ca436 Orangefs: use kzalloc for kmalloc + memset 0
This is an API consolidation only. The use of kmalloc + memset to 0
should be equivalent to kzalloc in this case.

Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-28 10:30:51 -05:00
Mike Marshall
62441fa53b Orangefs: validate resp.listxattr.returned_count
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-17 16:11:40 -05:00
Mike Marshall
fef8b67ce6 Orangefs: don't use deprecated xattr defines.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-17 14:36:34 -05:00
Martin Brandenburg
b09d10df5a orangefs: Do not unref if there is no bufmap.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
2015-12-17 14:35:45 -05:00
Martin Brandenburg
765a75b34a orangefs: Remove useless inline qualifier from bufmap functions.
All callers were outside of the file these functions were declared in,
so nothing was ever inlined anyway.

Further this happens before I/O and any speedup by not having to do a
call will be dwarfed by the time it takes to talk to the server.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
2015-12-17 14:34:53 -05:00
Martin Brandenburg
bf89f58432 orangefs: Change visibility of several bufmap helpers to static.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
2015-12-17 14:34:17 -05:00
Martin Brandenburg
a762ae6dc5 orangefs: Remove ``aligned'' upcall and downcall length macros.
There was previously MAX_ALIGNED_DEV_REQ_(UP|DOWN)SIZE macros which
evaluated to MAX_DEV_REQ_(UP|DOWN)SIZE+8. As it is unclear what this is
for, other than creating a situation where we accept more data than we
can parse, it is removed.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
2015-12-17 14:33:38 -05:00
Martin Brandenburg
90d26aa808 Orangefs: do not finalize bufmap if it was never initialized.
Found by the infant Orangefs fuzzer...

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-15 15:37:53 -05:00
Mike Marshall
ce6c414e17 Orangefs: Don't wait the old-fashioned way.
Get rid of add_wait_queue, set_current_state, etc, and use the
wait_event() model.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-14 14:54:46 -05:00
Mike Marshall
97f100277c Orangefs: de-uglify orangefs_devreq_writev, and devorangefs-req.c in general
AV dislikes many parts of orangefs_devreq_writev. Besides making
orangefs_devreq_writev more easily readable and better commented,
this patch makes an effort to address some of the problems:

 > The 5th is quietly ignored unless trailer_size is positive and
 > status is zero. If trailer_size > 0 && status == 0, you verify that
 > the length of the 5th segment is no more than trailer_size and copy
 > it to vmalloc'ed buffer. Without bothering to zero the rest of that
 > buffer out.

It was just wrong to allow a 5th segment that is not exactly equal to
trailer_size. Now that that's fixed, there's nothing to zero out in
the vmalloced buffer - it is exactly the right size to hold the
5th segment.

 > Another API bogosity: when the 5th segment is present, successful writev()
 > returns the sum of sizes of the first 4.

Added size of 5th segment to writev return...

 > if concatenation of the first 4 segments is longer than
 > 16 + sizeof(struct pvfs2_downcall_s) by no more than sizeof(long) => whine
 > and proceed with garbage.

If 4th segment isn't exactly sizeof(struct pvfs2_downcall_s), whine and fail.

 > if the 32bit value 4 bytes into op->downcall is zero and 64bit
 > value following it is non-zero, the latter is interpreted as the size of
 > trailer data.

The latter is what userspace claimed was the length of the trailer data.
The kernel module now compares it to the trailer iovec's iov_len as a
sanity check.

 > if there's no trailer, the 5th segment (if present) is completely ignored.

Whine and fail if there should be no trailer, yet a 5th segment is present.

 > if vmalloc fails, act as if status (32bit at offset 5 into
 > op->downcall) had been -ENOMEM and don't look at the 5th segment at all.

whine and fail with -ENOMEM.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-14 13:32:05 -05:00
Mike Marshall
b4cf67a2ba Orangef: remove overlooked old-style userspace debug parts
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-11 11:00:12 -05:00
Mike Marshall
b5e376ea8b Orangefs: improve comments
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-11 10:50:42 -05:00
Mike Marshall
7cec28e91d Orangefs: don't keep checking stuff in on Friday afternoon.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-11 10:46:22 -05:00
Mike Marshall
e91f1c8043 Orangefs: don't expose internal details of pathname resolution to userspace.
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-04 13:06:55 -05:00
Mike Marshall
575e946125 Orangefs: change pvfs2 filenames to orangefs
Also changed references within source files that referred to
header files whose names had changed.

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-04 12:56:14 -05:00
Yi Liu
8bb8aefd5a OrangeFS: Change almost all instances of the string PVFS2 to OrangeFS.
OrangeFS was formerly known as PVFS2 and retains the name in many places.

I leave the device /dev/pvfs2-req since this affects userspace.

I leave the filesystem type pvfs2 since this affects userspace. Further
the OrangeFS sysint library reads fstab for an entry of type pvfs2
independently of kernel mounts.

I leave extended attribute keys user.pvfs2 and system.pvfs2 as the
sysint library understands these.

I leave references to userspace binaries still named pvfs2.

I leave the filenames.

Signed-off-by: Yi Liu <yi9@clemson.edu>
[martin@omnibond.com: clairify above constraints and merge]
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-12-03 14:45:44 -05:00
Al Viro
555fa0fa61 fs: out of bounds on stack in iov_iter_advance
On Wed, Nov 11, 2015 at 10:19:48AM +0000, Al Viro wrote:

> I'll cook the minimal fixup for API change after I get some sleep and
> send it your way, unless somebody gets there first...

This should do it - switches ->ioctl() to pvfs2_inode_[gs]etxattr() and
converts xattr_handler ->[gs]et() to new API.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-16 11:27:24 -05:00
Martin Brandenburg
24c8d0804b Orangefs: Clean up pvfs2_devreq_read.
* Kick invalid arguments out early, so handling them does not clutter
  the code.
* Avoid possibility of race by not releasing lock until completely done.
* Do not leak ops (memory) in certain error condition.
* Check for more error conditions.
* Put module name in all error and debug logs.
* Document behavior.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 14:50:20 -05:00
Martin Brandenburg
f0ed4418d4 Orangefs: Remove upcall trailers which are not used.
Also removes remnants of iox (readx/writex) which previously used
trailers, but no longer exist.

Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 14:43:11 -05:00
Mike Marshall
b5bbc84328 Orangefs: fix gossip statement
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 14:39:15 -05:00
Martin Brandenburg
6d0dd7684c Orangefs: Remove unused #defines from signal blocking code.
Signed-off-by: Martin Brandenburg <martin@omnibond.com>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 13:36:51 -05:00
Mike Marshall
3f1b6947dc Orangefs: set pos after generic_write_checks
if we are appending, generic_write_checks would have updated
pos to the end of the file...

Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 13:05:11 -05:00
Al Viro
8092895f75 orangefs: validate the response in decode_dirents()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 12:02:12 -05:00
Al Viro
ade1d48b78 orangefs: don't leave uninitialized data in ->trailer_buf
minimal fix; it would be better to reject such requests outright.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:57:34 -05:00
Al Viro
9be68b0871 orangefs: get rid of dec_string and enc_string
The latter is never used, the former has one user and would be
better off spelled out right there.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:56:17 -05:00
Al Viro
ef4af94edc orangefs: switch decode_dirents() to use of kcalloc()
gets rid of multiplication overflow

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:55:39 -05:00
Al Viro
5714156be2 orangefs: sanitize pvfs2_convert_time_field()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:54:05 -05:00
Al Viro
aada5c5872 orangefs: kill pointless ->link() and ->mknod()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:53:24 -05:00
Al Viro
75992b0fa9 pvfs2_fill_sb(): use kzalloc()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:52:52 -05:00
Al Viro
5c0dbbc64b orangefs: kill struct pvfs2_mount_sb_info_s
The only reason for that thing used to be the API of mount_nodev()
callback;  since we are calling pvfs2_fill_sb() ourselves now,
we don't have to shove everything into a single structure.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:39:31 -05:00
Al Viro
b05a785109 orangefs: double iput() in case of d_make_root() failure
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:38:51 -05:00
Al Viro
16742f2d7c orangefs: use get_user_pages_fast(), not get_user_pages()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:38:02 -05:00
Al Viro
a0435ca18e orangefs: kill kmap/kunmap wrappers
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:37:19 -05:00
Al Viro
74f68fce2a orangefs: make pvfs2_inode_read() take iov_iter
... and make the only caller use page-backed iov_iter,
getting rid of kmap/kunmap *and* of the bug with
attempted use of iovec-backed copy_page_to_iter()
on a kernel pointer.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:36:31 -05:00
Al Viro
0071ed1ec6 orangefs: make do_readv_writev() take iov_iter
no need to build a copy of what the caller already has;
what's more, we want the one given to caller properly
advanced *and* we shouldn't depend upon it being an
iovec-backed one.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:35:28 -05:00
Al Viro
dc4067f671 orangefs: don't bother with splitting iovecs
copy_page_{to,from}_iter() advances it just fine *and* it has no
problem with partially consumed segments.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:23:02 -05:00
Al Viro
3c2fcfcb68 orangefs: make wait_for_direct_io() take iov_iter
incidentally, insane or compromised server returning *more* than
requested on read should not oops the kernel - initialize the
iov_iter for read according to the iovec we've got.  That's why
pvfs_bufmap_copy_to_iovec() needed a separate size argument - we
shouldn't abuse iov_iter_count(iter) for passing that.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:21:37 -05:00
Al Viro
a5c126a522 orangefs: make precopy_buffers() take iov_iter
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:18:50 -05:00
Al Viro
5f0e3c953f orangefs: make postcopy_buffers() take iov_iter
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Mike Marshall <hubcap@omnibond.com>
2015-11-13 11:11:55 -05:00