]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/log
mirror_ubuntu-eoan-kernel.git
14 years agoget rid of home-grown mutex in cris eeprom.c
Al Viro [Fri, 21 May 2010 15:19:18 +0000 (11:19 -0400)]
get rid of home-grown mutex in cris eeprom.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch ecryptfs_write() to struct inode *, kill on-stack fake files
Al Viro [Fri, 21 May 2010 15:09:58 +0000 (11:09 -0400)]
switch ecryptfs_write() to struct inode *, kill on-stack fake files

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch ecryptfs_get_locked_page() to struct inode *
Al Viro [Fri, 21 May 2010 15:02:14 +0000 (11:02 -0400)]
switch ecryptfs_get_locked_page() to struct inode *

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosimplify access to ecryptfs inodes in ->readpage() and friends
Al Viro [Fri, 21 May 2010 14:56:12 +0000 (10:56 -0400)]
simplify access to ecryptfs inodes in ->readpage() and friends

we can get to them from page->mapping->host, no need to mess with
file.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoAFS: Don't put struct file on the stack
Al Viro [Fri, 21 May 2010 14:27:09 +0000 (15:27 +0100)]
AFS: Don't put struct file on the stack

Don't put struct file on the stack as it takes up quite a lot of space
and violates lifetime rules for struct file.

Rather than calling afs_readpage() indirectly from the directory routines by
way of read_mapping_page(), split afs_readpage() to have afs_page_filler()
that's given a key instead of a file and call read_cache_page(), specifying the
new function directly.  Use it in afs_readpages() as well.

Also make use of this in afs_mntpt_check_symlink() too for the same reason.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
14 years agoBan ecryptfs over ecryptfs
Al Viro [Mon, 17 May 2010 04:59:46 +0000 (00:59 -0400)]
Ban ecryptfs over ecryptfs

This is a seriously simplified patch from Eric Sandeen; copy of
rationale follows:
===
  mounting stacked ecryptfs on ecryptfs has been shown to lead to bugs
  in testing.  For crypto info in xattr, there is no mechanism for handling
  this at all, and for normal file headers, we run into other trouble:

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
  IP: [<ffffffffa015b0b3>] ecryptfs_d_revalidate+0x43/0xa0 [ecryptfs]
  ...

  There doesn't seem to be any good usecase for this, so I'd suggest just
  disallowing the configuration.

  Based on a patch originally, I believe, from Mike Halcrow.
===

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agologfs: replace inode uid,gid,mode initialization with helper function
Al Viro [Sat, 15 May 2010 08:02:54 +0000 (04:02 -0400)]
logfs: replace inode uid,gid,mode initialization with helper function

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoufs: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:23 +0000 (17:32 +0300)]
ufs: replace inode uid,gid,mode initialization with helper function

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoudf: replace inode uid,gid,mode init with helper
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:22 +0000 (17:32 +0300)]
udf: replace inode uid,gid,mode init with helper

Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoubifs: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:21 +0000 (17:32 +0300)]
ubifs: replace inode uid,gid,mode initialization with helper function

Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosysv: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:20 +0000 (17:32 +0300)]
sysv: replace inode uid,gid,mode initialization with helper function

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoreiserfs: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:19 +0000 (17:32 +0300)]
reiserfs: replace inode uid,gid,mode initialization with helper function

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoramfs: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:18 +0000 (17:32 +0300)]
ramfs: replace inode uid,gid,mode initialization with helper function

- seems what ramfs_get_inode is only locally, make it static.
[AV: the hell it is; it's used by shmem, so shmem needed conversion too
and no, that function can't be made static]

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoomfs: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:17 +0000 (17:32 +0300)]
omfs: replace inode uid,gid,mode initialization with helper function

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agobfs: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:31:46 +0000 (17:31 +0300)]
bfs: replace inode uid,gid,mode initialization with helper function

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoocfs2: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:16 +0000 (17:32 +0300)]
ocfs2: replace inode uid,gid,mode initialization with helper function

Acked-by: Joel Becker <joel.becker@oracle.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agonilfs2: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:15 +0000 (17:32 +0300)]
nilfs2: replace inode uid,gid,mode initialization with helper function

Acked-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agominix: replace inode uid,gid,mode init with helper
Dmitry Monakhov [Thu, 4 Mar 2010 14:32:14 +0000 (17:32 +0300)]
minix: replace inode uid,gid,mode init with helper

- also redesign minix_new_inode interface

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoext4: replace inode uid,gid,mode init with helper
Dmitry Monakhov [Thu, 4 Mar 2010 14:31:51 +0000 (17:31 +0300)]
ext4: replace inode uid,gid,mode init with helper

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoext3: replace inode uid,gid,mode init with helper
Dmitry Monakhov [Thu, 4 Mar 2010 14:31:50 +0000 (17:31 +0300)]
ext3: replace inode uid,gid,mode init with helper

Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoext2: replace inode uid,gid,mode init with helper
Dmitry Monakhov [Thu, 4 Mar 2010 14:31:49 +0000 (17:31 +0300)]
ext2: replace inode uid,gid,mode init with helper

Acked-by: Jan Kara <jack@suse.cz>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoexofs: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:31:48 +0000 (17:31 +0300)]
exofs: replace inode uid,gid,mode initialization with helper function

Ack-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agobtrfs: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:31:47 +0000 (17:31 +0300)]
btrfs: replace inode uid,gid,mode initialization with helper function

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agojfs: replace inode uid,gid,mode init with helper
Dmitry Monakhov [Thu, 4 Mar 2010 14:30:58 +0000 (17:30 +0300)]
jfs: replace inode uid,gid,mode init with helper

Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years ago9p: replace inode uid,gid,mode initialization with helper function
Dmitry Monakhov [Thu, 4 Mar 2010 14:30:57 +0000 (17:30 +0300)]
9p: replace inode uid,gid,mode initialization with helper function

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agovfs: Add inode uid,gid,mode init helper
Dmitry Monakhov [Thu, 4 Mar 2010 14:29:14 +0000 (17:29 +0300)]
vfs: Add inode uid,gid,mode init helper

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofs-writeback.c: bitfields should be unsigned
H Hartley Sweeten [Fri, 2 Apr 2010 01:36:30 +0000 (20:36 -0500)]
fs-writeback.c: bitfields should be unsigned

This fixes sparse noise:
  error: dubious one-bit signed bitfield

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agonamei.c : update mnt when it needed
Huang Shijie [Fri, 2 Apr 2010 09:37:13 +0000 (17:37 +0800)]
namei.c : update mnt when it needed

update the mnt of the path when it is not equal to the new one.

Signed-off-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agovfs: add lockdep annotation to s_vfs_rename_key for ecryptfs
Roland Dreier [Tue, 27 Apr 2010 21:23:57 +0000 (14:23 -0700)]
vfs: add lockdep annotation to s_vfs_rename_key for ecryptfs

 >  =============================================
 >  [ INFO: possible recursive locking detected ]
 >  2.6.31-2-generic #14~rbd3
 >  ---------------------------------------------
 >  firefox-3.5/4162 is trying to acquire lock:
 >   (&s->s_vfs_rename_mutex){+.+.+.}, at: [<ffffffff81139d31>] lock_rename+0x41/0xf0
 >
 >  but task is already holding lock:
 >   (&s->s_vfs_rename_mutex){+.+.+.}, at: [<ffffffff81139d31>] lock_rename+0x41/0xf0
 >
 >  other info that might help us debug this:
 >  3 locks held by firefox-3.5/4162:
 >   #0:  (&s->s_vfs_rename_mutex){+.+.+.}, at: [<ffffffff81139d31>] lock_rename+0x41/0xf0
 >   #1:  (&sb->s_type->i_mutex_key#11/1){+.+.+.}, at: [<ffffffff81139d5a>] lock_rename+0x6a/0xf0
 >   #2:  (&sb->s_type->i_mutex_key#11/2){+.+.+.}, at: [<ffffffff81139d6f>] lock_rename+0x7f/0xf0
 >
 >  stack backtrace:
 >  Pid: 4162, comm: firefox-3.5 Tainted: G         C 2.6.31-2-generic #14~rbd3
 >  Call Trace:
 >   [<ffffffff8108ae74>] print_deadlock_bug+0xf4/0x100
 >   [<ffffffff8108ce26>] validate_chain+0x4c6/0x750
 >   [<ffffffff8108d2e7>] __lock_acquire+0x237/0x430
 >   [<ffffffff8108d585>] lock_acquire+0xa5/0x150
 >   [<ffffffff81139d31>] ? lock_rename+0x41/0xf0
 >   [<ffffffff815526ad>] __mutex_lock_common+0x4d/0x3d0
 >   [<ffffffff81139d31>] ? lock_rename+0x41/0xf0
 >   [<ffffffff81139d31>] ? lock_rename+0x41/0xf0
 >   [<ffffffff8120eaf9>] ? ecryptfs_rename+0x99/0x170
 >   [<ffffffff81552b36>] mutex_lock_nested+0x46/0x60
 >   [<ffffffff81139d31>] lock_rename+0x41/0xf0
 >   [<ffffffff8120eb2a>] ecryptfs_rename+0xca/0x170
 >   [<ffffffff81139a9e>] vfs_rename_dir+0x13e/0x160
 >   [<ffffffff8113ac7e>] vfs_rename+0xee/0x290
 >   [<ffffffff8113c212>] ? __lookup_hash+0x102/0x160
 >   [<ffffffff8113d512>] sys_renameat+0x252/0x280
 >   [<ffffffff81133eb4>] ? cp_new_stat+0xe4/0x100
 >   [<ffffffff8101316a>] ? sysret_check+0x2e/0x69
 >   [<ffffffff8108c34d>] ? trace_hardirqs_on_caller+0x14d/0x190
 >   [<ffffffff8113d55b>] sys_rename+0x1b/0x20
 >   [<ffffffff81013132>] system_call_fastpath+0x16/0x1b

The trace above is totally reproducible by doing a cross-directory
rename on an ecryptfs directory.

The issue seems to be that sys_renameat() does lock_rename() then calls
into the filesystem; if the filesystem is ecryptfs, then
ecryptfs_rename() again does lock_rename() on the lower filesystem, and
lockdep can't tell that the two s_vfs_rename_mutexes are different.  It
seems an annotation like the following is sufficient to fix this (it
does get rid of the lockdep trace in my simple tests); however I would
like to make sure I'm not misunderstanding the locking, hence the CC
list...

Signed-off-by: Roland Dreier <rdreier@cisco.com>
Cc: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
Cc: Dustin Kirkland <kirkland@canonical.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofs/partitions: use ADDPART_FLAG_RAID instead of magic number
Cesar Eduardo Barros [Sat, 17 Apr 2010 22:28:09 +0000 (19:28 -0300)]
fs/partitions: use ADDPART_FLAG_RAID instead of magic number

ADDPART_FLAG_RAID was introduced in commit d18d768, and most places were
converted to use it instead of a hardcoded value. However, some places seem
to have been missed.

Change all of them to the symbolic names via the following semantic patch:

@@
struct parsed_partitions *state;
expression E;
@@
(
- state->parts[E].flags = 1
+ state->parts[E].flags = ADDPART_FLAG_RAID
|
- state->parts[E].flags |= 1
+ state->parts[E].flags |= ADDPART_FLAG_RAID
|
- state->parts[E].flags = 2
+ state->parts[E].flags = ADDPART_FLAG_WHOLEDISK
|
- state->parts[E].flags |= 2
+ state->parts[E].flags |= ADDPART_FLAG_WHOLEDISK
)

Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosanitize vfs_fsync calling conventions
Christoph Hellwig [Mon, 22 Mar 2010 16:32:25 +0000 (17:32 +0100)]
sanitize vfs_fsync calling conventions

Now that the last user passing a NULL file pointer is gone we can remove
the redundant dentry argument and associated hacks inside vfs_fsynmc_range.

The next step will be removig the dentry argument from ->fsync, but given
the luck with the last round of method prototype changes I'd rather
defer this until after the main merge window.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agonfsd: open a file descriptor for fsync in nfs4 recovery
Christoph Hellwig [Mon, 22 Mar 2010 16:32:14 +0000 (17:32 +0100)]
nfsd: open a file descriptor for fsync in nfs4 recovery

Instead of just looking up a path use do_filp_open to get us a file
structure for the nfs4 recovery directory.  This allows us to get
rid of the last non-standard vfs_fsync caller with a NULL file
pointer.

[AV: should be using fput(), not filp_close()]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofs: inode.c use atomic_inc_return in __iget
Richard Kennedy [Fri, 14 May 2010 09:49:22 +0000 (10:49 +0100)]
fs: inode.c use atomic_inc_return in __iget

Using atomic_inc_return in __iget(struct inode *inode) makes the intent
of this code clearer and generates less code on processors that have
this operation.

On x86_64 this patch reduces the text size of inode.o by 12 bytes.

Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
----
patch against 2.6.34-rc7
compiled & tested on x86_64 AMD X2

I've been running with this patch applied for several weeks with no
obvious problems.
regards
Richard
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoanon_inode: set S_IFREG on the anon_inode
Eric Paris [Fri, 14 May 2010 15:44:10 +0000 (11:44 -0400)]
anon_inode: set S_IFREG on the anon_inode

anon_inode_mkinode() sets inode->i_mode = S_IRUSR | S_IWUSR;  This means
that (inode->i_mode & S_IFMT) == 0.  This trips up some SELinux code that
needs to determine if a given inode is a regular file, a directory, etc.
The easiest solution is to just make sure that the anon_inode also sets
S_IFREG.

Signed-off-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agogfs: constify xattr_handler
Stephen Hemminger [Fri, 14 May 2010 00:53:23 +0000 (17:53 -0700)]
gfs: constify xattr_handler

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoocfs: constify xattr_handler
Stephen Hemminger [Fri, 14 May 2010 00:53:22 +0000 (17:53 -0700)]
ocfs: constify xattr_handler

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agojffs2: constify xattr_handler
Stephen Hemminger [Fri, 14 May 2010 00:53:21 +0000 (17:53 -0700)]
jffs2: constify xattr_handler

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoxfs: constify xattr_handler
Stephen Hemminger [Fri, 14 May 2010 00:53:20 +0000 (17:53 -0700)]
xfs: constify xattr_handler

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoreiserfs: constify xattr_handler
Stephen Hemminger [Fri, 14 May 2010 00:53:19 +0000 (17:53 -0700)]
reiserfs: constify xattr_handler

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoext4: constify xattr_handler
Stephen Hemminger [Fri, 14 May 2010 00:53:18 +0000 (17:53 -0700)]
ext4: constify xattr_handler

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoext3: constify xattr handlers
Stephen Hemminger [Fri, 14 May 2010 00:53:17 +0000 (17:53 -0700)]
ext3: constify xattr handlers

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoext2: constify xattr_handler
Stephen Hemminger [Fri, 14 May 2010 00:53:16 +0000 (17:53 -0700)]
ext2: constify xattr_handler

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agobtrfs: constify xattr_handler
Stephen Hemminger [Fri, 14 May 2010 00:53:15 +0000 (17:53 -0700)]
btrfs: constify xattr_handler

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofs: xattr_handler table should be const
Stephen Hemminger [Fri, 14 May 2010 00:53:14 +0000 (17:53 -0700)]
fs: xattr_handler table should be const

The entries in xattr handler table should be immutable (ie const)
like other operation tables.

Later patches convert common filesystems. Uncoverted filesystems
will still work, but will generate a compiler warning.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoIntroduce freeze_super and thaw_super for the fsfreeze ioctl
Josef Bacik [Tue, 23 Mar 2010 14:34:56 +0000 (10:34 -0400)]
Introduce freeze_super and thaw_super for the fsfreeze ioctl

Currently the way we do freezing is by passing sb>s_bdev to freeze_bdev and then
letting it do all the work.  But freezing is more of an fs thing, and doesn't
really have much to do with the bdev at all, all the work gets done with the
super.  In btrfs we do not populate s_bdev, since we can have multiple bdev's
for one fs and setting s_bdev makes removing devices from a pool kind of tricky.
This means that freezing a btrfs filesystem fails, which causes us to corrupt
with things like tux-on-ice which use the fsfreeze mechanism.  So instead of
populating sb->s_bdev with a random bdev in our pool, I've broken the actual fs
freezing stuff into freeze_super and thaw_super.  These just take the
super_block that we're freezing and does the appropriate work.  It's basically
just copy and pasted from freeze_bdev.  I've then converted freeze_bdev over to
use the new super helpers.  I've tested this with ext4 and btrfs and verified
everything continues to work the same as before.

The only new gotcha is multiple calls to the fsfreeze ioctl will return EBUSY if
the fs is already frozen.  I thought this was a better solution than adding a
freeze counter to the super_block, but if everybody hates this idea I'm open to
suggestions.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoTrim includes in fs/super.c
Al Viro [Tue, 23 Mar 2010 17:56:07 +0000 (13:56 -0400)]
Trim includes in fs/super.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoMove grabbing s_umount to callers of grab_super()
Al Viro [Tue, 23 Mar 2010 15:11:05 +0000 (11:11 -0400)]
Move grabbing s_umount to callers of grab_super()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoTake statfs variants to fs/statfs.c
Al Viro [Tue, 23 Mar 2010 14:37:36 +0000 (10:37 -0400)]
Take statfs variants to fs/statfs.c

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch selinux delayed superblock handling to iterate_supers()
Al Viro [Tue, 23 Mar 2010 10:36:54 +0000 (06:36 -0400)]
switch selinux delayed superblock handling to iterate_supers()

... kill their private list, while we are at it

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agonew helper: iterate_supers()
Al Viro [Tue, 23 Mar 2010 10:06:58 +0000 (06:06 -0400)]
new helper: iterate_supers()

... and switch the simple "loop over superblocks and do something"
loops to it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoBury __put_super_and_need_restart()
Al Viro [Tue, 23 Mar 2010 01:13:53 +0000 (21:13 -0400)]
Bury __put_super_and_need_restart()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofix prune_dcache()/umount() race
Al Viro [Tue, 23 Mar 2010 00:27:55 +0000 (20:27 -0400)]
fix prune_dcache()/umount() race

... and get rid of the last __put_super_and_need_restart() caller

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoIn get_super() and user_get_super() restarts are unconditional
Al Viro [Tue, 23 Mar 2010 00:23:25 +0000 (20:23 -0400)]
In get_super() and user_get_super() restarts are unconditional

If superblock had been still alive, we would've returned it...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofix get_active_super()/umount() race
Al Viro [Tue, 23 Mar 2010 00:15:33 +0000 (20:15 -0400)]
fix get_active_super()/umount() race

This one needs restarts...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofix do_emergency_remount()/umount() races
Al Viro [Tue, 23 Mar 2010 00:11:53 +0000 (20:11 -0400)]
fix do_emergency_remount()/umount() races

need list_for_each_entry_safe() here.  Original didn't even
have restart logics, so if you race with umount() it blew up.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoConvert simple loops over superblocks to list_for_each_entry_safe
Al Viro [Tue, 23 Mar 2010 00:09:33 +0000 (20:09 -0400)]
Convert simple loops over superblocks to list_for_each_entry_safe

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of restarts in sync_filesystems()
Al Viro [Mon, 22 Mar 2010 23:56:42 +0000 (19:56 -0400)]
get rid of restarts in sync_filesystems()

At the same time we can kill s_need_restart and local mutex in there.
__put_super() made public for a while; will be gone later.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoLeave superblocks on s_list until the end
Al Viro [Mon, 22 Mar 2010 23:36:35 +0000 (19:36 -0400)]
Leave superblocks on s_list until the end

We used to remove from s_list and s_instances at the same
time.  So let's *not* do the former and skip superblocks
that have empty s_instances in the loops over s_list.

The next step, of course, will be to get rid of rescan logics
in those loops.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoSaner locking around deactivate_super()
Al Viro [Mon, 22 Mar 2010 19:22:31 +0000 (15:22 -0400)]
Saner locking around deactivate_super()

Make sure that s_umount is acquired *before* we drop the final
active reference; we still have the fast path (atomic_dec_unless)
and we have gotten rid of the window between the moment when
s_active hits zero and s_umount is acquired.  Which simplifies
the living hell out of grab_super() and inotify pin_to_kill()
stuff.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of S_BIAS
Al Viro [Mon, 22 Mar 2010 12:53:19 +0000 (08:53 -0400)]
get rid of S_BIAS

use atomic_inc_not_zero(&sb->s_active) instead of playing games with
checking ->s_count > S_BIAS

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of open-coded grab_super() in get_active_super()
Al Viro [Mon, 22 Mar 2010 02:34:11 +0000 (22:34 -0400)]
get rid of open-coded grab_super() in get_active_super()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosb_entry() has been killed a couple of years ago and resurrected on mismerge
Al Viro [Sun, 21 Mar 2010 23:24:23 +0000 (19:24 -0400)]
sb_entry() has been killed a couple of years ago and resurrected on mismerge

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoceph: should use deactivate_locked_super() on failure exits
Al Viro [Sun, 21 Mar 2010 23:22:29 +0000 (19:22 -0400)]
ceph: should use deactivate_locked_super() on failure exits

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoClean ecryptfs ->get_sb() up
Al Viro [Sun, 21 Mar 2010 16:24:29 +0000 (12:24 -0400)]
Clean ecryptfs ->get_sb() up

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofix a couple of ecryptfs leaks
Al Viro [Sun, 21 Mar 2010 02:32:26 +0000 (22:32 -0400)]
fix a couple of ecryptfs leaks

First of all, get_sb_nodev() grabs anon dev minor and we
never free it in ecryptfs ->kill_sb().  Moreover, on one
of the failure exits in ecryptfs_get_sb() we leak things -
it happens before we set ->s_root and ->put_super() won't
be called in that case.  Solution: kill ->put_super(), do
all that stuff in ->kill_sb().  And use kill_anon_sb() instead
of generic_shutdown_super() to deal with anon dev leak.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoSimplify devpts_get_sb() failure exits
Al Viro [Sun, 21 Mar 2010 01:57:43 +0000 (21:57 -0400)]
Simplify devpts_get_sb() failure exits

postpone simple_set_mnt() until we know we won't fail.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoremove incorrect comment in do_emergency_remount
Christoph Hellwig [Mon, 1 Feb 2010 20:55:52 +0000 (21:55 +0100)]
remove incorrect comment in do_emergency_remount

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoclean DCACHE_CANT_MOUNT in d_delete()
Al Viro [Fri, 21 May 2010 20:11:04 +0000 (16:11 -0400)]
clean DCACHE_CANT_MOUNT in d_delete()

We set the "it's dead, don't mount on it" flag _and_ do not remove it if
we turn the damn thing negative and leave it around.  And if it goes
positive afterwards, well...

Fortunately, there's only one place where that needs to be caught:
only d_delete() can turn the sucker negative without immediately freeing
it; all other places that can lead to ->d_iput() call are followed by
unconditionally freeing struct dentry in question.  So the fix is obvious:

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16014
Reported-by: Adam Tkac <vonsch@gmail.com>
Tested-by: Adam Tkac <vonsch@gmail.com>
Cc: <stable@kernel.org> [2.6.34.x]
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
Linus Torvalds [Fri, 21 May 2010 18:17:43 +0000 (11:17 -0700)]
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-udf-2.6:
  udf: BKL ioctl pushdown

14 years agoMerge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
Linus Torvalds [Fri, 21 May 2010 18:17:05 +0000 (11:17 -0700)]
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc

* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (92 commits)
  powerpc: Remove unused 'protect4gb' boot parameter
  powerpc: Build-in e1000e for pseries & ppc64_defconfig
  powerpc/pseries: Make request_ras_irqs() available to other pseries code
  powerpc/numa: Use ibm,architecture-vec-5 to detect form 1 affinity
  powerpc/numa: Set a smaller value for RECLAIM_DISTANCE to enable zone reclaim
  powerpc: Use smt_snooze_delay=-1 to always busy loop
  powerpc: Remove check of ibm,smt-snooze-delay OF property
  powerpc/kdump: Fix race in kdump shutdown
  powerpc/kexec: Fix race in kexec shutdown
  powerpc/kexec: Speedup kexec hash PTE tear down
  powerpc/pseries: Add hcall to read 4 ptes at a time in real mode
  powerpc: Use more accurate limit for first segment memory allocations
  powerpc/kdump: Use chip->shutdown to disable IRQs
  powerpc/kdump: CPUs assume the context of the oopsing CPU
  powerpc/crashdump: Do not fail on NULL pointer dereferencing
  powerpc/eeh: Fix oops when probing in early boot
  powerpc/pci: Check devices status property when scanning OF tree
  powerpc/vio: Switch VIO Bus PM to use generic helpers
  powerpc: Avoid bad relocations in iSeries code
  powerpc: Use common cpu_die (fixes SMP+SUSPEND build)
  ...

14 years agoMerge branch 'drm-for-2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/airlie...
Linus Torvalds [Fri, 21 May 2010 18:14:52 +0000 (11:14 -0700)]
Merge branch 'drm-for-2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-for-2.6.35' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (207 commits)
  drm/radeon/kms/pm/r600: select the mid clock mode for single head low profile
  drm/radeon: fix power supply kconfig interaction.
  drm/radeon/kms: record object that have been list reserved
  drm/radeon: AGP memory is only I/O if the aperture can be mapped by the CPU.
  drm/radeon/kms: don't default display priority to high on rs4xx
  drm/edid: fix typo in 1600x1200@75 mode
  drm/nouveau: fix i2c-related init table handlers
  drm/nouveau: support init table i2c device identifier 0x81
  drm/nouveau: ensure we've parsed i2c table entry for INIT_*I2C* handlers
  drm/nouveau: display error message for any failed init table opcode
  drm/nouveau: fix init table handlers to return proper error codes
  drm/nv50: support fractional feedback divider on newer chips
  drm/nv50: fix monitor detection on certain chipsets
  drm/nv50: store full dcb i2c entry from vbios
  drm/nv50: fix suspend/resume with DP outputs
  drm/nv50: output calculated crtc pll when debugging on
  drm/nouveau: dump pll limits entries when debugging is on
  drm/nouveau: bios parser fixes for eDP boards
  drm/nouveau: fix a nouveau_bo dereference after it's been destroyed
  drm/nv40: remove some completed ctxprog TODOs
  ...

14 years agoMerge branch 'dbg-early-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwess...
Linus Torvalds [Fri, 21 May 2010 18:10:41 +0000 (11:10 -0700)]
Merge branch 'dbg-early-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb

* 'dbg-early-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb:
  echi-dbgp: Add kernel debugger support for the usb debug port
  earlyprintk,vga,kdb: Fix \b and \r for earlyprintk=vga with kdb
  kgdboc: Add ekgdboc for early use of the kernel debugger
  x86,early dr regs,kgdb: Allow kernel debugger early dr register access
  x86,kgdb: Implement early hardware breakpoint debugging
  x86, kgdb, init: Add early and late debug states
  x86, kgdb: early trap init for early debug

14 years agoMerge branch 'kdb-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel...
Linus Torvalds [Fri, 21 May 2010 18:08:05 +0000 (11:08 -0700)]
Merge branch 'kdb-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb

* 'kdb-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/jwessel/linux-2.6-kgdb: (25 commits)
  kdb,debug_core: Allow the debug core to receive a panic notification
  MAINTAINERS: update kgdb, kdb, and debug_core info
  debug_core,kdb: Allow the debug core to process a recursive debug entry
  printk,kdb: capture printk() when in kdb shell
  kgdboc,kdb: Allow kdb to work on a non open console port
  kgdb: Add the ability to schedule a breakpoint via a tasklet
  mips,kgdb: kdb low level trap catch and stack trace
  powerpc,kgdb: Introduce low level trap catching
  x86,kgdb: Add low level debug hook
  kgdb: remove post_primary_code references
  kgdb,docs: Update the kgdb docs to include kdb
  kgdboc,keyboard: Keyboard driver for kdb with kgdb
  kgdb: gdb "monitor" -> kdb passthrough
  sparc,sunzilog: Add console polling support for sunzilog serial driver
  sh,sh-sci: Use NO_POLL_CHAR in the SCIF polled console code
  kgdb,8250,pl011: Return immediately from console poll
  kgdb: core changes to support kdb
  kdb: core for kgdb back end (2 of 2)
  kdb: core for kgdb back end (1 of 2)
  kgdb,blackfin: Add in kgdb_arch_set_pc for blackfin
  ...

14 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Linus Torvalds [Fri, 21 May 2010 17:51:03 +0000 (10:51 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (59 commits)
  HID: fix up 'EMBEDDED' mess in Kconfig
  HID: roccat: cleanup preprocessor macros
  HID: roccat: refactor special event handling
  HID: roccat: fix special button support
  HID: roccat: Correctly mark init and exit functions
  HID: hidraw: Use Interrupt Endpoint for OUT Transfers if Available
  HID: hid-samsung: remove redundant key mappings
  HID: add omitted hid-zydacron.c file
  HID: hid-samsung: add support for Creative Desktop Wireless 6000
  HID: picolcd: Eliminate use after free
  HID: Zydacron Remote Control driver
  HID: Use kmemdup
  HID: magicmouse: fix input registration
  HID: make Prodikeys driver standalone config option
  HID: Prodikeys PC-MIDI HID Driver
  HID: hidraw: fix indentation
  HID: ntrig: add filtering module parameters
  HID: ntrig: add sysfs access to filter parameters
  HID: ntrig: add sensitivity and responsiveness support
  HID: add multi-input quirk for eGalax Touchcontroller
  ...

14 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
Linus Torvalds [Fri, 21 May 2010 17:50:28 +0000 (10:50 -0700)]
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs-2.6: (31 commits)
  dquot: Detect partial write error to quota file in write_blk() and add printk_ratelimit for quota error messages
  ocfs2: Fix lock inversion in quotas during umount
  ocfs2: Use __dquot_transfer to avoid lock inversion
  ocfs2: Fix NULL pointer deref when writing local dquot
  ocfs2: Fix estimate of credits needed for quota allocation
  ocfs2: Fix quota locking
  ocfs2: Avoid unnecessary block mapping when refreshing quota info
  ocfs2: Do not map blocks from local quota file on each write
  quota: Refactor dquot_transfer code so that OCFS2 can pass in its references
  quota: unify quota init condition in setattr
  quota: remove sb_has_quota_active in get/set_info
  quota: unify ->set_dqblk
  quota: unify ->get_dqblk
  ext3: make barrier options consistent with ext4
  quota: Make quota stat accounting lockless.
  suppress warning: "quotatypes" defined but not used
  ext3: Fix waiting on transaction during fsync
  jbd: Provide function to check whether transaction will issue data barrier
  ufs: add ufs speciffic ->setattr call
  BKL: Remove BKL from ext2 filesystem
  ...

14 years agoMerge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind...
Linus Torvalds [Fri, 21 May 2010 17:50:00 +0000 (10:50 -0700)]
Merge branch 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6

* 'omap-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6: (113 commits)
  omap4: Add support for i2c init
  omap: Fix i2c platform init code for omap4
  OMAP2 clock: fix recursive spinlock attempt when CONFIG_CPU_FREQ=y
  OMAP powerdomain, hwmod, omap_device: add some credits
  OMAP4 powerdomain: Support LOWPOWERSTATECHANGE for powerdomains
  OMAP3 clock: add support for setting the divider for sys_clkout2 using clk_set_rate
  OMAP4 powerdomain: Fix pwrsts flags for ALWAYS ON domains
  OMAP: timers: Fix clock source names for OMAP4
  OMAP4 clock: Support clk_set_parent
  OMAP4: PRCM: Add offset defines for all CM registers
  OMAP4: PRCM: Add offset defines for all PRM registers
  OMAP4: PRCM: Remove duplicate definition of base addresses
  OMAP4: PRM: Remove MPU internal code name and apply PRCM naming convention
  OMAP4: CM: Remove non-functional registers in ES1.0
  OMAP: hwmod: Replace WARN by pr_warning for clockdomain check
  OMAP: hwmod: Rename hwmod name for the MPU
  OMAP: hwmod: Do not exit the iteration if one clock init failed
  OMAP: hwmod: Replace WARN by pr_warning if clock lookup failed
  OMAP: hwmod: Remove IS_ERR check with omap_clk_get_by_name return value
  OMAP: hwmod: Fix wrong pointer iteration in oh->slaves
  ...

14 years agoMerge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
Linus Torvalds [Fri, 21 May 2010 17:49:43 +0000 (10:49 -0700)]
Merge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c-nforce2: Remove redundant error messages on ACPI conflict
  i2c: Use <linux/io.h> instead of <asm/io.h>
  i2c-algo-pca: Fix coding style issues
  i2c-dev: Fix all coding style issues
  i2c-core: Fix some coding style issues
  i2c-gpio: Move initialization code to subsys_initcall()
  i2c-parport: Make template structure const
  i2c-dev: Remove unnecessary casts
  at24: Fall back to byte or word reads if needed
  i2c-stub: Expose the default functionality flags
  i2c/scx200_acb: Make PCI device ids constant
  i2c-i801: Fix all checkpatch warnings
  i2c-i801: All newer devices have all the optional features
  i2c-i801: Let the user disable selected driver features

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6
Linus Torvalds [Fri, 21 May 2010 17:48:48 +0000 (10:48 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty-2.6: (25 commits)
  serial: Tidy REMOTE_DEBUG
  serial: isicomm: handle running out of slots
  serial: bfin_sport_uart: Use resource size to fix off-by-one error
  tty: fix obsolete comment on tty_insert_flip_string_fixed_flag
  serial: Add driver for the Altera UART
  serial: Add driver for the Altera JTAG UART
  serial: timbuart: make sure last byte is sent when port is closed
  serial: two branches the same in timbuart_set_mctrl()
  serial: uartlite: move from byte accesses to word accesses
  tty: n_gsm: depends on NET
  tty: n_gsm line discipline
  serial: TTY: new ldiscs for staging
  serial: bfin_sport_uart: drop redundant cpu depends
  serial: bfin_sport_uart: drop the experimental markings
  serial: bfin_sport_uart: pull in bfin_sport.h for SPORT defines
  serial: bfin_sport_uart: only enable SPORT TX if data is to be sent
  serial: bfin_sport_uart: drop useless status masks
  serial: bfin_sport_uart: zero sport_uart_port if allocated dynamically
  serial: bfin_sport_uart: protect changes to uart_port
  serial: bfin_sport_uart: add support for CTS/RTS via GPIOs
  ...

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
Linus Torvalds [Fri, 21 May 2010 17:48:32 +0000 (10:48 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (38 commits)
  net: Expose all network devices in a namespaces in sysfs
  hotplug: netns aware uevent_helper
  kobj: Send hotplug events in the proper namespace.
  netlink: Implment netlink_broadcast_filtered
  net/sysfs: Fix the bitrot in network device kobject namespace support
  netns: Teach network device kobjects which namespace they are in.
  kobject: Send hotplug events in all network namespaces
  driver-core: fix Typo in drivers/base/core.c for CONFIG_MODULE
  pci: check caps from sysfs file open to read device dependent config space
  sysfs: add struct file* to bin_attr callbacks
  sysfs: Remove usage of S_BIAS to avoid merge conflict with the vfs tree
  sysfs: Don't use enums in inline function declaration.
  sysfs-namespaces: add a high-level Documentation file
  sysfs: Comment sysfs directory tagging logic
  driver core: Implement ns directory support for device classes.
  sysfs: Implement sysfs_delete_link
  sysfs: Add support for tagged directories with untagged members.
  sysfs: Implement sysfs tagged directory support.
  kobj: Add basic infrastructure for dealing with namespaces.
  sysfs: Remove double free sysfs_get_sb
  ...

14 years agointerrupt.h: fix fatal kernel-doc error
Randy Dunlap [Fri, 21 May 2010 16:03:01 +0000 (09:03 -0700)]
interrupt.h: fix fatal kernel-doc error

Fix kernel-doc fatal error:
/** beginning a non-kernel-doc comment block:
(That alone does not kill kernel-doc, but the 'enum' was
totally confusing to it.)

Error(/lnx/src/TMP/linux-2.6.34-git6//include/linux/interrupt.h:88): cannot understand prototype: 'enum '
make[2]: *** [Documentation/DocBook/genericirq.xml] Error 1

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agodquot: Detect partial write error to quota file in write_blk() and add printk_ratelim...
Jiaying Zhang [Mon, 17 May 2010 16:36:03 +0000 (18:36 +0200)]
dquot: Detect partial write error to quota file in write_blk() and add printk_ratelimit for quota error messages

This patch changes quota_tree.c:write_blk() to detect error caused by partial
write to quota file and add a macro to limit control printed quota error
messages so we won't fill up dmesg with a corrupted quota file.

Signed-off-by: Jiaying Zhang <jiayingz@google.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoocfs2: Fix lock inversion in quotas during umount
Jan Kara [Thu, 13 May 2010 20:14:53 +0000 (22:14 +0200)]
ocfs2: Fix lock inversion in quotas during umount

We cannot cancel delayed work from ocfs2_local_free_info because that is called
with dqonoff_mutex held and the work it cancels requires dqonoff_mutex to
finish. Cancel the work before acquiring dqonoff_mutex.

Acked-by: Joel Becker <Joel.Becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoocfs2: Use __dquot_transfer to avoid lock inversion
Jan Kara [Thu, 13 May 2010 18:18:45 +0000 (20:18 +0200)]
ocfs2: Use __dquot_transfer to avoid lock inversion

dquot_transfer() acquires own references to dquots via dqget(). Thus it waits
for dq_lock which creates a lock inversion because dq_lock ranks above
transaction start but transaction is already started in ocfs2_setattr(). Fix
the problem by passing own references directly to __dquot_transfer.

Acked-by: Joel Becker <Joel.Becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoocfs2: Fix NULL pointer deref when writing local dquot
Jan Kara [Thu, 13 May 2010 16:05:15 +0000 (18:05 +0200)]
ocfs2: Fix NULL pointer deref when writing local dquot

commit_dqblk() can write quota info to global file. That is actually a bad
thing to do because if we are just modifying local quota file, we are not
prepared (do not hold proper locks, do not have transaction credits) to do
a modification of the global quota file. So do not use commit_dqblk() and
instead call our writing function directly.

Acked-by: Joel Becker <Joel.Becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoocfs2: Fix estimate of credits needed for quota allocation
Jan Kara [Tue, 11 May 2010 15:04:14 +0000 (17:04 +0200)]
ocfs2: Fix estimate of credits needed for quota allocation

We were missing reservation of a journal credit for modification of quota
file inode when creating new dquot structure in the global quota file.

Acked-by: Joel Becker <Joel.Becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoocfs2: Fix quota locking
Jan Kara [Wed, 31 Mar 2010 14:25:37 +0000 (16:25 +0200)]
ocfs2: Fix quota locking

OCFS2 had three issues with quota locking:
a) When reading dquot from global quota file, we started a transaction while
   holding dqio_mutex which is prone to deadlocks because other paths do it
   the other way around
b) During ocfs2_sync_dquot we were not protected against concurrent writers
   on the same node. Because we first copy data to local buffer, a race
   could happen resulting in old data being written to global quota file and
   thus causing quota inconsistency after a crash.
c) ip_alloc_sem of quota files was acquired while a transaction is started
   in ocfs2_quota_write which can deadlock because we first get ip_alloc_sem
   and then start a transaction when extending quota files.

We fix the problem a) by pulling all necessary code to ocfs2_acquire_dquot
and ocfs2_release_dquot. Thus we no longer depend on generic dquot_acquire
to do the locking and can force proper lock ordering.

Problems b) and c) are fixed by locking i_mutex and ip_alloc_sem of
global quota file in ocfs2_lock_global_qf and removing ip_alloc_sem from
ocfs2_quota_read and ocfs2_quota_write.

Acked-by: Joel Becker <Joel.Becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoocfs2: Avoid unnecessary block mapping when refreshing quota info
Jan Kara [Wed, 28 Apr 2010 17:04:29 +0000 (19:04 +0200)]
ocfs2: Avoid unnecessary block mapping when refreshing quota info

The position of global quota file info does not change. So we do not have
to do logical -> physical block translation every time we reread it from
disk. Thus we can also avoid taking ip_alloc_sem.

Acked-by: Joel Becker <Joel.Becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoocfs2: Do not map blocks from local quota file on each write
Jan Kara [Tue, 27 Apr 2010 22:22:30 +0000 (00:22 +0200)]
ocfs2: Do not map blocks from local quota file on each write

There is no need to map offset of local dquot structure to on disk block
in each quota write. It is enough to map it just once and store the physical
block number in quota structure in memory. Moreover this simplifies locking
as we do not have to take ip_alloc_sem from quota write path.

Acked-by: Joel Becker <Joel.Becker@oracle.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoquota: Refactor dquot_transfer code so that OCFS2 can pass in its references
Jan Kara [Thu, 13 May 2010 17:58:50 +0000 (19:58 +0200)]
quota: Refactor dquot_transfer code so that OCFS2 can pass in its references

Currently, __dquot_transfer() acquires its own references of dquot structures
that will be put into inode. But for OCFS2, this creates a lock inversion
between dq_lock (waited on in dqget) and transaction start (started in
ocfs2_setattr). Currently, deadlock is impossible because dq_lock is acquired
only during dquot_acquire and dquot_release and we already hold a reference to
dquot structures in ocfs2_setattr so neither of these functions can be called
while we call dquot_transfer. But this is rather subtle and it is hard to teach
lockdep about it. So provide __dquot_transfer function that can be passed dquot
references directly. OCFS2 can then pass acquired dquot references directly to
__dquot_transfer with proper locking.

Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoquota: unify quota init condition in setattr
Dmitry Monakhov [Thu, 8 Apr 2010 18:04:20 +0000 (22:04 +0400)]
quota: unify quota init condition in setattr

Quota must being initialized if size or uid/git changes requested.
But initialization performed in two different places:
in case of i_size file system is responsible for dquot init
, but in case of uid/gid init will be called internally in
dquot_transfer().
This ambiguity makes code harder to understand.
Let's move this logic to one common helper function.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoquota: remove sb_has_quota_active in get/set_info
Christoph Hellwig [Fri, 7 May 2010 16:35:40 +0000 (12:35 -0400)]
quota: remove sb_has_quota_active in get/set_info

The methods already do these checks, so remove them in the quotactl
implementation to allow non-VFS quota implementations to also support
these calls.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoquota: unify ->set_dqblk
Christoph Hellwig [Thu, 6 May 2010 21:05:17 +0000 (17:05 -0400)]
quota: unify ->set_dqblk

Pass the larger struct fs_disk_quota to the ->set_dqblk operation so
that the Q_SETQUOTA and Q_XSETQUOTA operations can be implemented
with a single filesystem operation and we can retire the ->set_xquota
operation.  The additional information (RT-subvolume accounting and
warn counts) are left zero for the VFS quota implementation.

Add new fieldmask values for setting the numer of blocks and inodes
values which is required for the VFS quota, but wasn't for XFS.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoquota: unify ->get_dqblk
Christoph Hellwig [Thu, 6 May 2010 21:04:58 +0000 (17:04 -0400)]
quota: unify ->get_dqblk

Pass the larger struct fs_disk_quota to the ->get_dqblk operation so
that the Q_GETQUOTA and Q_XGETQUOTA operations can be implemented
with a single filesystem operation and we can retire the ->get_xquota
operation.  The additional information (RT-subvolume accounting and
warn counts) are left zero for the VFS quota implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoext3: make barrier options consistent with ext4
Eric Sandeen [Fri, 30 Apr 2010 16:09:34 +0000 (11:09 -0500)]
ext3: make barrier options consistent with ext4

ext4 was updated to accept barrier/nobarrier mount options
in addition to the older barrier=0/1.  The barrier story
is complex enough, we should help people by making the options
the same at least, even if the defaults are different.

This patch allows the barrier/nobarrier mount options for ext3,
while keeping nobarrier the default.

It also unconditionally displays barrier status in show_options,
and prints a message at mount time if barriers are not enabled,
just as ext4 does.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoquota: Make quota stat accounting lockless.
Dmitry Monakhov [Mon, 26 Apr 2010 16:03:33 +0000 (20:03 +0400)]
quota: Make quota stat accounting lockless.

Quota stats is mostly writable data structure. Let's alloc percpu
bucket for each value.

NOTE: dqstats_read() function is racy against dqstats_{inc,dec}
and may return inconsistent value. But this is ok since absolute
accuracy is not required.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agosuppress warning: "quotatypes" defined but not used
Sergey Senozhatsky [Mon, 26 Apr 2010 10:09:26 +0000 (12:09 +0200)]
suppress warning: "quotatypes" defined but not used

Suppress compilation warning: "quotatypes" defined but not used.
quotatypes is used only when CONFIG_QUOTA_DEBUG or CONFIG_PRINT_QUOTA_WARNING
is/are defined.

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoext3: Fix waiting on transaction during fsync
Jan Kara [Thu, 15 Apr 2010 20:24:26 +0000 (22:24 +0200)]
ext3: Fix waiting on transaction during fsync

log_start_commit() returns 1 only when it started a transaction
commit. Thus in case transaction commit is already running, we
fail to wait for the commit to finish. Fix the issue by always
waiting for the commit regardless of the log_start_commit return
value.

Signed-off-by: Jan Kara <jack@suse.cz>
14 years agojbd: Provide function to check whether transaction will issue data barrier
Jan Kara [Thu, 15 Apr 2010 20:16:24 +0000 (22:16 +0200)]
jbd: Provide function to check whether transaction will issue data barrier

Provide a function which returns whether a transaction with given tid
will send a barrier to the filesystem device. The function will be used
by ext3 to detect whether fsync needs to send a separate barrier or not.

Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoufs: add ufs speciffic ->setattr call
Dmitry Monakhov [Wed, 14 Apr 2010 22:56:58 +0000 (00:56 +0200)]
ufs: add ufs speciffic ->setattr call

generic setattr not longer responsible for quota transfer.
use ufs_setattr for all ufs's inodes.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
14 years agoBKL: Remove BKL from ext2 filesystem
Jan Blunck [Wed, 14 Apr 2010 12:38:39 +0000 (14:38 +0200)]
BKL: Remove BKL from ext2 filesystem

The BKL is still used in ext2_put_super(), ext2_fill_super(), ext2_sync_fs()
ext2_remount() and ext2_write_inode(). From these calls ext2_put_super(),
ext2_fill_super() and ext2_remount() are protected against each other by
the struct super_block s_umount rw semaphore. The call in ext2_write_inode()
could only protect the modification of the ext2_sb_info through
ext2_update_dynamic_rev() against concurrent ext2_sync_fs() or ext2_remount().
ext2_fill_super() and ext2_put_super() can be left out because you need a
valid filesystem reference in all three cases, which you do not have when
you are one of these functions.

If the BKL is only protecting the modification of the ext2_sb_info it can
safely be removed since this is protected by the struct ext2_sb_info s_lock.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Cc: Jan Kara <jack@suse.cz>
Signed-off-by: Jan Kara <jack@suse.cz>