cascardo/linux.git
8 years agohpfs: switch to ->iterate_shared()
Al Viro [Thu, 12 May 2016 23:44:04 +0000 (19:44 -0400)]
hpfs: switch to ->iterate_shared()

NOTE: the only reason we can do that without ->i_rdir_offs races
is that hpfs_lock() serializes everything in there anyway.  It's
not that hard to get rid of, but not as part of this series...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agohpfs: handle allocation failures in hpfs_add_pos()
Al Viro [Thu, 12 May 2016 23:35:57 +0000 (19:35 -0400)]
hpfs: handle allocation failures in hpfs_add_pos()

pr_err() is nice, but we'd better propagate the error
to caller and not proceed to violate the invariants
(namely, "every file with f_pos tied to directory block
should have its address visible in per-inode array").

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agogfs2: switch to ->iterate_shared()
Al Viro [Thu, 12 May 2016 21:00:20 +0000 (17:00 -0400)]
gfs2: switch to ->iterate_shared()

protected by glock and already used without locking the directory
by gfs2_get_name()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agof2fs: switch to ->iterate_shared()
Al Viro [Tue, 10 May 2016 20:41:13 +0000 (16:41 -0400)]
f2fs: switch to ->iterate_shared()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoafs: switch to ->iterate_shared()
Al Viro [Tue, 10 May 2016 18:27:44 +0000 (14:27 -0400)]
afs: switch to ->iterate_shared()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agobefs: switch to ->iterate_shared()
Al Viro [Tue, 10 May 2016 18:24:57 +0000 (14:24 -0400)]
befs: switch to ->iterate_shared()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agobefs: constify stuff a bit
Al Viro [Tue, 10 May 2016 18:24:06 +0000 (14:24 -0400)]
befs: constify stuff a bit

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoisofs: switch to ->iterate_shared()
Al Viro [Mon, 9 May 2016 16:53:03 +0000 (12:53 -0400)]
isofs: switch to ->iterate_shared()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoget_acorn_filename(): deobfuscate a bit
Al Viro [Thu, 5 May 2016 14:48:47 +0000 (10:48 -0400)]
get_acorn_filename(): deobfuscate a bit

Lots of Idiotic Silly Parentheses is -> that way...  What that
condition checks is that there's exactly 32 bytes between the
end of name and the end of entire drectory record.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agobtrfs: switch to ->iterate_shared()
Al Viro [Wed, 4 May 2016 20:24:53 +0000 (16:24 -0400)]
btrfs: switch to ->iterate_shared()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agologfs: no need to lock directory in lseek
Al Viro [Wed, 4 May 2016 20:24:04 +0000 (16:24 -0400)]
logfs: no need to lock directory in lseek

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoswitch ecryptfs to ->iterate_shared
Al Viro [Wed, 4 May 2016 20:21:20 +0000 (16:21 -0400)]
switch ecryptfs to ->iterate_shared

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoMerge branch 'for-linus' into work.lookups
Al Viro [Mon, 9 May 2016 15:41:30 +0000 (11:41 -0400)]
Merge branch 'for-linus' into work.lookups

8 years ago9p: switch to ->iterate_shared()
Al Viro [Sun, 1 May 2016 04:08:03 +0000 (00:08 -0400)]
9p: switch to ->iterate_shared()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agofat: switch to ->iterate_shared()
Al Viro [Sun, 1 May 2016 03:26:25 +0000 (23:26 -0400)]
fat: switch to ->iterate_shared()

... and make that weird ioctl lock directory only shared.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoromfs, squashfs: switch to ->iterate_shared()
Al Viro [Sun, 1 May 2016 03:08:45 +0000 (23:08 -0400)]
romfs, squashfs: switch to ->iterate_shared()

don't need to lock directory in ->llseek(), either

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agomore trivial ->iterate_shared conversions
Al Viro [Sun, 1 May 2016 02:37:34 +0000 (22:37 -0400)]
more trivial ->iterate_shared conversions

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agolustre: don't need to lock inode in directory lseek
Al Viro [Thu, 21 Apr 2016 00:49:14 +0000 (20:49 -0400)]
lustre: don't need to lock inode in directory lseek

Note that lustre has its private mutex protecting directory pagecache;
if they ever remove it, they'll need to be careful with PageChecked()
use.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agokernfs: no point locking directory around that generic_file_llseek()
Al Viro [Wed, 20 Apr 2016 23:59:01 +0000 (19:59 -0400)]
kernfs: no point locking directory around that generic_file_llseek()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoconfigfs_readdir(): make safe under shared lock
Al Viro [Wed, 20 Apr 2016 23:50:05 +0000 (19:50 -0400)]
configfs_readdir(): make safe under shared lock

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agonfs: per-name sillyunlink exclusion
Al Viro [Fri, 29 Apr 2016 03:56:31 +0000 (23:56 -0400)]
nfs: per-name sillyunlink exclusion

use d_alloc_parallel() for sillyunlink/lookup exclusion and
explicit rwsem (nfs_rmdir() being a writer and nfs_call_unlink() -
a reader) for rmdir/sillyunlink one.

That ought to make lookup/readdir/!O_CREAT atomic_open really
parallel on NFS.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoget_rock_ridge_filename(): handle malformed NM entries
Al Viro [Thu, 5 May 2016 20:25:35 +0000 (16:25 -0400)]
get_rock_ridge_filename(): handle malformed NM entries

Payloads of NM entries are not supposed to contain NUL.  When we run
into such, only the part prior to the first NUL goes into the
concatenation (i.e. the directory entry name being encoded by a bunch
of NM entries).  We do stop when the amount collected so far + the
claimed amount in the current NM entry exceed 254.  So far, so good,
but what we return as the total length is the sum of *claimed*
sizes, not the actual amount collected.  And that can grow pretty
large - not unlimited, since you'd need to put CE entries in
between to be able to get more than the maximum that could be
contained in one isofs directory entry / continuation chunk and
we are stop once we'd encountered 32 CEs, but you can get about 8Kb
easily.  And that's what will be passed to readdir callback as the
name length.  8Kb __copy_to_user() from a buffer allocated by
__get_free_page()

Cc: stable@vger.kernel.org # 0.98pl6+ (yes, really)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoecryptfs: fix handling of directory opening
Al Viro [Wed, 4 May 2016 18:04:13 +0000 (14:04 -0400)]
ecryptfs: fix handling of directory opening

First of all, trying to open them r/w is idiocy; it's guaranteed to fail.
Moreover, assigning ->f_pos and assuming that everything will work is
blatantly broken - try that with e.g. tmpfs as underlying layer and watch
the fireworks.  There may be a non-trivial amount of state associated with
current IO position, well beyond the numeric offset.  Using the single
struct file associated with underlying inode is really not a good idea;
we ought to open one for each ecryptfs directory struct file.

Additionally, file_operations both for directories and non-directories are
full of pointless methods; non-directories should *not* have ->iterate(),
directories should not have ->flush(), ->fasync() and ->splice_read().

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agonfs: switch to ->iterate_shared()
Al Viro [Thu, 28 Apr 2016 23:52:56 +0000 (19:52 -0400)]
nfs: switch to ->iterate_shared()

aside of the usual care about seeding dcache from readdir, we need
to be careful about the pagecache evictions here.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agolookup_open(): lock the parent shared unless O_CREAT is given
Al Viro [Thu, 28 Apr 2016 23:35:16 +0000 (19:35 -0400)]
lookup_open(): lock the parent shared unless O_CREAT is given

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agolookup_open(): put the dentry fed to ->lookup() or ->atomic_open() into in-lookup...
Al Viro [Thu, 28 Apr 2016 15:50:59 +0000 (11:50 -0400)]
lookup_open(): put the dentry fed to ->lookup() or ->atomic_open() into in-lookup hash

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agolookup_open(): expand the call of real_lookup()
Al Viro [Thu, 28 Apr 2016 15:19:43 +0000 (11:19 -0400)]
lookup_open(): expand the call of real_lookup()

... and lose the duplicate IS_DEADDIR() - we'd already checked that.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoatomic_open(): reorder and clean up a bit
Al Viro [Thu, 28 Apr 2016 06:03:55 +0000 (02:03 -0400)]
atomic_open(): reorder and clean up a bit

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agolookup_open(): lift the "fallback to !O_CREAT" logics from atomic_open()
Al Viro [Wed, 27 Apr 2016 23:14:10 +0000 (19:14 -0400)]
lookup_open(): lift the "fallback to !O_CREAT" logics from atomic_open()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoatomic_open(): be paranoid about may_open() return value
Al Viro [Wed, 27 Apr 2016 19:47:45 +0000 (15:47 -0400)]
atomic_open(): be paranoid about may_open() return value

It should never return positives; however, with Linux S&M crowd
involved, no bogosity is impossible.  Results would be unpleasant...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoatomic_open(): delay open_to_namei_flags() until the method call
Al Viro [Wed, 27 Apr 2016 18:13:10 +0000 (14:13 -0400)]
atomic_open(): delay open_to_namei_flags() until the method call

nobody else needs that transformation.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agodo_last(): take fput() on error after opening to out:
Al Viro [Wed, 27 Apr 2016 07:14:20 +0000 (03:14 -0400)]
do_last(): take fput() on error after opening to out:

make it conditional on *opened & FILE_OPENED; in addition to getting
rid of exit_fput: thing, it simplifies atomic_open() cleanup on
may_open() failure.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agodo_last(): get rid of duplicate ELOOP check
Al Viro [Wed, 27 Apr 2016 06:52:55 +0000 (02:52 -0400)]
do_last(): get rid of duplicate ELOOP check

may_open() will catch it

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoatomic_open(): massage the create_error logics a bit
Al Viro [Wed, 27 Apr 2016 06:36:39 +0000 (02:36 -0400)]
atomic_open(): massage the create_error logics a bit

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoatomic_open(): consolidate "overridden ENOENT" in open-yourself cases
Al Viro [Wed, 27 Apr 2016 20:52:17 +0000 (16:52 -0400)]
atomic_open(): consolidate "overridden ENOENT" in open-yourself cases

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoatomic_open(): don't bother with EEXIST check - it's done in do_last()
Al Viro [Wed, 27 Apr 2016 17:25:33 +0000 (13:25 -0400)]
atomic_open(): don't bother with EEXIST check - it's done in do_last()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoMerge branch 'for-linus' into work.lookups
Al Viro [Mon, 2 May 2016 23:49:46 +0000 (19:49 -0400)]
Merge branch 'for-linus' into work.lookups

8 years agolookup_open(): expand the call of vfs_create()
Al Viro [Tue, 26 Apr 2016 18:17:56 +0000 (14:17 -0400)]
lookup_open(): expand the call of vfs_create()

Lift IS_DEADDIR handling up into the part common with atomic_open(),
remove it from the latter.  Collapse permission checks into the
call of may_o_create(), getting it closer to atomic_open() case.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agopath_openat(): take O_PATH handling out of do_last()
Al Viro [Tue, 26 Apr 2016 04:02:50 +0000 (00:02 -0400)]
path_openat(): take O_PATH handling out of do_last()

do_last() and lookup_open() simpler that way and so does O_PATH
itself.  As it bloody well should: we find what the pathname
resolves to, same way as in stat() et.al. and associate it with
FMODE_PATH struct file.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agosimple local filesystems: switch to ->iterate_shared()
Al Viro [Thu, 21 Apr 2016 03:42:46 +0000 (23:42 -0400)]
simple local filesystems: switch to ->iterate_shared()

no changes needed (XFS isn't simple, but it has the same parallelism
in the interesting parts exercised from CXFS).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agodcache_{readdir,dir_lseek}() users: switch to ->iterate_shared
Al Viro [Wed, 20 Apr 2016 23:52:15 +0000 (19:52 -0400)]
dcache_{readdir,dir_lseek}() users: switch to ->iterate_shared

no need to lock directory in dcache_dir_lseek(), while we are
at it - per-struct file exclusion is enough.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agocifs: switch to ->iterate_shared()
Al Viro [Wed, 20 Apr 2016 21:40:47 +0000 (17:40 -0400)]
cifs: switch to ->iterate_shared()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agofuse: switch to ->iterate_shared()
Al Viro [Wed, 20 Apr 2016 21:30:32 +0000 (17:30 -0400)]
fuse: switch to ->iterate_shared()

Switch dcache pre-seeding on readdir to d_alloc_parallel();
nothing else is needed.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoswitch all procfs directories ->iterate_shared()
Al Viro [Wed, 20 Apr 2016 21:13:54 +0000 (17:13 -0400)]
switch all procfs directories ->iterate_shared()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoproc_sys_fill_cache(): switch to d_alloc_parallel()
Al Viro [Wed, 20 Apr 2016 20:36:09 +0000 (16:36 -0400)]
proc_sys_fill_cache(): switch to d_alloc_parallel()

make it usable with directory locked shared

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoproc_fill_cache(): switch to d_alloc_parallel()
Al Viro [Wed, 20 Apr 2016 20:31:31 +0000 (16:31 -0400)]
proc_fill_cache(): switch to d_alloc_parallel()

... making it usable with directory locked shared

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agointroduce a parallel variant of ->iterate()
Al Viro [Thu, 21 Apr 2016 03:08:32 +0000 (23:08 -0400)]
introduce a parallel variant of ->iterate()

New method: ->iterate_shared().  Same arguments as in ->iterate(),
called with the directory locked only shared.  Once all filesystems
switch, the old one will be gone.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agogive readdir(2)/getdents(2)/etc. uniform exclusion with lseek()
Al Viro [Wed, 20 Apr 2016 21:08:21 +0000 (17:08 -0400)]
give readdir(2)/getdents(2)/etc. uniform exclusion with lseek()

same as read() on regular files has, and for the same reason.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoparallel lookups: actual switch to rwsem
Al Viro [Fri, 15 Apr 2016 19:08:36 +0000 (15:08 -0400)]
parallel lookups: actual switch to rwsem

ta-da!

The main issue is the lack of down_write_killable(), so the places
like readdir.c switched to plain inode_lock(); once killable
variants of rwsem primitives appear, that'll be dealt with.

lockdep side also might need more work

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoparallel lookups machinery, part 4 (and last)
Al Viro [Fri, 15 Apr 2016 07:33:13 +0000 (03:33 -0400)]
parallel lookups machinery, part 4 (and last)

If we *do* run into an in-lookup match, we need to wait for it to
cease being in-lookup.  Fortunately, we do have unused space in
in-lookup dentries - d_lru is never looked at until it stops being
in-lookup.

So we can stash a pointer to wait_queue_head from stack frame of
the caller of ->lookup().  Some precautions are needed while
waiting, but it's not that hard - we do hold a reference to dentry
we are waiting for, so it can't go away.  If it's found to be
in-lookup the wait_queue_head is still alive and will remain so
at least while ->d_lock is held.  Moreover, the condition we
are waiting for becomes true at the same point where everything
on that wq gets woken up, so we can just add ourselves to the
queue once.

d_alloc_parallel() gets a pointer to wait_queue_head_t from its
caller; lookup_slow() adjusted, d_add_ci() taught to use
d_alloc_parallel() if the dentry passed to it happens to be
in-lookup one (i.e. if it's been called from the parallel lookup).

That's pretty much it - all that remains is to switch ->i_mutex
to rwsem and have lookup_slow() take it shared.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoparallel lookups machinery, part 3
Al Viro [Fri, 15 Apr 2016 06:42:04 +0000 (02:42 -0400)]
parallel lookups machinery, part 3

We will need to be able to check if there is an in-lookup
dentry with matching parent/name.  Right now it's impossible,
but as soon as start locking directories shared such beasts
will appear.

Add a secondary hash for locating those.  Hash chains go through
the same space where d_alias will be once it's not in-lookup anymore.
Search is done under the same bitlock we use for modifications -
with the primary hash we can rely on d_rehash() into the wrong
chain being the worst that could happen, but here the pointers are
buggered once it's removed from the chain.  On the other hand,
the chains are not going to be long and normally we'll end up
adding to the chain anyway.  That allows us to avoid bothering with
->d_lock when doing the comparisons - everything is stable until
removed from chain.

New helper: d_alloc_parallel().  Right now it allocates, verifies
that no hashed and in-lookup matches exist and adds to in-lookup
hash.

Returns ERR_PTR() for error, hashed match (in the unlikely case it's
been found) or new dentry.  In-lookup matches trigger BUG() for
now; that will change in the next commit when we introduce waiting
for ongoing lookup to finish.  Note that in-lookup matches won't be
possible until we actually go for shared locking.

lookup_slow() switched to use of d_alloc_parallel().

Again, these commits are separated only for making it easier to
review.  All this machinery will start doing something useful only
when we go for shared locking; it's just that the combination is
too large for my taste.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoparallel lookups machinery, part 2
Al Viro [Fri, 15 Apr 2016 04:58:55 +0000 (00:58 -0400)]
parallel lookups machinery, part 2

We'll need to verify that there's neither a hashed nor in-lookup
dentry with desired parent/name before adding to in-lookup set.

One possible solution would be to hold the parent's ->d_lock through
both checks, but while the in-lookup set is relatively small at any
time, dcache is not.  And holding the parent's ->d_lock through
something like __d_lookup_rcu() would suck too badly.

So we leave the parent's ->d_lock alone, which means that we watch
out for the following scenario:
* we verify that there's no hashed match
* existing in-lookup match gets hashed by another process
* we verify that there's no in-lookup matches and decide
that everything's fine.

Solution: per-directory kinda-sorta seqlock, bumped around the times
we hash something that used to be in-lookup or move (and hash)
something in place of in-lookup.  Then the above would turn into
* read the counter
* do dcache lookup
* if no matches found, check for in-lookup matches
* if there had been none of those either, check if the
counter has changed; repeat if it has.

The "kinda-sorta" part is due to the fact that we don't have much spare
space in inode.  There is a spare word (shared with i_bdev/i_cdev/i_pipe),
so the counter part is not a problem, but spinlock is a different story.

We could use the parent's ->d_lock, and it would be less painful in
terms of contention, for __d_add() it would be rather inconvenient to
grab; we could do that (using lock_parent()), but...

Fortunately, we can get serialization on the counter itself, and it
might be a good idea in general; we can use cmpxchg() in a loop to
get from even to odd and smp_store_release() from odd to even.

This commit adds the counter and updating logics; the readers will be
added in the next commit.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agobeginning of transition to parallel lookups - marking in-lookup dentries
Al Viro [Thu, 14 Apr 2016 23:52:13 +0000 (19:52 -0400)]
beginning of transition to parallel lookups - marking in-lookup dentries

marked as such when (would be) parallel lookup is about to pass them
to actual ->lookup(); unmarked when
* __d_add() is about to make it hashed, positive or not.
* __d_move() (from d_splice_alias(), directly or via
__d_unalias()) puts a preexisting dentry in its place
* in caller of ->lookup() if it has escaped all of the
above.  Bug (WARN_ON, actually) if it reaches the final dput()
or d_instantiate() while still marked such.

As the result, we are guaranteed that for as long as the flag is
set, dentry will
* remain negative unhashed with positive refcount
* never have its ->d_alias looked at
* never have its ->d_lru looked at
* never have its ->d_parent and ->d_name changed

Right now we have at most one such for any given parent directory.
With parallel lookups that restriction will weaken to
* only exist when parent is locked shared
* at most one with given (parent,name) pair (comparison of
names is according to ->d_compare())
* only exist when there's no hashed dentry with the same
(parent,name)

Transition will take the next several commits; unfortunately, we'll
only be able to switch to rwsem at the end of this series.  The
reason for not making it a single patch is to simplify review.

New primitives: d_in_lookup() (a predicate checking if dentry is in
the in-lookup state) and d_lookup_done() (tells the system that
we are done with lookup and if it's still marked as in-lookup, it
should cease to be such).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years ago__d_add(): don't drop/regain ->d_lock
Al Viro [Thu, 14 Apr 2016 23:40:56 +0000 (19:40 -0400)]
__d_add(): don't drop/regain ->d_lock

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agolookup_slow(): bugger off on IS_DEADDIR() from the very beginning
Al Viro [Thu, 14 Apr 2016 23:33:34 +0000 (19:33 -0400)]
lookup_slow(): bugger off on IS_DEADDIR() from the very beginning

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agonfs: missing wakeup in nfs_unblock_sillyrename()
Al Viro [Sat, 30 Apr 2016 20:38:39 +0000 (16:38 -0400)]
nfs: missing wakeup in nfs_unblock_sillyrename()

will be needed as soon as lookups are not serialized by ->i_mutex

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agomake ext2_get_page() and friends work without external serialization
Al Viro [Fri, 22 Apr 2016 19:06:44 +0000 (15:06 -0400)]
make ext2_get_page() and friends work without external serialization

Right now ext2_get_page() (and its analogues in a bunch of other filesystems)
relies upon the directory being locked - the way it sets and tests Checked and
Error bits would be racy without that.  Switch to a slightly different scheme,
_not_ setting Checked in case of failure.  That way the logics becomes
if Checked => OK
else if Error => fail
else if !validate => fail
else => OK
with validation setting Checked or Error on success and failure resp. and
returning which one had happened.  Equivalent to the current logics, but unlike
the current logics not sensitive to the order of set_bit, test_bit getting
reordered by CPU, etc.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoovl_lookup_real(): use lookup_one_len_unlocked()
Al Viro [Thu, 14 Apr 2016 23:20:29 +0000 (19:20 -0400)]
ovl_lookup_real(): use lookup_one_len_unlocked()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoreconnect_one(): use lookup_one_len_unlocked()
Al Viro [Thu, 14 Apr 2016 23:12:42 +0000 (19:12 -0400)]
reconnect_one(): use lookup_one_len_unlocked()

... and explain the non-obvious logics in case when lookup yields
a different dentry.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoreiserfs: open-code reiserfs_mutex_lock_safe() in reiserfs_unpack()
Al Viro [Fri, 15 Apr 2016 18:44:31 +0000 (14:44 -0400)]
reiserfs: open-code reiserfs_mutex_lock_safe() in reiserfs_unpack()

... and have it use inode_lock()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoorangefs: don't open-code inode_lock/inode_unlock
Al Viro [Tue, 12 Apr 2016 04:43:20 +0000 (00:43 -0400)]
orangefs: don't open-code inode_lock/inode_unlock

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoocfs2: don't open-code inode_lock/inode_unlock
Al Viro [Tue, 12 Apr 2016 04:41:01 +0000 (00:41 -0400)]
ocfs2: don't open-code inode_lock/inode_unlock

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoconfigfs_detach_prep(): make sure that wait_mutex won't go away
Al Viro [Tue, 12 Apr 2016 04:37:59 +0000 (00:37 -0400)]
configfs_detach_prep(): make sure that wait_mutex won't go away

grab a reference to dentry we'd got the sucker from, and return
that dentry via *wait, rather than just returning the address of
->i_mutex.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agokernfs: use lookup_one_len_unlocked()
Al Viro [Mon, 11 Apr 2016 12:42:55 +0000 (08:42 -0400)]
kernfs: use lookup_one_len_unlocked()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agosecurity_d_instantiate(): move to the point prior to attaching dentry to inode
Al Viro [Mon, 11 Apr 2016 04:53:26 +0000 (00:53 -0400)]
security_d_instantiate(): move to the point prior to attaching dentry to inode

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoMerge getxattr prototype change into work.lookups
Al Viro [Mon, 2 May 2016 23:45:47 +0000 (19:45 -0400)]
Merge getxattr prototype change into work.lookups

The rest of work.xattr stuff isn't needed for this branch

8 years agoatomic_open(): fix the handling of create_error
Al Viro [Wed, 27 Apr 2016 05:11:55 +0000 (01:11 -0400)]
atomic_open(): fix the handling of create_error

* if we have a hashed negative dentry and either CREAT|EXCL on
r/o filesystem, or CREAT|TRUNC on r/o filesystem, or CREAT|EXCL
with failing may_o_create(), we should fail with EROFS or the
error may_o_create() has returned, but not ENOENT.  Which is what
the current code ends up returning.

* if we have CREAT|TRUNC hitting a regular file on a read-only
filesystem, we can't fail with EROFS here.  At the very least,
not until we'd done follow_managed() - we might have a writable
file (or a device, for that matter) bound on top of that one.
Moreover, the code downstream will see that O_TRUNC and attempt
to grab the write access (*after* following possible mount), so
if we really should fail with EROFS, it will happen.  No need
to do that inside atomic_open().

The real logics is much simpler than what the current code is
trying to do - if we decided to go for simple lookup, ended
up with a negative dentry *and* had create_error set, fail with
create_error.  No matter whether we'd got that negative dentry
from lookup_real() or had found it in dcache.

Cc: stable@vger.kernel.org # v3.6+
Acked-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years ago->getxattr(): pass dentry and inode as separate arguments
Al Viro [Mon, 11 Apr 2016 04:48:00 +0000 (00:48 -0400)]
->getxattr(): pass dentry and inode as separate arguments

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoLinux 4.6-rc3 v4.6-rc3
Linus Torvalds [Mon, 11 Apr 2016 00:58:30 +0000 (17:58 -0700)]
Linux 4.6-rc3

8 years agoxattr_handler: pass dentry and inode as separate arguments of ->get()
Al Viro [Mon, 11 Apr 2016 00:48:24 +0000 (20:48 -0400)]
xattr_handler: pass dentry and inode as separate arguments of ->get()

... and do not assume they are already attached to each other

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoMerge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm
Linus Torvalds [Mon, 11 Apr 2016 00:48:17 +0000 (17:48 -0700)]
Merge branch 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm

Pull ARM fixes from Russell King:
 "A couple of small fixes, and wiring up the new syscalls which appeared
  during the merge window"

* 'fixes' of git://ftp.arm.linux.org.uk/~rmk/linux-arm:
  ARM: 8550/1: protect idiv patching against undefined gcc behavior
  ARM: wire up preadv2 and pwritev2 syscalls
  ARM: SMP enable of cache maintanence broadcast

8 years agoMerge tag 'mmc-v4.6-rc1' of git://git.linaro.org/people/ulf.hansson/mmc
Linus Torvalds [Mon, 11 Apr 2016 00:38:55 +0000 (17:38 -0700)]
Merge tag 'mmc-v4.6-rc1' of git://git.linaro.org/people/ulf.hansson/mmc

Pull MMC fixes from Ulf Hansson:
 "Here are a couple of mmc fixes intended for v4.6 rc3:

  MMC host:
   - sdhci: Fix regression setting power on Trats2 board
   - sdhci-pci: Add support and PCI IDs for more Broxton host controllers"

* tag 'mmc-v4.6-rc1' of git://git.linaro.org/people/ulf.hansson/mmc:
  mmc: sdhci-pci: Add support and PCI IDs for more Broxton host controllers
  mmc: sdhci: Fix regression setting power on Trats2 board

8 years agoMerge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa...
Linus Torvalds [Mon, 11 Apr 2016 00:04:42 +0000 (17:04 -0700)]
Merge branch 'i2c/for-current' of git://git./linux/kernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Some bugfixes from I2C:

   - fix a uevent triggered boot problem by removing a useless debug
     print

   - fix sysfs-attributes of the new i2c-demux-pinctrl driver to follow
     standard kernel behaviour

   - fix a potential division-by-zero error (needed two takes)"

* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: jz4780: really prevent potential division by zero
  Revert "i2c: jz4780: prevent potential division by zero"
  i2c: jz4780: prevent potential division by zero
  i2c: mux: demux-pinctrl: Update docs to new sysfs-attributes
  i2c: mux: demux-pinctrl: Clean up sysfs attributes
  i2c: prevent endless uevent loop with CONFIG_I2C_DEBUG_CORE

8 years agoRevert "ext4: allow readdir()'s of large empty directories to be interrupted"
Linus Torvalds [Sun, 10 Apr 2016 23:52:24 +0000 (16:52 -0700)]
Revert "ext4: allow readdir()'s of large empty directories to be interrupted"

This reverts commit 1028b55bafb7611dda1d8fed2aeca16a436b7dff.

It's broken: it makes ext4 return an error at an invalid point, causing
the readdir wrappers to write the the position of the last successful
directory entry into the position field, which means that the next
readdir will now return that last successful entry _again_.

You can only return fatal errors (that terminate the readdir directory
walk) from within the filesystem readdir functions, the "normal" errors
(that happen when the readdir buffer fills up, for example) happen in
the iterorator where we know the position of the actual failing entry.

I do have a very different patch that does the "signal_pending()"
handling inside the iterator function where it is allowable, but while
that one passes all the sanity checks, I screwed up something like four
times while emailing it out, so I'm not going to commit it today.

So my track record is not good enough, and the stars will have to align
better before that one gets committed.  And it would be good to get some
review too, of course, since celestial alignments are always an iffy
debugging model.

IOW, let's just revert the commit that caused the problem for now.

Reported-by: Greg Thelen <gthelen@google.com>
Cc: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8 years agoreiserfs: switch to generic_{get,set,remove}xattr()
Al Viro [Sun, 10 Apr 2016 22:50:48 +0000 (18:50 -0400)]
reiserfs: switch to generic_{get,set,remove}xattr()

reiserfs_xattr_[sg]et() will fail with -EOPNOTSUPP for V1 inodes anyway,
and all reiserfs instances of ->[sg]et() call it and so does ->set_acl().

Checks for name length in the instances had been bogus; they should've
been "bugger off if it's _exactly_ the prefix" (as generic would
do on its own) and not "bugger off if it's shorter than the prefix" -
that can't happen.

xattr_full_name() is needed to adjust for the fact that generic instances
will skip the prefix in the name passed to ->[gs]et(); reiserfs homegrown
analogues didn't.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agocifs: kill more bogus checks in ->...xattr() methods
Al Viro [Sun, 10 Apr 2016 21:07:33 +0000 (17:07 -0400)]
cifs: kill more bogus checks in ->...xattr() methods

none of that stuff can ever be called for NULL or negative
dentry.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agodon't bother with ->d_inode->i_sb - it's always equal to ->d_sb
Al Viro [Sun, 10 Apr 2016 05:33:30 +0000 (01:33 -0400)]
don't bother with ->d_inode->i_sb - it's always equal to ->d_sb

... and neither can ever be NULL

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoMerge branch 'parisc-4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
Linus Torvalds [Sat, 9 Apr 2016 21:10:20 +0000 (14:10 -0700)]
Merge branch 'parisc-4.6-3' of git://git./linux/kernel/git/deller/parisc-linux

Pull parisc fixes from Helge Deller:
 "Since commit 0de798584bde ("parisc: Use generic extable search and
  sort routines") module loading is boken on parisc, because the parisc
  module loader wasn't prepared for the new R_PARISC_PCREL32 relocations.

  In addition, due to that breakage, Mikulas Patocka noticed that
  handling exceptions from modules probably never worked on parisc.  It
  was just masked by the fact that exceptions from modules don't happen
  during normal use.

  This patch series fixes those issues and survives the tests of the
  lib/test_user_copy kernel module test.  Some patches are tagged for
  stable"

* 'parisc-4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
  parisc: Update comment regarding relative extable support
  parisc: Unbreak handling exceptions from kernel modules
  parisc: Fix kernel crash with reversed copy_from_user()
  parisc: Avoid function pointers for kernel exception routines
  parisc: Handle R_PARISC_PCREL32 relocations in kernel modules

8 years agoMerge branch 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdim...
Linus Torvalds [Sat, 9 Apr 2016 21:05:45 +0000 (14:05 -0700)]
Merge branch 'libnvdimm-fixes' of git://git./linux/kernel/git/nvdimm/nvdimm

Pull libnvdimm fixes from Dan Williams:
 "Three fixes, the first two are tagged for -stable:

   - The ndctl utility/library gained expanded unit tests illuminating a
     long standing bug in the libnvdimm SMART data retrieval
     implementation.

     It has been broken since its initial implementation, now fixed.

   - Another one line fix for the detection of stale info blocks.

     Without this change userspace can get into a situation where it is
     unable to reconfigure a namespace.

   - Fix the badblock initialization path in the presence of the new (in
     v4.6-rc1) section alignment workarounds.

     Without this change badblocks will be reported at the wrong offset.

  These have received a build success report from the kbuild robot and
  have appeared in -next with no reported issues"

* 'libnvdimm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm:
  libnvdimm, pfn: fix nvdimm_namespace_add_poison() vs section alignment
  libnvdimm, pfn: fix uuid validation
  libnvdimm: fix smart data retrieval

8 years agoMerge tag 'gpio-v4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux...
Linus Torvalds [Sat, 9 Apr 2016 20:28:50 +0000 (13:28 -0700)]
Merge tag 'gpio-v4.6-3' of git://git./linux/kernel/git/linusw/linux-gpio

Pull GPIO fixes from Linus Walleij:
 "Here is a set of four GPIO fixes.  The two fixes to the core are
  serious as they are regressing minor architectures.

  Core fixes:

   - Defer GPIO device setup until after gpiolib is initialized.

     It turns out that a few very tightly integrated GPIO platform
     drivers initialize so early (befor core_initcall()) so that the
     gpiolib isn't even initialized itself.  That limits what the
     library can do, and we cannot reference uninitialized fields until
     later.

     Defer some of the initialization until right after the gpiolib is
     initialized in these (rare) cases.

   - As a consequence: do not use devm_* resources when allocating the
     states in the initial set-up of the gpiochip.

  Driver fixes:

   - In ACPI retrieveal: ignore GpioInt when looking for output GPIOs.

   - Fix legacy builds on the PXA without a backing pin controller.

   - Use correct datatype on pca953x register writes"

* tag 'gpio-v4.6-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio:
  gpio: pca953x: Use correct u16 value for register word write
  gpiolib: Defer gpio device setup until after gpiolib initialization
  gpiolib: Do not use devm functions when registering gpio chip
  gpio: pxa: fix legacy non pinctrl aware builds
  gpio / ACPI: ignore GpioInt() GPIOs when requesting GPIO_OUT_*

8 years agoMerge tag 'tty-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Linus Torvalds [Sat, 9 Apr 2016 19:32:44 +0000 (12:32 -0700)]
Merge tag 'tty-4.6-rc3' of git://git./linux/kernel/git/gregkh/tty

Pull tty fixes from Greg KH:
 "Here are two tty fixes for issues found.

  One was due to a merge error in 4.6-rc1, and the other a regression
  fix for UML consoles that broke in 4.6-rc1.

  Both have been in linux-next for a while"

* tag 'tty-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
  tty: Fix merge of "tty: Refactor tty_open()"
  tty: Fix UML console breakage

8 years agoMerge tag 'usb-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Linus Torvalds [Sat, 9 Apr 2016 19:23:02 +0000 (12:23 -0700)]
Merge tag 'usb-4.6-rc3' of git://git./linux/kernel/git/gregkh/usb

Pull USB fixes from Greg KH:
 "Here are some USB fixes and new device ids for 4.6-rc3.

  Nothing major, the normal USB gadget fixes and usb-serial driver ids,
  along with some other fixes mixed in.  All except the USB serial ids
  have been tested in linux-next, the id additions should be fine as
  they are 'trivial'"

* tag 'usb-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (25 commits)
  USB: option: add "D-Link DWM-221 B1" device id
  USB: serial: cp210x: Adding GE Healthcare Device ID
  USB: serial: ftdi_sio: Add support for ICP DAS I-756xU devices
  usb: dwc3: keystone: drop dma_mask configuration
  usb: gadget: udc-core: remove manual dma configuration
  usb: dwc3: pci: add ID for one more Intel Broxton platform
  usb: renesas_usbhs: fix to avoid using a disabled ep in usbhsg_queue_done()
  usb: dwc2: do not override forced dr_mode in gadget setup
  usb: gadget: f_midi: unlock on error
  USB: digi_acceleport: do sanity checking for the number of ports
  USB: cypress_m8: add endpoint sanity check
  USB: mct_u232: add sanity checking in probe
  usb: fix regression in SuperSpeed endpoint descriptor parsing
  USB: usbip: fix potential out-of-bounds write
  usb: renesas_usbhs: disable TX IRQ before starting TX DMAC transfer
  usb: renesas_usbhs: avoid NULL pointer derefernce in usbhsf_pkt_handler()
  usb: gadget: f_midi: Fixed a bug when buflen was smaller than wMaxPacketSize
  usb: phy: qcom-8x16: fix regulator API abuse
  usb: ch9: Fix SSP Device Cap wFunctionalitySupport type
  usb: gadget: composite: Access SSP Dev Cap fields properly
  ...

8 years agoMerge tag 'staging-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
Linus Torvalds [Sat, 9 Apr 2016 19:09:37 +0000 (12:09 -0700)]
Merge tag 'staging-4.6-rc3' of git://git./linux/kernel/git/gregkh/staging

Pull staging and IIO driver fixes from Greg KH:
 "Here are some IIO driver fixes, along with two staging driver fixes
  for 4.6-rc3.

  One staging driver patch reverts the deletion of a driver that
  happened in 4.6-rc1.  We thought that laptop.org was dead, but it's
  still alive and kicking, and has users that were mad we broke their
  hardware by deleting a driver for their machines.  So that driver is
  added back and everyone is happy again.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  Revert "Staging: olpc_dcon: Remove obsolete driver"
  staging/rdma/hfi1: select CRC32
  iio: gyro: bmg160: fix buffer read values
  iio: gyro: bmg160: fix endianness when reading axes
  iio: accel: bmc150: fix endianness when reading axes
  iio: st_magn: always define ST_MAGN_TRIGGER_SET_STATE
  iio: fix config watermark initial value
  iio: health: max30100: correct FIFO check condition
  iio: imu: Fix inv_mpu6050 dependencies
  iio: adc: Fix build error of missing devm_ioremap_resource on UM
  iio: light: apds9960: correct FIFO check condition
  iio: adc: max1363: correct reference voltage
  iio: adc: max1363: add missing adc to max1363_id

8 years agoMerge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Linus Torvalds [Sat, 9 Apr 2016 19:00:42 +0000 (12:00 -0700)]
Merge tag 'scsi-fixes' of git://git./linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "This is a set of eight fixes.

  Two are trivial gcc-6 updates (brace additions and unused variable
  removal).  There's a couple of cxlflash regressions, a correction for
  sd being overly chatty on revalidation (causing excess log increases).
  A VPD issue which could crash USB devices because they seem very
  intolerant to VPD inquiries, an ALUA deadlock fix and a mpt3sas buffer
  overrun fix"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: Do not attach VPD to devices that don't support it
  sd: Fix excessive capacity printing on devices with blocks bigger than 512 bytes
  scsi_dh_alua: Fix a recently introduced deadlock
  scsi: Declare local symbols static
  cxlflash: Move to exponential back-off when cmd_room is not available
  cxlflash: Fix regression issue with re-ordering patch
  mpt3sas: Don't overreach ioc->reply_post[] during initialization
  aacraid: add missing curly braces

8 years agoMerge tag 'md/4.6-rc2-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md
Linus Torvalds [Sat, 9 Apr 2016 18:23:27 +0000 (11:23 -0700)]
Merge tag 'md/4.6-rc2-fix' of git://git./linux/kernel/git/shli/md

Pull MD fixes from Shaohua Li:
 "This update mainly fixes bugs:

   - fix error handling (Guoqing)
   - fix a crash when a disk is hotremoved (me)
   - fix a dead loop (Wei Fang)"

* tag 'md/4.6-rc2-fix' of git://git.kernel.org/pub/scm/linux/kernel/git/shli/md:
  md/bitmap: clear bitmap if bitmap_create failed
  MD: add rdev reference for super write
  md: fix a trivial typo in comments
  md:raid1: fix a dead loop when read from a WriteMostly disk

8 years agoMerge tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
Linus Torvalds [Sat, 9 Apr 2016 18:03:48 +0000 (11:03 -0700)]
Merge tag 'pm+acpi-4.6-rc3' of git://git./linux/kernel/git/rafael/linux-pm

Pull power management and ACPI fixes from Rafael Wysocki:
 "Fixes for some issues discovered after recent changes and for some
  that have just been found lately regardless of those changes
  (intel_pstate, intel_idle, PM core, mailbox/pcc, turbostat) plus
  support for some new CPU models (intel_idle, Intel RAPL driver,
  turbostat) and documentation updates (intel_pstate, PM core).

  Specifics:

   - intel_pstate fixes for two issues exposed by the recent switch over
     from using timers and for one issue introduced during the 4.4 cycle
     plus new comments describing data structures used by the driver
     (Rafael Wysocki, Srinivas Pandruvada).

   - intel_idle fixes related to CPU offline/online (Richard Cochran).

   - intel_idle support (new CPU IDs and state definitions mostly) for
     Skylake-X and Kabylake processors (Len Brown).

   - PCC mailbox driver fix for an out-of-bounds memory access that may
     cause the kernel to panic() (Shanker Donthineni).

   - New (missing) CPU ID for one apparently overlooked Haswell model in
     the Intel RAPL power capping driver (Srinivas Pandruvada).

   - Fix for the PM core's wakeup IRQs framework to make it work after
     wakeup settings reconfiguration from sysfs (Grygorii Strashko).

   - Runtime PM documentation update to make it describe what needs to
     be done during device removal more precisely (Krzysztof Kozlowski).

   - Stale comment removal cleanup in the cpufreq-dt driver (Viresh
     Kumar).

   - turbostat utility fixes and support for Broxton, Skylake-X and
     Kabylake processors (Len Brown)"

* tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (28 commits)
  PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs
  tools/power turbostat: work around RC6 counter wrap
  tools/power turbostat: initial KBL support
  tools/power turbostat: initial SKX support
  tools/power turbostat: decode BXT TSC frequency via CPUID
  tools/power turbostat: initial BXT support
  tools/power turbostat: print IRTL MSRs
  tools/power turbostat: SGX state should print only if --debug
  intel_idle: Add KBL support
  intel_idle: Add SKX support
  intel_idle: Clean up all registered devices on exit.
  intel_idle: Propagate hot plug errors.
  intel_idle: Don't overreact to a cpuidle registration failure.
  intel_idle: Setup the timer broadcast only on successful driver load.
  intel_idle: Avoid a double free of the per-CPU data.
  intel_idle: Fix dangling registration on error path.
  intel_idle: Fix deallocation order on the driver exit path.
  intel_idle: Remove redundant initialization calls.
  intel_idle: Fix a helper function's return value.
  intel_idle: remove useless return from void function.
  ...

8 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Linus Torvalds [Sat, 9 Apr 2016 17:50:44 +0000 (10:50 -0700)]
Merge git://git./linux/kernel/git/davem/net

Pull networking fixes from David Miller:

 1) Stale SKB data pointer access across pskb_may_pull() calls in L2TP,
    from Haishuang Yan.

 2) Fix multicast frame handling in mac80211 AP code, from Felix
    Fietkau.

 3) mac80211 station hashtable insert errors not handled properly, fix
    from Johannes Berg.

 4) Fix TX descriptor count limit handling in e1000, from Alexander
    Duyck.

 5) Revert a buggy netdev refcount fix in netpoll, from Bjorn Helgaas.

 6) Must assign rtnl_link_ops of the device before registering it, fix
    in ip6_tunnel from Thadeu Lima de Souza Cascardo.

 7) Memory leak fix in tc action net exit, from WANG Cong.

 8) Add missing AF_KCM entries to name tables, from Dexuan Cui.

 9) Fix regression in GRE handling of csums wrt.  FOU, from Alexander
    Duyck.

10) Fix memory allocation alignment and congestion map corruption in
    RDS, from Shamir Rabinovitch.

11) Fix default qdisc regression in tuntap driver, from Jason Wang.

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (44 commits)
  bridge, netem: mark mailing lists as moderated
  tuntap: restore default qdisc
  mpls: find_outdev: check for err ptr in addition to NULL check
  ipv6: Count in extension headers in skb->network_header
  RDS: fix congestion map corruption for PAGE_SIZE > 4k
  RDS: memory allocated must be align to 8
  GRE: Disable segmentation offloads w/ CSUM and we are encapsulated via FOU
  net: add the AF_KCM entries to family name tables
  MAINTAINERS: intel-wired-lan list is moderated
  lib/test_bpf: Add additional BPF_ADD tests
  lib/test_bpf: Add test to check for result of 32-bit add that overflows
  lib/test_bpf: Add tests for unsigned BPF_JGT
  lib/test_bpf: Fix JMP_JSET tests
  VSOCK: Detach QP check should filter out non matching QPs.
  stmmac: fix adjust link call in case of a switch is attached
  af_packet: tone down the Tx-ring unsupported spew.
  net_sched: fix a memory leak in tc action
  samples/bpf: Enable powerpc support
  samples/bpf: Use llc in PATH, rather than a hardcoded value
  samples/bpf: Fix build breakage with map_perf_test_user.c
  ...

8 years agoMerge branch 'for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mason...
Linus Torvalds [Sat, 9 Apr 2016 17:41:34 +0000 (10:41 -0700)]
Merge branch 'for-linus-4.6' of git://git./linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "These are bug fixes, including a really old fsync bug, and a few trace
  points to help us track down problems in the quota code"

* 'for-linus-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  Btrfs: fix file/data loss caused by fsync after rename and new inode
  btrfs: Reset IO error counters before start of device replacing
  btrfs: Add qgroup tracing
  Btrfs: don't use src fd for printk
  btrfs: fallback to vmalloc in btrfs_compare_tree
  btrfs: handle non-fatal errors in btrfs_qgroup_inherit()
  btrfs: Output more info for enospc_debug mount option
  Btrfs: fix invalid reference in replace_path
  Btrfs: Improve FL_KEEP_SIZE handling in fallocate

8 years agoMerge tag 'for-linus-4.6-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubca...
Linus Torvalds [Sat, 9 Apr 2016 17:33:58 +0000 (10:33 -0700)]
Merge tag 'for-linus-4.6-ofs1' of git://git./linux/kernel/git/hubcap/linux

Pull orangefs fixes from Mike Marshall:
 "Orangefs cleanups and a strncpy vulnerability fix.

  Cleanups:
   - remove an unused variable from orangefs_readdir.
   - clean up printk wrapper used for ofs "gossip" debugging.
   - clean up truncate ctime and mtime setting in inode.c
   - remove a useless null check found by coccinelle.
   - optimize some memcpy/memset boilerplate code.
   - remove some useless sanity checks from xattr.c

  Fix:
   - fix a potential strncpy vulnerability"

* tag 'for-linus-4.6-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
  orangefs: remove unused variable
  orangefs: Add KERN_<LEVEL> to gossip_<level> macros
  orangefs: strncpy -> strscpy
  orangefs: clean up truncate ctime and mtime setting
  Orangefs: fix ifnullfree.cocci warnings
  Orangefs: optimize boilerplate code.
  Orangefs: xattr.c cleanup

8 years agoMerge tag 'iommu-fixes-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
Linus Torvalds [Sat, 9 Apr 2016 17:23:45 +0000 (10:23 -0700)]
Merge tag 'iommu-fixes-v4.6-rc2' of git://git./linux/kernel/git/joro/iommu

Pull IOMMU fixes from Joerg Roedel:

 - compile-time fixes (warnings and failures)

 - a bug in iommu core code which could cause the group->domain pointer
   to be falsly cleared

 - fix in scatterlist handling of the ARM common DMA-API code

 - stall detection fix for the Rockchip IOMMU driver

* tag 'iommu-fixes-v4.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
  iommu/vt-d: Silence an uninitialized variable warning
  iommu/rockchip: Fix "is stall active" check
  iommu: Don't overwrite domain pointer when there is no default_domain
  iommu/dma: Restore scatterlist offsets correctly
  iommu: provide of_xlate pointer unconditionally

8 years agoi2c: jz4780: really prevent potential division by zero
Wolfram Sang [Sun, 3 Apr 2016 21:32:00 +0000 (23:32 +0200)]
i2c: jz4780: really prevent potential division by zero

Make sure we avoid a division-by-zero OOPS in case clock-frequency is
set too low in DT. Add missing '\n' while we are here.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Acked-by: Axel Lin <axel.lin@ingics.com>
8 years agoRevert "i2c: jz4780: prevent potential division by zero"
Wolfram Sang [Sat, 9 Apr 2016 06:32:37 +0000 (08:32 +0200)]
Revert "i2c: jz4780: prevent potential division by zero"

This reverts commit 34cf2acdafaa31a13821e45de5ee896adcd307b1. 'ret' is
not set when bailing out. Also, there is a better place to check for 0.

Reported-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
8 years agofix the copy vs. map logics in blk_rq_map_user_iov()
Al Viro [Fri, 8 Apr 2016 23:05:19 +0000 (19:05 -0400)]
fix the copy vs. map logics in blk_rq_map_user_iov()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
8 years agoMerge tag 'usb-serial-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/johan...
Greg Kroah-Hartman [Fri, 8 Apr 2016 22:41:58 +0000 (15:41 -0700)]
Merge tag 'usb-serial-4.6-rc3' of git://git./linux/kernel/git/johan/usb-serial into usb-linus

Johan writes:

USB-serial fixes for v4.6-rc3

Here are some new device ids.

Signed-off-by: Johan Hovold <johan@kernel.org>
8 years agoMerge tag 'mac80211-for-davem-2016-04-06' of git://git.kernel.org/pub/scm/linux/kerne...
David S. Miller [Fri, 8 Apr 2016 20:41:28 +0000 (16:41 -0400)]
Merge tag 'mac80211-for-davem-2016-04-06' of git://git./linux/kernel/git/jberg/mac80211

Johannes Berg says:

====================
For the current RC series, we have the following fixes:
 * TDLS fixes from Arik and Ilan
 * rhashtable fixes from Ben and myself
 * documentation fixes from Luis
 * U-APSD fixes from Emmanuel
 * a TXQ fix from Felix
 * and a compiler warning suppression from Jeff
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agobridge, netem: mark mailing lists as moderated
stephen hemminger [Tue, 5 Apr 2016 20:43:53 +0000 (13:43 -0700)]
bridge, netem: mark mailing lists as moderated

I moderate these (lightly loaded) lists to block spam.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
8 years agoparisc: Update comment regarding relative extable support
Helge Deller [Fri, 8 Apr 2016 19:36:06 +0000 (21:36 +0200)]
parisc: Update comment regarding relative extable support

Update the comment to reflect the changes of commit 0de7985 (parisc: Use
generic extable search and sort routines).

Signed-off-by: Helge Deller <deller@gmx.de>
8 years agoparisc: Unbreak handling exceptions from kernel modules
Helge Deller [Fri, 8 Apr 2016 16:32:52 +0000 (18:32 +0200)]
parisc: Unbreak handling exceptions from kernel modules

Handling exceptions from modules never worked on parisc.
It was just masked by the fact that exceptions from modules
don't happen during normal use.

When a module triggers an exception in get_user() we need to load the
main kernel dp value before accessing the exception_data structure, and
afterwards restore the original dp value of the module on exit.

Noticed-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
8 years agoparisc: Fix kernel crash with reversed copy_from_user()
Helge Deller [Fri, 8 Apr 2016 16:18:48 +0000 (18:18 +0200)]
parisc: Fix kernel crash with reversed copy_from_user()

The kernel module testcase (lib/test_user_copy.c) exhibited a kernel
crash on parisc if the parameters for copy_from_user were reversed
("illegal reversed copy_to_user" testcase).

Fix this potential crash by checking the fault handler if the faulting
address is in the exception table.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org
Cc: Kees Cook <keescook@chromium.org>
8 years agoparisc: Avoid function pointers for kernel exception routines
Helge Deller [Fri, 8 Apr 2016 16:11:33 +0000 (18:11 +0200)]
parisc: Avoid function pointers for kernel exception routines

We want to avoid the kernel module loader to create function pointers
for the kernel fixup routines of get_user() and put_user(). Changing
the external reference from function type to int type fixes this.

This unbreaks exception handling for get_user() and put_user() when
called from a kernel module.

Signed-off-by: Helge Deller <deller@gmx.de>
Cc: stable@vger.kernel.org