]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
12 years agoRevert "arm: deal with handlerless restarts without leaving the kernel"
Stephen Rothwell [Fri, 6 Jul 2012 00:34:02 +0000 (10:34 +1000)]
Revert "arm: deal with handlerless restarts without leaving the kernel"

This reverts commit 9c802c169f964830496be6480ab71d2123cf38a7.

Requested by Russell King.

12 years agoRevert "arm: get rid of TIF_SYSCALL_RESTARTSYS"
Stephen Rothwell [Fri, 6 Jul 2012 00:32:57 +0000 (10:32 +1000)]
Revert "arm: get rid of TIF_SYSCALL_RESTARTSYS"

This reverts commit 76c3f4da3ee47b68304dbe0f64e86562e7945bf3.

requested by Russell King.

12 years agoUninclude linux/freezer.h
Richard Weinberger [Fri, 25 May 2012 23:57:10 +0000 (01:57 +0200)]
Uninclude linux/freezer.h

This include is no longer needed.
(seems to be a leftover from try_to_freeze())

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoarm: get rid of TIF_SYSCALL_RESTARTSYS
Al Viro [Sat, 2 Jun 2012 06:11:01 +0000 (02:11 -0400)]
arm: get rid of TIF_SYSCALL_RESTARTSYS

just let do_work_pending() return 1 on normal local restarts and
-1 on those that had been caused by ERESTART_RESTARTBLOCK (and 0
is still "all done, sod off to userland now").  And let the asm
glue flip scno to restart_syscall(2) one if it got negative from
us...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoarm: deal with handlerless restarts without leaving the kernel
Al Viro [Sat, 2 Jun 2012 05:52:18 +0000 (01:52 -0400)]
arm: deal with handlerless restarts without leaving the kernel

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoarm: pull all work_pending logics into C function
Al Viro [Sat, 2 Jun 2012 03:58:57 +0000 (23:58 -0400)]
arm: pull all work_pending logics into C function

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agom32r: trim masks
Al Viro [Fri, 1 Jun 2012 02:25:28 +0000 (22:25 -0400)]
m32r: trim masks

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoavr32: trim masks
Al Viro [Fri, 1 Jun 2012 02:24:57 +0000 (22:24 -0400)]
avr32: trim masks

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoalpha: rewrite kernel_execve in C
Al Viro [Fri, 1 Jun 2012 02:22:52 +0000 (22:22 -0400)]
alpha: rewrite kernel_execve in C

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agotile: don't bother with SIGTRAP in setup_frame
Al Viro [Sun, 27 May 2012 02:22:53 +0000 (22:22 -0400)]
tile: don't bother with SIGTRAP in setup_frame

Tell signal_delivered() to do it instead.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomn10300: don't bother with SIGTRAP in setup_frame()
Al Viro [Sun, 27 May 2012 02:20:22 +0000 (22:20 -0400)]
mn10300: don't bother with SIGTRAP in setup_frame()

... just tell signal_delivered() to do it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agofrv: no need to raise SIGTRAP in setup_frame()
Al Viro [Sun, 27 May 2012 02:17:47 +0000 (22:17 -0400)]
frv: no need to raise SIGTRAP in setup_frame()

signal_delivered() will do it in the same case...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoalpha: take a bunch of syscalls into osf_sys.c
Al Viro [Sun, 27 May 2012 01:17:25 +0000 (21:17 -0400)]
alpha: take a bunch of syscalls into osf_sys.c

New helper: current_thread_info().  Allows to do a bunch of odd syscalls in C.
While we are at it, there had never been a reason to do osf_getpriority() in
assembler.  We also get "namespace"-aware (read: consistent with getuid(2),
etc.) behaviour from getx?id() syscalls now.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agox86: get rid of duplicate code in case of CONFIG_VM86
Al Viro [Sat, 26 May 2012 05:07:39 +0000 (01:07 -0400)]
x86: get rid of duplicate code in case of CONFIG_VM86

no need to have the call of do_notify_resume() + checks around it
duplicated for vm86 case - a bit of rearranging of ifdefs and we'll
have a perfectly fine copy to jump back to.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agounicore32: remove pointless test
Al Viro [Sat, 26 May 2012 04:25:15 +0000 (00:25 -0400)]
unicore32: remove pointless test

we can get into work_pending only if at least one of NEED_RESCHED,
SIGPENDING or NOTIFY_RESUME is set.  So once we'd found no NEED_RESCHED,
there's no need to check that one of the other two is set.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agosh: missing tests for NOTIFY_RESUME
Al Viro [Sat, 26 May 2012 00:54:43 +0000 (20:54 -0400)]
sh: missing tests for NOTIFY_RESUME

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agopowerpc: missing NOTIFY_RESUME check on 64bit if CONFIG_PREEMPT is set
Al Viro [Fri, 25 May 2012 21:09:58 +0000 (17:09 -0400)]
powerpc: missing NOTIFY_RESUME check on 64bit if CONFIG_PREEMPT is set

code too smart for its own good - apparently got missed when NOTIFY_RESUME
had been added...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoh8300: trim _TIF_WORK_MASK
Al Viro [Thu, 24 May 2012 07:12:25 +0000 (03:12 -0400)]
h8300: trim _TIF_WORK_MASK

Only the three usual flags (NEED_RESCHED/SIGPENDING/NOTIFY_RESUME)
are looked at in the code checking _TIF_WORK_MASK on that one.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoparisc: decide whether to go to slow path (tracesys) based on thread flags
Al Viro [Sun, 20 May 2012 15:59:03 +0000 (11:59 -0400)]
parisc: decide whether to go to slow path (tracesys) based on thread flags

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoparisc: don't bother looping in do_signal()
Al Viro [Sat, 19 May 2012 05:13:01 +0000 (01:13 -0400)]
parisc: don't bother looping in do_signal()

entry.S code had been looping until no pending signals are left
since 2005 anyway; no need to bother with that in do_signal()
itself.  If the failure to set a sigframe up raises SIGSEGV,
we'll just pick it up the next time around the loop(s) in entry.S
anyway.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoparisc: fix double restarts
Al Viro [Sat, 19 May 2012 04:29:22 +0000 (00:29 -0400)]
parisc: fix double restarts

Don't bother restoring r28 on syscall restarts; it's clobbered by
syscall anyway.  Reuse (now unused) ->orig_r28 as "no restarts allowed"
flag.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agobury the rest of TIF_IRET
Al Viro [Mon, 7 May 2012 21:37:26 +0000 (17:37 -0400)]
bury the rest of TIF_IRET

Some architectures had blindly copied it for no reason whatsoever.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agox86: switch uses of TIF_IRET to TIF_NOTIFY_RESUME, kill TIF_IRET
Al Viro [Mon, 7 May 2012 21:30:22 +0000 (17:30 -0400)]
x86: switch uses of TIF_IRET to TIF_NOTIFY_RESUME, kill TIF_IRET

TIF_IRET(i386) is used to force return to userland via iret, even if
we'd entered the kernel via sysenter.  This, to put it mildly, is a
fucking ugly hack.  Essentially, it acts as a silent duplicate of
NOTIFY_RESUME.  do_notify_resume() clears it (as it clears NOTIFY_RESUME
itself).  And i386 has glue treat it as something indistinguishable from
NOTIFY_RESUME, never mentioning either explicitly.  _Any_ path going
through do_notify_resume() there will leave via iret - sysret is for
fast path only.  So setting TIF_IRET (or, for that matter, TIF_NOTIFY_RESUME)
has an effect of forcing exit via iret.

That had been obfuscated just enough to have it copied to hexagon, m32r,
microblaze and xtensa.  Neither of those ever sets it.  Or has an analog
of the x86 issues that make forcing exit via iret needed there.  Pure and
simple cargo-cult programming...

Just kill the undocumented bugger...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agosanitize tsk_is_polling()
Al Viro [Fri, 1 Jun 2012 18:22:01 +0000 (14:22 -0400)]
sanitize tsk_is_polling()

Make default just return 0.  The current default (checking
TIF_POLLING_NRFLAG) is taken to architectures that need it;
ones that don't do polling in their idle threads don't need
to defined TIF_POLLING_NRFLAG at all.

ia64 defined both TS_POLLING (used by its tsk_is_polling())
and TIF_POLLING_NRFLAG (not used at all).  Killed the latter...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agobury _TIF_RESTORE_SIGMASK
Al Viro [Fri, 1 Jun 2012 18:21:16 +0000 (14:21 -0400)]
bury _TIF_RESTORE_SIGMASK

never used...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agounicore32: unobfuscate _TIF_WORK_MASK
Al Viro [Sat, 5 May 2012 22:29:41 +0000 (18:29 -0400)]
unicore32: unobfuscate _TIF_WORK_MASK

bits 3..7 in flags are never set there, so this 0xff is pointless

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomips: NOTIFY_RESUME is not needed in TIF masks
Al Viro [Sat, 5 May 2012 20:24:40 +0000 (16:24 -0400)]
mips: NOTIFY_RESUME is not needed in TIF masks

If it's set, SIGPENDING is also set.  And SIGPENDING is present in
the masks...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomips: merge the identical "return from syscall" per-ABI code
Al Viro [Sat, 5 May 2012 20:11:35 +0000 (16:11 -0400)]
mips: merge the identical "return from syscall" per-ABI code

No need to keep 4 copies of that stuff; merged and taken to
entry.S, unused public symbols there killed off.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomips: unobfuscate _TIF..._MASK
Al Viro [Sat, 5 May 2012 19:57:00 +0000 (15:57 -0400)]
mips: unobfuscate _TIF..._MASK

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomips: prevent hitting do_notify_resume() with !user_mode(regs)
Al Viro [Thu, 3 May 2012 01:45:12 +0000 (21:45 -0400)]
mips: prevent hitting do_notify_resume() with !user_mode(regs)

too late to do anything there...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoia64: can't reach do_signal() when returning to kernel mode
Al Viro [Tue, 1 May 2012 22:37:16 +0000 (18:37 -0400)]
ia64: can't reach do_signal() when returning to kernel mode

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoscore: fix bogus restarts on sigreturn()
Al Viro [Tue, 1 May 2012 03:37:41 +0000 (23:37 -0400)]
score: fix bogus restarts on sigreturn()

we *really* don't want to have restart logics hit when we are returning from
sigreturn() - random replacement of %r4 with -4 just because a signal had
been noticed from timer interrupt that came when %r4 happened to contain
-514 is not nice at all.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomn10300: get rid of calling do_notify_resume() when returning to kernel mode
Al Viro [Mon, 30 Apr 2012 23:49:23 +0000 (19:49 -0400)]
mn10300: get rid of calling do_notify_resume() when returning to kernel mode

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomicroblaze: fix handling of multiple pending signals
Al Viro [Sun, 29 Apr 2012 08:43:50 +0000 (04:43 -0400)]
microblaze: fix handling of multiple pending signals

We need to keep building sigframes until no pending signals remain.
Wrap do_notify_resume() calls into loops; do _not_ allow syscall
restart logics to trigger after the first iteration.

Incidentally, comments about pending signals that should (somehow)
be in r18 are pure BS.  Doesn't work that way and cannot work that
way, sorry...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomicroblaze: fix the horror with restarts of sigreturn()
Al Viro [Sun, 29 Apr 2012 08:11:34 +0000 (04:11 -0400)]
microblaze: fix the horror with restarts of sigreturn()

solution a-la arm one - pick a callee-saved register (r30), set it
non-zero when entering a syscall, have sigreturn wrapper zero it out
and pass the value in it to do_notify_resume() as "in_syscall" (actually,
"restarts allowed") argument.

Note that we don't give a damn about ret_from_fork() - return value
is not restart-worthy anyway.

Possible remaining bug: on !MMU we still have _debug_exception()
restartable.  If it hits with -ERESTART_... accidentally in r3, fun happens.
MMU does _not_ have _debug_exception() restartable.  If that's decided to
be a bug (as I strongly suspect it to be), we'll just need to replace
setting r30 to 1 with setting r30 to 0 in !MMU _debug_exception().
Up to microblaze maintainers...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomicroblaze: evict the check for kernel_mode(regs) from do_notify_resume()
Al Viro [Sun, 29 Apr 2012 07:35:29 +0000 (03:35 -0400)]
microblaze: evict the check for kernel_mode(regs) from do_notify_resume()

Only one caller hasn't done it in assembler - work_pending on !MMU.
Everything else can't reach do_notify_resume() if we are returning
to kernel mode, so move that check to that sole caller and make
do_notify_resume() reachable only when returning to userland.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoxtensa: can't get to do_notify_resume() when user_mode(regs) is not true
Al Viro [Sun, 29 Apr 2012 02:42:43 +0000 (22:42 -0400)]
xtensa: can't get to do_notify_resume() when user_mode(regs) is not true

asm glue checks that

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Linus Torvalds [Fri, 1 Jun 2012 18:53:44 +0000 (11:53 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal

Pull third pile of signal handling patches from Al Viro:
 "This time it's mostly helpers and conversions to them; there's a lot
  of stuff remaining in the tree, but that'll either go in -rc2
  (isolated bug fixes, ideally via arch maintainers' trees) or will sit
  there until the next cycle."

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
  x86: get rid of calling do_notify_resume() when returning to kernel mode
  blackfin: check __get_user() return value
  whack-a-mole with TIF_FREEZE
  FRV: Optimise the system call exit path in entry.S [ver #2]
  FRV: Shrink TIF_WORK_MASK [ver #2]
  FRV: Prevent syscall exit tracing and notify_resume at end of kernel exceptions
  new helper: signal_delivered()
  powerpc: get rid of restore_sigmask()
  most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set
  set_restore_sigmask() is never called without SIGPENDING (and never should be)
  TIF_RESTORE_SIGMASK can be set only when TIF_SIGPENDING is set
  don't call try_to_freeze() from do_signal()
  pull clearing RESTORE_SIGMASK into block_sigmask()
  sh64: failure to build sigframe != signal without handler
  openrisc: tracehook_signal_handler() is supposed to be called on success
  new helper: sigmask_to_save()
  new helper: restore_saved_sigmask()
  new helpers: {clear,test,test_and_clear}_restore_sigmask()
  HAVE_RESTORE_SIGMASK is defined on all architectures now

12 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Linus Torvalds [Fri, 1 Jun 2012 17:34:35 +0000 (10:34 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs

Pull vfs changes from Al Viro.
 "A lot of misc stuff.  The obvious groups:
   * Miklos' atomic_open series; kills the damn abuse of
     ->d_revalidate() by NFS, which was the major stumbling block for
     all work in that area.
   * ripping security_file_mmap() and dealing with deadlocks in the
     area; sanitizing the neighborhood of vm_mmap()/vm_munmap() in
     general.
   * ->encode_fh() switched to saner API; insane fake dentry in
     mm/cleancache.c gone.
   * assorted annotations in fs (endianness, __user)
   * parts of Artem's ->s_dirty work (jff2 and reiserfs parts)
   * ->update_time() work from Josef.
   * other bits and pieces all over the place.

  Normally it would've been in two or three pull requests, but
  signal.git stuff had eaten a lot of time during this cycle ;-/"

Fix up trivial conflicts in Documentation/filesystems/vfs.txt (the
'truncate_range' inode method was removed by the VM changes, the VFS
update adds an 'update_time()' method), and in fs/btrfs/ulist.[ch] (due
to sparse fix added twice, with other changes nearby).

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (95 commits)
  nfs: don't open in ->d_revalidate
  vfs: retry last component if opening stale dentry
  vfs: nameidata_to_filp(): don't throw away file on error
  vfs: nameidata_to_filp(): inline __dentry_open()
  vfs: do_dentry_open(): don't put filp
  vfs: split __dentry_open()
  vfs: do_last() common post lookup
  vfs: do_last(): add audit_inode before open
  vfs: do_last(): only return EISDIR for O_CREAT
  vfs: do_last(): check LOOKUP_DIRECTORY
  vfs: do_last(): make ENOENT exit RCU safe
  vfs: make follow_link check RCU safe
  vfs: do_last(): use inode variable
  vfs: do_last(): inline walk_component()
  vfs: do_last(): make exit RCU safe
  vfs: split do_lookup()
  Btrfs: move over to use ->update_time
  fs: introduce inode operation ->update_time
  reiserfs: get rid of resierfs_sync_super
  reiserfs: mark the superblock as dirty a bit later
  ...

12 years agoMerge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso...
Linus Torvalds [Fri, 1 Jun 2012 17:12:15 +0000 (10:12 -0700)]
Merge tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull Ext4 updates from Theodore Ts'o:
 "The major new feature added in this update is Darrick J Wong's
  metadata checksum feature, which adds crc32 checksums to ext4's
  metadata fields.

  There is also the usual set of cleanups and bug fixes."

* tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: (44 commits)
  ext4: hole-punch use truncate_pagecache_range
  jbd2: use kmem_cache_zalloc wrapper instead of flag
  ext4: remove mb_groups before tearing down the buddy_cache
  ext4: add ext4_mb_unload_buddy in the error path
  ext4: don't trash state flags in EXT4_IOC_SETFLAGS
  ext4: let getattr report the right blocks in delalloc+bigalloc
  ext4: add missing save_error_info() to ext4_error()
  ext4: add debugging trigger for ext4_error()
  ext4: protect group inode free counting with group lock
  ext4: use consistent ssize_t type in ext4_file_write()
  ext4: fix format flag in ext4_ext_binsearch_idx()
  ext4: cleanup in ext4_discard_allocated_blocks()
  ext4: return ENOMEM when mounts fail due to lack of memory
  ext4: remove redundundant "(char *) bh->b_data" casts
  ext4: disallow hard-linked directory in ext4_lookup
  ext4: fix potential integer overflow in alloc_flex_gd()
  ext4: remove needs_recovery in ext4_mb_init()
  ext4: force ro mount if ext4_setup_super() fails
  ext4: fix potential NULL dereference in ext4_free_inodes_counts()
  ext4/jbd2: add metadata checksumming to the list of supported features
  ...

12 years agox86: get rid of calling do_notify_resume() when returning to kernel mode
Al Viro [Mon, 30 Apr 2012 22:24:46 +0000 (18:24 -0400)]
x86: get rid of calling do_notify_resume() when returning to kernel mode

If we end up calling do_notify_resume() with !user_mode(refs), it
does nothing (do_signal() explicitly bails out and we can't get there
with TIF_NOTIFY_RESUME in such situations).  Then we jump to
resume_userspace_sig, which rechecks the same thing and bails out
to resume_kernel, thus breaking the loop.

It's easier and cheaper to check *before* calling do_notify_resume()
and bail out to resume_kernel immediately.  And kill the check in
do_signal()...

Note that on amd64 we can't get there with !user_mode() at all - asm
glue takes care of that.

Acked-and-reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoblackfin: check __get_user() return value
Al Viro [Thu, 3 May 2012 01:14:30 +0000 (21:14 -0400)]
blackfin: check __get_user() return value

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agowhack-a-mole with TIF_FREEZE
Al Viro [Fri, 1 Jun 2012 17:00:49 +0000 (13:00 -0400)]
whack-a-mole with TIF_FREEZE

blackfin has reintroduced it, completely unused.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoFRV: Optimise the system call exit path in entry.S [ver #2]
David Howells [Tue, 1 May 2012 20:31:42 +0000 (21:31 +0100)]
FRV: Optimise the system call exit path in entry.S [ver #2]

Optimise the system call exit path in entry.S by packing some instructions.

Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoFRV: Shrink TIF_WORK_MASK [ver #2]
David Howells [Tue, 1 May 2012 20:31:33 +0000 (21:31 +0100)]
FRV: Shrink TIF_WORK_MASK [ver #2]

Shrink TIF_WORK_MASK so that it will fit in the 12-bit signed immediate
operand field of an ANDI instruction.

Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoFRV: Prevent syscall exit tracing and notify_resume at end of kernel exceptions
David Howells [Tue, 1 May 2012 18:44:14 +0000 (19:44 +0100)]
FRV: Prevent syscall exit tracing and notify_resume at end of kernel exceptions

Move the test for kernel mode processing from do_signal() into entry.S to also
prevent system call exit tracing and userspace resumption notification handling
happening when returning from kernel exceptions.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agonew helper: signal_delivered()
Al Viro [Sat, 28 Apr 2012 06:04:15 +0000 (02:04 -0400)]
new helper: signal_delivered()

Does block_sigmask() + tracehook_signal_handler();  called when
sigframe has been successfully built.  All architectures converted
to it; block_sigmask() itself is gone now (merged into this one).

I'm still not too happy with the signature, but that's a separate
story (IMO we need a structure that would contain signal number +
siginfo + k_sigaction, so that get_signal_to_deliver() would fill one,
signal_delivered(), handle_signal() and probably setup...frame() -
take one).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agopowerpc: get rid of restore_sigmask()
Al Viro [Fri, 27 Apr 2012 18:09:19 +0000 (14:09 -0400)]
powerpc: get rid of restore_sigmask()

... it's just a call of set_current_blocked() now

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomost of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set
Al Viro [Fri, 27 Apr 2012 17:58:59 +0000 (13:58 -0400)]
most of set_current_blocked() callers want SIGKILL/SIGSTOP removed from set

Only 3 out of 63 do not.  Renamed the current variant to __set_current_blocked(),
added set_current_blocked() that will exclude unblockable signals, switched
open-coded instances to it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoset_restore_sigmask() is never called without SIGPENDING (and never should be)
Al Viro [Fri, 27 Apr 2012 17:42:45 +0000 (13:42 -0400)]
set_restore_sigmask() is never called without SIGPENDING (and never should be)

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoTIF_RESTORE_SIGMASK can be set only when TIF_SIGPENDING is set
Al Viro [Wed, 23 May 2012 19:28:58 +0000 (15:28 -0400)]
TIF_RESTORE_SIGMASK can be set only when TIF_SIGPENDING is set

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agodon't call try_to_freeze() from do_signal()
Al Viro [Fri, 27 Apr 2012 05:18:52 +0000 (01:18 -0400)]
don't call try_to_freeze() from do_signal()

get_signal_to_deliver() will handle it itself

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agopull clearing RESTORE_SIGMASK into block_sigmask()
Al Viro [Tue, 22 May 2012 03:42:15 +0000 (23:42 -0400)]
pull clearing RESTORE_SIGMASK into block_sigmask()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agosh64: failure to build sigframe != signal without handler
Al Viro [Fri, 27 Apr 2012 03:52:33 +0000 (23:52 -0400)]
sh64: failure to build sigframe != signal without handler

it's actually "send me SIGSEGV"...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoopenrisc: tracehook_signal_handler() is supposed to be called on success
Al Viro [Fri, 27 Apr 2012 03:42:55 +0000 (23:42 -0400)]
openrisc: tracehook_signal_handler() is supposed to be called on success

... not if sigframe couldn't have been built.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agonew helper: sigmask_to_save()
Al Viro [Wed, 2 May 2012 13:59:21 +0000 (09:59 -0400)]
new helper: sigmask_to_save()

replace boilerplate "should we use ->saved_sigmask or ->blocked?"
with calls of obvious inlined helper...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agonew helper: restore_saved_sigmask()
Al Viro [Tue, 22 May 2012 03:33:55 +0000 (23:33 -0400)]
new helper: restore_saved_sigmask()

first fruits of ..._restore_sigmask() helpers: now we can take
boilerplate "signal didn't have a handler, clear RESTORE_SIGMASK
and restore the blocked mask from ->saved_mask" into a common
helper.  Open-coded instances switched...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agonew helpers: {clear,test,test_and_clear}_restore_sigmask()
Al Viro [Fri, 27 Apr 2012 02:29:20 +0000 (22:29 -0400)]
new helpers: {clear,test,test_and_clear}_restore_sigmask()

helpers parallel to set_restore_sigmask(), used in the next commits

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoHAVE_RESTORE_SIGMASK is defined on all architectures now
Al Viro [Thu, 26 Apr 2012 22:31:00 +0000 (18:31 -0400)]
HAVE_RESTORE_SIGMASK is defined on all architectures now

Everyone either defines it in arch thread_info.h or has TIF_RESTORE_SIGMASK
and picks default set_restore_sigmask() in linux/thread_info.h.  Kill the
ifdefs, slap #error in linux/thread_info.h to catch breakage when new ones
get merged.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agonfs: don't open in ->d_revalidate
Miklos Szeredi [Mon, 21 May 2012 15:30:20 +0000 (17:30 +0200)]
nfs: don't open in ->d_revalidate

NFSv4 can't do reliable opens in d_revalidate, since it cannot know whether a
mount needs to be followed or not.  It does check d_mountpoint() on the dentry,
which can result in a weird error if the VFS found that the mount does not in
fact need to be followed, e.g.:

  # mount --bind /mnt/nfs /mnt/nfs-clone
  # echo something > /mnt/nfs/tmp/bar
  # echo x > /tmp/file
  # mount --bind /tmp/file /mnt/nfs-clone/tmp/bar
  # cat  /mnt/nfs/tmp/bar
  cat: /mnt/nfs/tmp/bar: Not a directory

Which should, by any sane filesystem, result in "something" being printed.

So instead do the open in f_op->open() and in the unlikely case that the cached
dentry turned out to be invalid, drop the dentry and return EOPENSTALE to let
the VFS retry.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: retry last component if opening stale dentry
Miklos Szeredi [Mon, 21 May 2012 15:30:19 +0000 (17:30 +0200)]
vfs: retry last component if opening stale dentry

NFS optimizes away d_revalidates for last component of open.  This means that
open itself can find the dentry stale.

This patch allows the filesystem to return EOPENSTALE and the VFS will retry the
lookup on just the last component if possible.

If the lookup was done using RCU mode, including the last component, then this
is not possible since the parent dentry is lost.  In this case fall back to
non-RCU lookup.  Currently this is not used since NFS will always leave RCU
mode.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: nameidata_to_filp(): don't throw away file on error
Miklos Szeredi [Mon, 21 May 2012 15:30:18 +0000 (17:30 +0200)]
vfs: nameidata_to_filp(): don't throw away file on error

If open fails, don't put the file.  This allows it to be reused if open needs to
be retried.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: nameidata_to_filp(): inline __dentry_open()
Miklos Szeredi [Mon, 21 May 2012 15:30:17 +0000 (17:30 +0200)]
vfs: nameidata_to_filp(): inline __dentry_open()

Copy __dentry_open() into nameidata_to_filp().

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_dentry_open(): don't put filp
Miklos Szeredi [Mon, 21 May 2012 15:30:16 +0000 (17:30 +0200)]
vfs: do_dentry_open(): don't put filp

Move put_filp() out to __dentry_open(), the only caller now.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: split __dentry_open()
Miklos Szeredi [Mon, 21 May 2012 15:30:15 +0000 (17:30 +0200)]
vfs: split __dentry_open()

Split __dentry_open() into two functions:

  do_dentry_open() - does most of the actual work, doesn't put file on failure
  open_check_o_direct() - after a successful open, checks direct_IO method

This will allow i_op->atomic_open to do just the file initialization and leave
the direct_IO checking to the VFS.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_last() common post lookup
Miklos Szeredi [Mon, 21 May 2012 15:30:14 +0000 (17:30 +0200)]
vfs: do_last() common post lookup

Now the post lookup code can be shared between O_CREAT and plain opens since
they are essentially the same.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_last(): add audit_inode before open
Miklos Szeredi [Mon, 21 May 2012 15:30:13 +0000 (17:30 +0200)]
vfs: do_last(): add audit_inode before open

This allows this code to be shared between O_CREAT and plain opens.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_last(): only return EISDIR for O_CREAT
Miklos Szeredi [Mon, 21 May 2012 15:30:12 +0000 (17:30 +0200)]
vfs: do_last(): only return EISDIR for O_CREAT

This allows this code to be shared between O_CREAT and plain opens.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_last(): check LOOKUP_DIRECTORY
Miklos Szeredi [Mon, 21 May 2012 15:30:11 +0000 (17:30 +0200)]
vfs: do_last(): check LOOKUP_DIRECTORY

Check for ENOTDIR before finishing open.  This allows this code to be shared
between O_CREAT and plain opens.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_last(): make ENOENT exit RCU safe
Miklos Szeredi [Mon, 21 May 2012 15:30:10 +0000 (17:30 +0200)]
vfs: do_last(): make ENOENT exit RCU safe

This will allow this code to be used in RCU mode.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: make follow_link check RCU safe
Miklos Szeredi [Mon, 21 May 2012 15:30:09 +0000 (17:30 +0200)]
vfs: make follow_link check RCU safe

This will allow this code to be used in RCU mode.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_last(): use inode variable
Miklos Szeredi [Mon, 21 May 2012 15:30:08 +0000 (17:30 +0200)]
vfs: do_last(): use inode variable

Use helper variable instead of path->dentry->d_inode before complete_walk().
This will allow this code to be used in RCU mode.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_last(): inline walk_component()
Miklos Szeredi [Mon, 21 May 2012 15:30:07 +0000 (17:30 +0200)]
vfs: do_last(): inline walk_component()

Copy walk_component() into do_lookup().

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: do_last(): make exit RCU safe
Miklos Szeredi [Mon, 21 May 2012 15:30:06 +0000 (17:30 +0200)]
vfs: do_last(): make exit RCU safe

Allow returning from do_last() with LOOKUP_RCU still set on the "out:" and
"exit:" labels.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agovfs: split do_lookup()
Miklos Szeredi [Mon, 21 May 2012 15:30:05 +0000 (17:30 +0200)]
vfs: split do_lookup()

Split do_lookup() into two functions:

  lookup_fast() - does cached lookup without i_mutex
  lookup_slow() - does lookup with i_mutex

Both follow managed dentries.

The new functions are needed by atomic_open.

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoBtrfs: move over to use ->update_time
Josef Bacik [Mon, 26 Mar 2012 13:46:47 +0000 (09:46 -0400)]
Btrfs: move over to use ->update_time

Btrfs had been doing it's own file_update_time so we could catch ENOSPC
properly, so just update our btrfs_update_time to work with the new stuff and
then we'll be fancy later.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
12 years agofs: introduce inode operation ->update_time
Josef Bacik [Mon, 26 Mar 2012 13:59:21 +0000 (09:59 -0400)]
fs: introduce inode operation ->update_time

Btrfs has to make sure we have space to allocate new blocks in order to modify
the inode, so updating time can fail.  We've gotten around this by having our
own file_update_time but this is kind of a pain, and Christoph has indicated he
would like to make xfs do something different with atime updates.  So introduce
->update_time, where we will deal with i_version an a/m/c time updates and
indicate which changes need to be made.  The normal version just does what it
has always done, updates the time and marks the inode dirty, and then
filesystems can choose to do something different.

I've gone through all of the users of file_update_time and made them check for
errors with the exception of the fault code since it's complicated and I wasn't
quite sure what to do there, also Jan is going to be pushing the file time
updates into page_mkwrite for those who have it so that should satisfy btrfs and
make it not a big deal to check the file_update_time() return code in the
generic fault path. Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
12 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux...
Linus Torvalds [Fri, 1 Jun 2012 15:37:31 +0000 (08:37 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs

Pull btrfs updates from Chris Mason:
 "This includes a fairly large change from Josef around data writeback
  completion.  Before, the writeback wasn't completed until the metadata
  insertions for the extent were done, and this made for fairly large
  latency spikes on the last page of each ordered extent.

  We already had a separate mechanism for tracking pending metadata
  insertions, so Josef just needed to tweak things a little to end
  writeback earlier on the page.  Overall it makes us much friendly to
  memory reclaim and lowers latencies quite a lot for synchronous IO.

  Jan Schmidt has finished some background work required to track btree
  blocks as they go through changes in ownership.  It's the missing
  piece he needed for both btrfs send/receive and subvolume quotas.
  Neither of those are ready yet, but the new tracking code is included
  here.  Most of the time, the new code is off.  It is only used by
  scrub and other backref walkers.

  Stefan Behrens has added io failure tracking.  This includes counters
  for which drives are causing the most trouble so the admin (or an
  automated tool) can choose to kick them out.  We're tracking IO
  errors, crc errors, and generation checks we do on each metadata
  block.

  RAID5/6 did miss the cut this time because I'm having trouble with
  corruptions.  I'll nail it down next week and post as a beta testing
  before 3.6"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (58 commits)
  Btrfs: fix tree mod log rewinded level and rewinding of moved keys
  Btrfs: fix tree mod log del_ptr
  Btrfs: add tree_mod_dont_log helper
  Btrfs: add missing spin_lock for insertion into tree mod log
  Btrfs: add inodes before dropping the extent lock in find_all_leafs
  Btrfs: use delayed ref sequence numbers for all fs-tree updates
  Btrfs: fix false positive in check-integrity on unmount
  Btrfs: fix runtime warning in check-integrity check data mode
  Btrfs: set ioprio of scrub readahead to idle
  Btrfs: fix return code in drop_objectid_items
  Btrfs: check to see if the inode is in the log before fsyncing
  Btrfs: return value of btrfs_read_buffer is checked correctly
  Btrfs: read device stats on mount, write modified ones during commit
  Btrfs: add ioctl to get and reset the device stats
  Btrfs: add device counters for detected IO and checksum errors
  btrfs: Drop unused function btrfs_abort_devices()
  Btrfs: fix the same inode id problem when doing auto defragment
  Btrfs: fall back to non-inline if we don't have enough space
  Btrfs: fix how we deal with the orphan block rsv
  Btrfs: convert the inode bit field to use the actual bit operations
  ...

12 years agoMerge branch 'for-3.5' of git://linux-nfs.org/~bfields/linux
Linus Torvalds [Fri, 1 Jun 2012 15:32:58 +0000 (08:32 -0700)]
Merge branch 'for-3.5' of git://linux-nfs.org/~bfields/linux

Pull the rest of the nfsd commits from Bruce Fields:
 "... and then I cherry-picked the remainder of the patches from the
  head of my previous branch"

This is the rest of the original nfsd branch, rebased without the
delegation stuff that I thought really needed to be redone.

I don't like rebasing things like this in general, but in this situation
this was the lesser of two evils.

* 'for-3.5' of git://linux-nfs.org/~bfields/linux: (50 commits)
  nfsd4: fix, consolidate client_has_state
  nfsd4: don't remove rebooted client record until confirmation
  nfsd4: remove some dprintk's and a comment
  nfsd4: return "real" sequence id in confirmed case
  nfsd4: fix exchange_id to return confirm flag
  nfsd4: clarify that renewing expired client is a bug
  nfsd4: simpler ordering of setclientid_confirm checks
  nfsd4: setclientid: remove pointless assignment
  nfsd4: fix error return in non-matching-creds case
  nfsd4: fix setclientid_confirm same_cred check
  nfsd4: merge 3 setclientid cases to 2
  nfsd4: pull out common code from setclientid cases
  nfsd4: merge last two setclientid cases
  nfsd4: setclientid/confirm comment cleanup
  nfsd4: setclientid remove unnecessary terms from a logical expression
  nfsd4: move rq_flavor into svc_cred
  nfsd4: stricter cred comparison for setclientid/exchange_id
  nfsd4: move principal name into svc_cred
  nfsd4: allow removing clients not holding state
  nfsd4: rearrange exchange_id logic to simplify
  ...

12 years agoreiserfs: get rid of resierfs_sync_super
Artem Bityutskiy [Fri, 1 Jun 2012 14:18:08 +0000 (17:18 +0300)]
reiserfs: get rid of resierfs_sync_super

This patch stops reiserfs using the VFS 'write_super()' method along with the
s_dirt flag, because they are on their way out.

The whole "superblock write-out" VFS infrastructure is served by the
'sync_supers()' kernel thread, which wakes up every 5 (by default) seconds and
writes out all dirty superblock using the '->write_super()' call-back.  But the
problem with this thread is that it wastes power by waking up the system every
5 seconds, even if there are no diry superblocks, or there are no client
file-systems which would need this (e.g., btrfs does not use
'->write_super()'). So we want to kill it completely and thus, we need to make
file-systems to stop using the '->write_super()' VFS service, and then remove
it together with the kernel thread.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoreiserfs: mark the superblock as dirty a bit later
Artem Bityutskiy [Fri, 1 Jun 2012 14:18:07 +0000 (17:18 +0300)]
reiserfs: mark the superblock as dirty a bit later

The 'journal_mark_dirty()' function currently first marks the superblock as
dirty by setting 's_dirt' to 1, then does various sanity checks and returns,
then actuall does all the magic with the journal.

This is not an ideal order, though. It makes more sense to first do all the
checks, then do all the internal stuff, and at the end notify the VFS that the
superblock is now dirty.

This patch moves the 's_dirt = 1' assignment from the very beginning of this
function to the very end.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoreiserfs: remove useless superblock dirtying
Artem Bityutskiy [Fri, 1 Jun 2012 14:18:06 +0000 (17:18 +0300)]
reiserfs: remove useless superblock dirtying

The 'reiserfs_resize()' function marks the superblock as dirty by assigning 1
to 's_dirt' and then calls 'journal_mark_dirty()' which does the same. Thus,
we can remove the assignment from 'reiserfs_resize()'.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoreiserfs: clean-up function return type
Artem Bityutskiy [Fri, 1 Jun 2012 14:18:05 +0000 (17:18 +0300)]
reiserfs: clean-up function return type

Turn 'reiserfs_flush_old_commits()' into a void function because the callers
do not cares about what it returns anyway.

We are going to remove the 'sb->s_dirt' field completely and this patch is a
small step towards this direction.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoreiserfs: cleanup reiserfs_fill_super a bit
Artem Bityutskiy [Fri, 1 Jun 2012 14:18:04 +0000 (17:18 +0300)]
reiserfs: cleanup reiserfs_fill_super a bit

We have the reiserfs superblock pointer in the 'sbi' variable in this
function, no need to use the 'REISERFS_SB(s)' macro which is the same.
This is jut a small clean-up.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agosch_atm.c: get rid of poinless extern
Al Viro [Thu, 19 Apr 2012 22:17:15 +0000 (18:17 -0400)]
sch_atm.c: get rid of poinless extern

sockfd_lookup() is declared in linux/net.h, which is pulled by
linux/skbuff.h (and needed for a lot of other stuff in sch_atm.c
anyway).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agounexport do_munmap()
Al Viro [Thu, 31 May 2012 00:19:20 +0000 (20:19 -0400)]
unexport do_munmap()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agonew helper: vm_mmap_pgoff()
Al Viro [Thu, 31 May 2012 00:17:35 +0000 (20:17 -0400)]
new helper: vm_mmap_pgoff()

take it to mm/util.c, convert vm_mmap() to use of that one and
take it to mm/util.c as well, convert both sys_mmap_pgoff() to
use of vm_mmap_pgoff()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agokill do_mmap() completely
Al Viro [Thu, 31 May 2012 00:11:57 +0000 (20:11 -0400)]
kill do_mmap() completely

just pull into vm_mmap()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoswitch aio and shm to do_mmap_pgoff(), make do_mmap() static
Al Viro [Thu, 31 May 2012 00:08:42 +0000 (20:08 -0400)]
switch aio and shm to do_mmap_pgoff(), make do_mmap() static

after all, 0 bytes and 0 pages is the same thing...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agotake calculation of final prot in security_mmap_file() into a helper
Al Viro [Wed, 30 May 2012 23:58:30 +0000 (19:58 -0400)]
take calculation of final prot in security_mmap_file() into a helper

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agomove security_mmap_addr() to saner place
Al Viro [Wed, 30 May 2012 21:13:15 +0000 (17:13 -0400)]
move security_mmap_addr() to saner place

it really should be done by get_unmapped_area(); that cuts down on
the amount of callers considerably and it's the right place for
that stuff anyway.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agotake security_mmap_file() outside of ->mmap_sem
Al Viro [Wed, 30 May 2012 21:11:23 +0000 (17:11 -0400)]
take security_mmap_file() outside of ->mmap_sem

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
12 years agoext4: hole-punch use truncate_pagecache_range
Hugh Dickins [Fri, 1 Jun 2012 04:15:28 +0000 (00:15 -0400)]
ext4: hole-punch use truncate_pagecache_range

When truncating a file, we unmap pages from userspace first, as that's
usually more efficient than relying, page by page, on the fallback in
truncate_inode_page() - particularly if the file is mapped many times.

Do the same when punching a hole: 3.4 added truncate_pagecache_range()
to do the unmap and trunc, so use it in ext4_ext_punch_hole(), instead
of calling truncate_inode_pages_range() directly.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agojbd2: use kmem_cache_zalloc wrapper instead of flag
Wanlong Gao [Fri, 1 Jun 2012 04:10:32 +0000 (00:10 -0400)]
jbd2: use kmem_cache_zalloc wrapper instead of flag

Use kmem_cache_zalloc wrapper instead of flag __GFP_ZERO.

Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoext4: remove mb_groups before tearing down the buddy_cache
Salman Qazi [Fri, 1 Jun 2012 03:52:14 +0000 (23:52 -0400)]
ext4: remove mb_groups before tearing down the buddy_cache

We can't have references held on pages in the s_buddy_cache while we are
trying to truncate its pages and put the inode.  All the pages must be
gone before we reach clear_inode.  This can only be gauranteed if we
can prevent new users from grabbing references to s_buddy_cache's pages.

The original bug can be reproduced and the bug fix can be verified by:

while true; do mount -t ext4 /dev/ram0 /export/hda3/ram0; \
umount /export/hda3/ram0; done &

while true; do cat /proc/fs/ext4/ram0/mb_groups; done

Signed-off-by: Salman Qazi <sqazi@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
12 years agoext4: add ext4_mb_unload_buddy in the error path
Salman Qazi [Fri, 1 Jun 2012 03:51:27 +0000 (23:51 -0400)]
ext4: add ext4_mb_unload_buddy in the error path

ext4_free_blocks fails to pair an ext4_mb_load_buddy with a matching
ext4_mb_unload_buddy when it fails a memory allocation.

Signed-off-by: Salman Qazi <sqazi@google.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
12 years agoext4: don't trash state flags in EXT4_IOC_SETFLAGS
Theodore Ts'o [Fri, 1 Jun 2012 03:46:01 +0000 (23:46 -0400)]
ext4: don't trash state flags in EXT4_IOC_SETFLAGS

In commit 353eb83c we removed i_state_flags with 64-bit longs, But
when handling the EXT4_IOC_SETFLAGS ioctl, we replace i_flags
directly, which trashes the state flags which are stored in the high
32-bits of i_flags on 64-bit platforms.  So use the the
ext4_{set,clear}_inode_flags() functions which use atomic bit
manipulation functions instead.

Reported-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Cc: stable@kernel.org
12 years agoext4: let getattr report the right blocks in delalloc+bigalloc
Tao Ma [Fri, 1 Jun 2012 02:54:16 +0000 (22:54 -0400)]
ext4: let getattr report the right blocks in delalloc+bigalloc

In delayed allocation, i_reserved_data_blocks now indicates
clusters, not blocks. So report it in the right number.

This can be easily exposed by the following command:
echo foo > blah; du -hc blah; sync; du -hc blah

Reported-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
12 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal
Linus Torvalds [Fri, 1 Jun 2012 01:47:30 +0000 (18:47 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal

Pull second pile of signal handling patches from Al Viro:
 "This one is just task_work_add() series + remaining prereqs for it.

  There probably will be another pull request from that tree this
  cycle - at least for helpers, to get them out of the way for per-arch
  fixes remaining in the tree."

Fix trivial conflict in kernel/irq/manage.c: the merge of Andrew's pile
had brought in commit 97fd75b7b8e0 ("kernel/irq/manage.c: use the
pr_foo() infrastructure to prefix printks") which changed one of the
pr_err() calls that this merge moves around.

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/signal:
  keys: kill task_struct->replacement_session_keyring
  keys: kill the dummy key_replace_session_keyring()
  keys: change keyctl_session_to_parent() to use task_work_add()
  genirq: reimplement exit_irq_thread() hook via task_work_add()
  task_work_add: generic process-context callbacks
  avr32: missed _TIF_NOTIFY_RESUME on one of do_notify_resume callers
  parisc: need to check NOTIFY_RESUME when exiting from syscall
  move key_repace_session_keyring() into tracehook_notify_resume()
  TIF_NOTIFY_RESUME is defined on all targets now

12 years agoMerge branch 'for-3.5-take-2' of git://linux-nfs.org/~bfields/linux
Linus Torvalds [Fri, 1 Jun 2012 01:18:11 +0000 (18:18 -0700)]
Merge branch 'for-3.5-take-2' of git://linux-nfs.org/~bfields/linux

Pull nfsd update from Bruce Fields.

* 'for-3.5-take-2' of git://linux-nfs.org/~bfields/linux: (23 commits)
  nfsd: trivial: use SEEK_SET instead of 0 in vfs_llseek
  SUNRPC: split upcall function to extract reusable parts
  nfsd: allocate id-to-name and name-to-id caches in per-net operations.
  nfsd: make name-to-id cache allocated per network namespace context
  nfsd: make id-to-name cache allocated per network namespace context
  nfsd: pass network context to idmap init/exit functions
  nfsd: allocate export and expkey caches in per-net operations.
  nfsd: make expkey cache allocated per network namespace context
  nfsd: make export cache allocated per network namespace context
  nfsd: pass pointer to export cache down to stack wherever possible.
  nfsd: pass network context to export caches init/shutdown routines
  Lockd: pass network namespace to creation and destruction routines
  NFSd: remove hard-coded dereferences to name-to-id and id-to-name caches
  nfsd: pass pointer to expkey cache down to stack wherever possible.
  nfsd: use hash table from cache detail in nfsd export seq ops
  nfsd: pass svc_export_cache pointer as private data to "exports" seq file ops
  nfsd: use exp_put() for svc_export_cache put
  nfsd: use cache detail pointer from svc_export structure on cache put
  nfsd: add link to owner cache detail to svc_export structure
  nfsd: use passed cache_detail pointer expkey_parse()
  ...