firefly-linux-kernel-4.4.55.git
14 years agologfs: get rid of magical inodes
Al Viro [Mon, 7 Jun 2010 16:22:31 +0000 (12:22 -0400)]
logfs: get rid of magical inodes

ordering problems at ->kill_sb() time are solved by doing iput()
of these suckers in ->put_super()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoconvert nilfs2 to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 15:55:00 +0000 (11:55 -0400)]
convert nilfs2 to ->evict_inode()

[folded build fix from sfr]

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoconvert exofs to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 15:42:26 +0000 (11:42 -0400)]
convert exofs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoconvert reiserfs to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 15:37:37 +0000 (11:37 -0400)]
convert reiserfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoconvert btrfs to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 15:35:40 +0000 (11:35 -0400)]
convert btrfs to ->evict_inode()

NB: do we want btrfs_wait_ordered_range() on eviction of
inodes with positive i_nlink on subvolume with zero root_refs?
If not, btrfs_evict_inode() can be simplified by unconditionally
bailing out in case of i_nlink > 0 in the very beginning...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch gfs2 to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 15:05:19 +0000 (11:05 -0400)]
switch gfs2 to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoconvert ocfs2 to ->evict_inode()
Al Viro [Wed, 9 Jun 2010 01:28:10 +0000 (21:28 -0400)]
convert ocfs2 to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch ncpfs to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 04:45:56 +0000 (00:45 -0400)]
switch ncpfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch udf to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 04:43:39 +0000 (00:43 -0400)]
switch udf to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch ubifs to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 04:34:05 +0000 (00:34 -0400)]
switch ubifs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch jfs to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 04:28:54 +0000 (00:28 -0400)]
switch jfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch hpfs to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 04:18:40 +0000 (00:18 -0400)]
switch hpfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch hppfs to ->evict_inode()
Al Viro [Mon, 7 Jun 2010 04:12:50 +0000 (00:12 -0400)]
switch hppfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agotry to get rid of races in hostfs open()
Al Viro [Mon, 7 Jun 2010 03:49:18 +0000 (23:49 -0400)]
try to get rid of races in hostfs open()

In case of mode mismatch, do *not* blindly close the descriptor
another openers might be using right now.  Open the underlying
file with currently sufficient mode, then
* if current mode has grown so that it's sufficient for
us now, just close our new fd
* if current mode has grown and our fd is *not* enough
to cover it, close and repeat.
* otherwise, install our fd if the file hadn't been
opened at all or dup2() our fd over the current one (and close
our fd).
Critical section is protected by mutex; yes, system-wide.  All
we do under it is a bunch of comparison and maybe an overwriting
dup2() on host.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoleak in hostfs_unlink()
Al Viro [Mon, 7 Jun 2010 03:19:04 +0000 (23:19 -0400)]
leak in hostfs_unlink()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agohostfs: fix races in dentry_name() and inode_name()
Al Viro [Mon, 7 Jun 2010 03:16:34 +0000 (23:16 -0400)]
hostfs: fix races in dentry_name() and inode_name()

calculating size, then doing allocation, then filling the
path is a Bad Idea(tm), since the ancestors can be renamed,
leading to buffer overrun.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agonew helper: __dentry_path()
Al Viro [Mon, 7 Jun 2010 02:31:14 +0000 (22:31 -0400)]
new helper: __dentry_path()

builds path relative to fs root, called under dcache_lock,
doesn't append any nonsense to unlinked ones.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agohostfs: sanitize symlinks
Al Viro [Mon, 7 Jun 2010 01:51:16 +0000 (21:51 -0400)]
hostfs: sanitize symlinks

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agohostfs: get rid of inode_dentry_name()
Al Viro [Mon, 7 Jun 2010 00:42:10 +0000 (20:42 -0400)]
hostfs: get rid of inode_dentry_name()

it's equivalent to dentry_name() anyway

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agohostfs: get rid of file_type(), fold init_inode()
Al Viro [Mon, 7 Jun 2010 00:33:12 +0000 (20:33 -0400)]
hostfs: get rid of file_type(), fold init_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch stat_file() to passing a single struct rather than fsckloads of pointers
Al Viro [Mon, 7 Jun 2010 00:08:56 +0000 (20:08 -0400)]
switch stat_file() to passing a single struct rather than fsckloads of pointers

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agohostfs: pass pathname to init_inode()
Al Viro [Sun, 6 Jun 2010 23:38:18 +0000 (19:38 -0400)]
hostfs: pass pathname to init_inode()

We will calculate it in all callers anyway, so there's no
need to duplicate that inside.  Moreover, that way we lose
all failure exits in init_inode(), so it doesn't need to
return anything.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of hostfs_read_inode()
Al Viro [Sun, 6 Jun 2010 22:43:19 +0000 (18:43 -0400)]
get rid of hostfs_read_inode()

There are only two call sites; in one (hostfs_iget()) it's actually
a no-op and in another (fill_super()) it's easier to expand the
damn thing and use what we know about its arguments to simplify
it.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agohostfs: don't keep a field in each inode when we are using it only in root
Al Viro [Sun, 6 Jun 2010 21:53:01 +0000 (17:53 -0400)]
hostfs: don't keep a field in each inode when we are using it only in root

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agostop icache pollution in hostfs, switch to ->evict_inode()
Al Viro [Sun, 6 Jun 2010 19:16:17 +0000 (15:16 -0400)]
stop icache pollution in hostfs, switch to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch affs to ->evict_inode()
Al Viro [Sun, 6 Jun 2010 14:16:41 +0000 (10:16 -0400)]
switch affs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch omfs to ->evict_inode()
Al Viro [Sun, 6 Jun 2010 14:12:01 +0000 (10:12 -0400)]
switch omfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch bfs to ->evict_inode(), clean up
Al Viro [Sun, 6 Jun 2010 13:50:39 +0000 (09:50 -0400)]
switch bfs to ->evict_inode(), clean up

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoconvert ext3 to ->evict_inode()
Al Viro [Sun, 6 Jun 2010 11:08:19 +0000 (07:08 -0400)]
convert ext3 to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agospufs conversion to ->evict_inode()
Al Viro [Sun, 6 Jun 2010 01:20:32 +0000 (21:20 -0400)]
spufs conversion to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch ufs to ->evict_inode()
Al Viro [Sat, 5 Jun 2010 23:40:56 +0000 (19:40 -0400)]
switch ufs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agocovert fatfs to ->evict_inode()
Al Viro [Sat, 5 Jun 2010 23:28:32 +0000 (19:28 -0400)]
covert fatfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch smbfs to evict_inode()
Al Viro [Sat, 5 Jun 2010 23:22:50 +0000 (19:22 -0400)]
switch smbfs to evict_inode()

NB: treatment of inode hash is completely braindead there

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch sysv to ->evict_inode()
Al Viro [Sat, 5 Jun 2010 23:16:20 +0000 (19:16 -0400)]
switch sysv to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch shmem.c to ->evice_inode()
Al Viro [Sat, 5 Jun 2010 23:10:41 +0000 (19:10 -0400)]
switch shmem.c to ->evice_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch mqueue to ->evict_inode()
Al Viro [Sat, 5 Jun 2010 20:29:45 +0000 (16:29 -0400)]
switch mqueue to ->evict_inode()

... and since the inodes are never hashed, we can use default ->drop_inode()
just fine.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agomerge ext2 delete_inode and clear_inode, switch to ->evict_inode()
Al Viro [Sat, 5 Jun 2010 03:32:28 +0000 (23:32 -0400)]
merge ext2 delete_inode and clear_inode, switch to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoDon't dirty the victim in ext2_xattr_delete_inode()
Al Viro [Wed, 21 Jul 2010 21:22:47 +0000 (01:22 +0400)]
Don't dirty the victim in ext2_xattr_delete_inode()

... it's beyond fs-writeback reach already - writeback won't
be started at that point.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoTake dirtying the inode to callers of ext2_free_blocks()
Al Viro [Wed, 21 Jul 2010 21:19:42 +0000 (01:19 +0400)]
Take dirtying the inode to callers of ext2_free_blocks()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoext2: switch to dquot_free_block_nodirty()
Al Viro [Wed, 21 Jul 2010 21:13:36 +0000 (01:13 +0400)]
ext2: switch to dquot_free_block_nodirty()

brute-force conversion

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch minix to ->evict_inode(), fix write_inode/delete_inode race
Al Viro [Sat, 5 Jun 2010 02:27:38 +0000 (22:27 -0400)]
switch minix to ->evict_inode(), fix write_inode/delete_inode race

We need to wait for completion of possible writeback in progress
before we clear on-disk inode during deletion.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch sysfs to ->evict_inode()
Al Viro [Sat, 5 Jun 2010 02:21:54 +0000 (22:21 -0400)]
switch sysfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch procfs to ->evict_inode()
Al Viro [Sat, 5 Jun 2010 02:17:56 +0000 (22:17 -0400)]
switch procfs to ->evict_inode()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosimplify get_cramfs_inode()
Al Viro [Sat, 5 Jun 2010 01:19:01 +0000 (21:19 -0400)]
simplify get_cramfs_inode()

simply don't hash the inodes that don't have real inumber instead of
skipping them during iget5_locked(); as the result, simple iget_locked()
would do and we can get rid of cramfs ->drop_inode() as well.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch hypfs to ->evict_inode()
Al Viro [Sat, 5 Jun 2010 01:02:59 +0000 (21:02 -0400)]
switch hypfs to ->evict_inode()

... and since we never hash its inodes, default
->drop_inode() will work just fine.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agonew helper: end_writeback()
Al Viro [Sat, 5 Jun 2010 00:55:25 +0000 (20:55 -0400)]
new helper: end_writeback()

Essentially, the minimal variant of ->evict_inode().  It's
a trimmed-down clear_inode(), sans any fs callbacks.  Once
it returns we know that no async writeback will be happening;
every ->evict_inode() instance should do that once and do that
before doing anything ->write_inode() could interfere with
(e.g. freeing the on-disk inode).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoTake ->i_bdev/->i_cdev handling out of clear_inode()
Al Viro [Sat, 5 Jun 2010 00:19:55 +0000 (20:19 -0400)]
Take ->i_bdev/->i_cdev handling out of clear_inode()

All call chains to clear_inode() pass through evict_inode() and
clear_inode() should be called by evict_inode() exactly once.
So we can pull i_bdev/i_cdev detaching up to evict_inode() itself.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agogeneric_detach_inode() can be static now
Al Viro [Fri, 4 Jun 2010 23:56:17 +0000 (19:56 -0400)]
generic_detach_inode() can be static now

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoswitch hugetlbfs to ->evict_inode()
Al Viro [Fri, 4 Jun 2010 23:52:12 +0000 (19:52 -0400)]
switch hugetlbfs to ->evict_inode()

The first spoils - hugetlb can use default ->drop_inode() now.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoNew method - evict_inode()
Al Viro [Fri, 4 Jun 2010 23:40:39 +0000 (19:40 -0400)]
New method - evict_inode()

Hybrid of ->clear_inode() and ->delete_inode(); if present, does
all fs work to be done when in-core inode is about to be gone,
for whatever reason.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agounify fs/inode.c callers of clear_inode()
Al Viro [Fri, 4 Jun 2010 23:33:20 +0000 (19:33 -0400)]
unify fs/inode.c callers of clear_inode()

For now, just a straightforward merge

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosimplify checks for I_CLEAR/I_FREEING
Al Viro [Wed, 2 Jun 2010 21:38:30 +0000 (17:38 -0400)]
simplify checks for I_CLEAR/I_FREEING

add I_CLEAR instead of replacing I_FREEING with it.  I_CLEAR is
equivalent to I_FREEING for almost all code looking at either;
it's there to keep track of having called clear_inode() exactly
once per inode lifetime, at some point after having set I_FREEING.
I_CLEAR and I_FREEING never get set at the same time with the
current code, so we can switch to setting i_flags to I_FREEING | I_CLEAR
instead of I_CLEAR without loss of information.  As the result of
such change, checks become simpler and the amount of code that needs
to know about I_CLEAR shrinks a lot.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of file_fsync()
Al Viro [Sun, 4 Jul 2010 08:24:09 +0000 (12:24 +0400)]
get rid of file_fsync()

Copy and simplify in the only two users remaining.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoxfs: new truncate sequence
Christoph Hellwig [Mon, 14 Jun 2010 09:17:31 +0000 (05:17 -0400)]
xfs: new truncate sequence

Convert XFS to the new truncate sequence.  We still can have errors after
updating the file size in xfs_setattr, but these are real I/O errors and lead
to a transaction abort and filesystem shutdown, so they are not an issue.

Errors from ->write_begin and write_end can now be handled correctly because
we can actually get rid of the delalloc extents while previous the buffer
state was stipped in block_invalidatepage.

There is still no error handling for ->direct_IO, because doing so will need
some major restructuring given that we only have the iolock shared and do not
hold i_mutex at all.  Fortunately leaving the normally allocated blocks behind
there is not a major issue and this will get cleaned up by xfs_free_eofblock
later.

Note: the patch is against Al's vfs.git tree as that contains the nessecary
preparations.  I'd prefer to get it applied there so that we can get some
testing in linux-next.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoexofs: New truncate sequence
Boaz Harrosh [Wed, 9 Jun 2010 15:23:18 +0000 (18:23 +0300)]
exofs: New truncate sequence

These changes are crafted based on the similar
conversion done to ext2 by Nick Piggin.

* Remove the deprecated ->truncate vector. Let exofs_setattr
  take care of on-disk size updates.
* Call truncate_pagecache on the unused pages if
  write_begin/end fails.
* Cleanup exofs_delete_inode that did stupid inode
  writes and updates on an inode that will be
  removed.
* And finally get rid of exofs_get_block. We never
  had any blocks it was all for calling nobh_truncate_page.
  nobh_truncate_page is not actually needed in exofs since
  the last page is complete and gone, just like all the other
  pages. There is no partial blocks in exofs.

I've tested with this patch, and there are no apparent
failures, so far.

CC: Nick Piggin <npiggin@suse.de>
CC: Christoph Hellwig <hch@lst.de>
Signed-off-by: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agojffs2: don't open-code iget_failed()
Al Viro [Tue, 8 Jun 2010 17:24:56 +0000 (13:24 -0400)]
jffs2: don't open-code iget_failed()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoupdate documentation for the new truncate sequence
Christoph Hellwig [Mon, 7 Jun 2010 07:29:20 +0000 (09:29 +0200)]
update documentation for the new truncate sequence

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agocheck ATTR_SIZE contraints in inode_change_ok
Christoph Hellwig [Fri, 4 Jun 2010 09:30:04 +0000 (11:30 +0200)]
check ATTR_SIZE contraints in inode_change_ok

Make sure we check the truncate constraints early on in ->setattr by adding
those checks to inode_change_ok.  Also clean up and document inode_change_ok
to make this obvious.

As a fallout we don't have to call inode_newsize_ok from simple_setsize and
simplify it down to a truncate_setsize which doesn't return an error.  This
simplifies a lot of setattr implementations and means we use truncate_setsize
almost everywhere.  Get rid of fat_setsize now that it's trivial and mark
ext2_setsize static to make the calling convention obvious.

Keep the inode_newsize_ok in vmtruncate for now as all callers need an
audit for its removal anyway.

Note: setattr code in ecryptfs doesn't call inode_change_ok at all and
needs a deeper audit, but that is left for later.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoalways call inode_change_ok early in ->setattr
Christoph Hellwig [Fri, 4 Jun 2010 09:30:03 +0000 (11:30 +0200)]
always call inode_change_ok early in ->setattr

Make sure we call inode_change_ok before doing any changes in ->setattr,
and make sure to call it even if our fs wants to ignore normal UNIX
permissions, but use the ATTR_FORCE to skip those.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoremove inode_setattr
Christoph Hellwig [Fri, 4 Jun 2010 09:30:02 +0000 (11:30 +0200)]
remove inode_setattr

Replace inode_setattr with opencoded variants of it in all callers.  This
moves the remaining call to vmtruncate into the filesystem methods where it
can be replaced with the proper truncate sequence.

In a few cases it was obvious that we would never end up calling vmtruncate
so it was left out in the opencoded variant:

 spufs: explicitly checks for ATTR_SIZE earlier
 btrfs,hugetlbfs,logfs,dlmfs: explicitly clears ATTR_SIZE earlier
 ufs: contains an opencoded simple_seattr + truncate that sets the filesize just above

In addition to that ncpfs called inode_setattr with handcrafted iattrs,
which allowed to trim down the opencoded variant.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agodefault to simple_setattr
Christoph Hellwig [Fri, 4 Jun 2010 09:30:01 +0000 (11:30 +0200)]
default to simple_setattr

With the new truncate sequence every filesystem that wants to support file
size changes on disk needs to implement its own ->setattr.  So instead
of calling inode_setattr which supports size changes call into a simple
method that doesn't support this.  simple_setattr is almost what we
want except that it does not mark the inode dirty after changes.  Given
that marking the inode dirty is a no-op for the simple in-memory filesystems
that use simple_setattr currently just add the mark_inode_dirty call.

Also add a WARN_ON for the presence of a truncate method to simple_setattr
to catch new instances of it during the transition period.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agorename generic_setattr
Christoph Hellwig [Fri, 4 Jun 2010 09:30:00 +0000 (11:30 +0200)]
rename generic_setattr

Despite its name it's now a generic implementation of ->setattr, but
rather a helper to copy attributes from a struct iattr to the inode.
Rename it to setattr_copy to reflect this fact.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoadd missing setattr methods
Christoph Hellwig [Fri, 4 Jun 2010 09:29:59 +0000 (11:29 +0200)]
add missing setattr methods

For the new truncate sequence every filesystem that wants to truncate on-disk
state needs a seattr method.  Convert the remaining filesystems that implement
the truncate inode operation to have its own setattr method.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of block_write_begin_newtrunc
Christoph Hellwig [Fri, 4 Jun 2010 09:29:58 +0000 (11:29 +0200)]
get rid of block_write_begin_newtrunc

Move the call to vmtruncate to get rid of accessive blocks to the callers
in preparation of the new truncate sequence and rename the non-truncating
version to block_write_begin.

While we're at it also remove several unused arguments to block_write_begin.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agointroduce __block_write_begin
Christoph Hellwig [Fri, 4 Jun 2010 09:29:57 +0000 (11:29 +0200)]
introduce __block_write_begin

Split up the block_write_begin implementation - __block_write_begin is a new
trivial wrapper for block_prepare_write that always takes an already
allocated page and can be either called from block_write_begin or filesystem
code that already has a page allocated.  Remove the handling of already
allocated pages from block_write_begin after switching all callers that
do it to __block_write_begin.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoclean up write_begin usage for directories in pagecache
Christoph Hellwig [Fri, 4 Jun 2010 09:29:56 +0000 (11:29 +0200)]
clean up write_begin usage for directories in pagecache

For filesystem that implement directories in pagecache we call
block_write_begin with an already allocated page for this code, while the
normal regular file write path uses the default block_write_begin behaviour.

Get rid of the __foofs_write_begin helper and opencode the normal write_begin
call in foofs_write_begin, while adding a new foofs_prepare_chunk helper for
the directory code.  The added benefit is that foofs_prepare_chunk has
a much saner calling convention.

Note that the interruptible flag passed into block_write_begin is always
ignored if we already pass in a page (see next patch for details), and
we never were doing truncations of exessive blocks for this case either so we
can switch directly to block_write_begin_newtrunc.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of cont_write_begin_newtrunc
Christoph Hellwig [Fri, 4 Jun 2010 09:29:55 +0000 (11:29 +0200)]
get rid of cont_write_begin_newtrunc

Move the call to vmtruncate to get rid of accessive blocks to the callers
in preparation of the new truncate sequence and rename the non-truncating
version to cont_write_begin.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoget rid of nobh_write_begin_newtrunc
Christoph Hellwig [Fri, 4 Jun 2010 09:29:54 +0000 (11:29 +0200)]
get rid of nobh_write_begin_newtrunc

Move the call to vmtruncate to get rid of accessive blocks to the only
remaining caller and rename the non-truncating version to nobh_write_begin.

Get rid of the superflous file argument to it while we're at it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agosort out blockdev_direct_IO variants
Christoph Hellwig [Fri, 4 Jun 2010 09:29:53 +0000 (11:29 +0200)]
sort out blockdev_direct_IO variants

Move the call to vmtruncate to get rid of accessive blocks to the callers
in prepearation of the new truncate calling sequence.  This was only done
for DIO_LOCKING filesystems, so the __blockdev_direct_IO_newtrunc variant
was not needed anyway.  Get rid of blockdev_direct_IO_no_locking and
its _newtrunc variant while at it as just opencoding the two additional
paramters is shorted than the name suffix.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agofix leak in __logfs_create()
Al Viro [Sun, 4 Jul 2010 08:23:11 +0000 (12:23 +0400)]
fix leak in __logfs_create()

if kmalloc fails, we still need to drop the inode, as we do
on other failure exits.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoFix reiserfs_file_release()
Al Viro [Sun, 4 Jul 2010 08:18:57 +0000 (12:18 +0400)]
Fix reiserfs_file_release()

a) count file openers correctly; i_count use was completely wrong
b) use new mutex for exclusion between final close/open/truncate,
to protect tailpacking logics.  i_mutex use was wrong and resulted
in deadlocks.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agomissing include in hppfs
Al Viro [Mon, 7 Jun 2010 03:56:02 +0000 (23:56 -0400)]
missing include in hppfs

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoDeal with missing exports for hostfs
Al Viro [Tue, 21 Apr 2009 05:27:08 +0000 (01:27 -0400)]
Deal with missing exports for hostfs

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
14 years agoMerge branch 'for-linus' of git://oss.sgi.com/xfs/xfs
Linus Torvalds [Tue, 3 Aug 2010 21:33:38 +0000 (14:33 -0700)]
Merge branch 'for-linus' of git://oss.sgi.com/xfs/xfs

* 'for-linus' of git://oss.sgi.com/xfs/xfs: (49 commits)
  xfs simplify and speed up direct I/O completions
  xfs: move aio completion after unwritten extent conversion
  direct-io: move aio_complete into ->end_io
  xfs: fix big endian build
  xfs: clean up xfs_bmap_get_bp
  xfs: simplify xfs_truncate_file
  xfs: kill the b_strat callback in xfs_buf
  xfs: remove obsolete osyncisosync mount option
  xfs: clean up filestreams helpers
  xfs: fix gcc 4.6 set but not read and unused statement warnings
  xfs: Fix build when CONFIG_XFS_POSIX_ACL=n
  xfs: fix unsigned underflow in xfs_free_eofblocks
  xfs: use GFP_NOFS for page cache allocation
  xfs: fix memory reclaim recursion deadlock on locked inode buffer
  xfs: fix xfs_trans_add_item() lockdep warnings
  xfs: simplify and remove xfs_ireclaim
  xfs: don't block on buffer read errors
  xfs: move inode shrinker unregister even earlier
  xfs: remove a dmapi leftover
  xfs: writepage always has buffers
  ...

14 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
Linus Torvalds [Tue, 3 Aug 2010 21:33:09 +0000 (14:33 -0700)]
Merge git://git./linux/kernel/git/sfrench/cifs-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: (29 commits)
  cifs: fsc should not default to "on"
  [CIFS] remove redundant path walking in dfs_do_refmount
  cifs: ignore the "mand", "nomand" and "_netdev" mount options
  cifs: map NT_STATUS_ERROR_WRITE_PROTECTED to -EROFS
  cifs: don't allow cifs_iget to match inodes of the wrong type
  [CIFS] relinquish fscache cookie before freeing CIFSTconInfo
  cifs: add separate cred_uid field to sesInfo
  fs: cifs: check kmalloc() result
  [CIFS] Missing ifdef
  [CIFS] Missing line from previous commit
  [CIFS] Fix build break when CONFIG_CIFS_FSCACHE disabled
  cifs: add mount option to enable local caching
  cifs: read pages from FS-Cache
  cifs: store pages into local cache
  cifs: FS-Cache page management
  cifs: define inode-level cache object and register them
  cifs: define superblock-level cache index objects and register them
  cifs: remove unused cifsUidInfo struct
  cifs: clean up cifs_find_smb_ses (try #2)
  cifs: match secType when searching for existing tcp session
  ...

14 years agoMerge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
Linus Torvalds [Tue, 3 Aug 2010 21:31:24 +0000 (14:31 -0700)]
Merge branch 'devel' of /home/rmk/linux-2.6-arm

* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (291 commits)
  ARM: AMBA: Add pclk support to AMBA bus infrastructure
  ARM: 6278/2: fix regression in RealView after the introduction of pclk
  ARM: 6277/1: mach-shmobile: Allow users to select HZ, default to 128
  ARM: 6276/1: mach-shmobile: remove duplicate NR_IRQS_LEGACY
  ARM: 6246/1: mmci: support larger MMCIDATALENGTH register
  ARM: 6245/1: mmci: enable hardware flow control on Ux500 variants
  ARM: 6244/1: mmci: add variant data and default MCICLOCK support
  ARM: 6243/1: mmci: pass power_mode to the translate_vdd callback
  ARM: 6274/1: add global control registers definition header file for nuc900
  mx2_camera: fix type of dma buffer virtual address pointer
  mx2_camera: Add soc_camera support for i.MX25/i.MX27
  arm/imx/gpio: add spinlock protection
  ARM: Add support for the LPC32XX arch
  ARM: LPC32XX: Arch config menu supoport and makefiles
  ARM: LPC32XX: Phytec 3250 platform support
  ARM: LPC32XX: Misc support functions
  ARM: LPC32XX: Serial support code
  ARM: LPC32XX: System suspend support
  ARM: LPC32XX: GPIO, timer, and IRQ drivers
  ARM: LPC32XX: Clock driver
  ...

14 years agoPARISC: led.c - fix potential stack overflow in led_proc_write()
Helge Deller [Mon, 2 Aug 2010 20:46:41 +0000 (22:46 +0200)]
PARISC: led.c - fix potential stack overflow in led_proc_write()

avoid potential stack overflow by correctly checking count parameter

Reported-by: Ilja <ilja@netric.org>
Signed-off-by: Helge Deller <deller@gmx.de>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
14 years agoMerge branch 'v2.6.35'
Alex Elder [Mon, 2 Aug 2010 15:24:57 +0000 (10:24 -0500)]
Merge branch 'v2.6.35'

14 years agocifs: fsc should not default to "on"
Jeff Layton [Mon, 26 Jul 2010 18:25:08 +0000 (14:25 -0400)]
cifs: fsc should not default to "on"

I'm not sure why this was merged with this flag hardcoded on, but it
seems quite dangerous. Turn it off.

Also, mount.cifs hands unrecognized options off to the kernel so there
should be no need for changes there in order to support this.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years ago[CIFS] remove redundant path walking in dfs_do_refmount
Steve French [Mon, 26 Jul 2010 18:20:16 +0000 (18:20 +0000)]
[CIFS] remove redundant path walking in dfs_do_refmount

Reviewed-by: Dave Howells <dhowells@redhat.com>
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: ignore the "mand", "nomand" and "_netdev" mount options
Jeff Layton [Mon, 26 Jul 2010 14:29:58 +0000 (10:29 -0400)]
cifs: ignore the "mand", "nomand" and "_netdev" mount options

These are all handled by the userspace mount programs, but older versions
of mount.cifs also handed them off to the kernel. Ignore them.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: map NT_STATUS_ERROR_WRITE_PROTECTED to -EROFS
Jeff Layton [Mon, 26 Jul 2010 14:29:57 +0000 (10:29 -0400)]
cifs: map NT_STATUS_ERROR_WRITE_PROTECTED to -EROFS

Seems like a more sensible mapping than -EIO.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: don't allow cifs_iget to match inodes of the wrong type
Jeff Layton [Mon, 19 Jul 2010 22:00:17 +0000 (18:00 -0400)]
cifs: don't allow cifs_iget to match inodes of the wrong type

If the type is different from what we think it should be, then don't
match the existing inode.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years ago[CIFS] relinquish fscache cookie before freeing CIFSTconInfo
Steve French [Fri, 23 Jul 2010 20:37:53 +0000 (20:37 +0000)]
[CIFS] relinquish fscache cookie before freeing CIFSTconInfo

Doh, fix a use after free bug.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Reviewed-and-Tested-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: add separate cred_uid field to sesInfo
Jeff Layton [Mon, 19 Jul 2010 22:00:17 +0000 (18:00 -0400)]
cifs: add separate cred_uid field to sesInfo

Right now, there's no clear separation between the uid that owns the
credentials used to do the mount and the overriding owner of the files
on that mount.

Add a separate cred_uid field that is set to the real uid
of the mount user. Unlike the linux_uid, the uid= option does not
override this parameter. The parm is sent to cifs.upcall, which can then
preferentially use the creduid= parm instead of the uid= parm for
finding credentials.

This is not the only way to solve this. We could try to do all of this
in kernel instead by having a module parameter that affects what gets
passed in the uid= field of the upcall. That said, we have a lot more
flexibility to change things in userspace so I think it probably makes
sense to do it this way.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agofs: cifs: check kmalloc() result
Kulikov Vasiliy [Fri, 16 Jul 2010 16:15:25 +0000 (20:15 +0400)]
fs: cifs: check kmalloc() result

If kmalloc() fails exit with -ENOMEM.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Acked-by: Dave Kleikamp <shaggy@linux.vnet.ibm.com>
Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years ago[CIFS] Missing ifdef
Steve French [Fri, 16 Jul 2010 04:31:02 +0000 (04:31 +0000)]
[CIFS] Missing ifdef

Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years ago[CIFS] Missing line from previous commit
Steve French [Fri, 16 Jul 2010 04:24:54 +0000 (04:24 +0000)]
[CIFS] Missing line from previous commit

CC: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years ago[CIFS] Fix build break when CONFIG_CIFS_FSCACHE disabled
Steve French [Fri, 16 Jul 2010 04:18:36 +0000 (04:18 +0000)]
[CIFS] Fix build break when CONFIG_CIFS_FSCACHE disabled

CC: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: add mount option to enable local caching
Suresh Jayaraman [Mon, 5 Jul 2010 12:43:36 +0000 (18:13 +0530)]
cifs: add mount option to enable local caching

Add a mount option 'fsc' to enable local caching on CIFS.

I considered adding a separate debug bit for caching, but it appears that
debugging would be relatively easier with the normal CIFS_INFO level.

As the cifs-utils (userspace) changes are not done yet, this patch enables
'fsc' by default to enable testing.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: read pages from FS-Cache
Suresh Jayaraman [Mon, 5 Jul 2010 12:43:25 +0000 (18:13 +0530)]
cifs: read pages from FS-Cache

Read pages from a FS-Cache data storage object into a CIFS inode.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: store pages into local cache
Suresh Jayaraman [Mon, 5 Jul 2010 12:43:11 +0000 (18:13 +0530)]
cifs: store pages into local cache

Store pages from an CIFS inode into the data storage object associated with
that inode.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: FS-Cache page management
Suresh Jayaraman [Mon, 5 Jul 2010 12:43:00 +0000 (18:13 +0530)]
cifs: FS-Cache page management

Takes care of invalidation and release of FS-Cache marked pages and also
invalidation of the FsCache page flag when the inode is removed.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: define inode-level cache object and register them
Suresh Jayaraman [Mon, 5 Jul 2010 12:42:45 +0000 (18:12 +0530)]
cifs: define inode-level cache object and register them

Define inode-level data storage objects (managed by cifsInodeInfo structs).
Each inode-level object is created in a super-block level object and is itself
a data storage object in to which pages from the inode are stored.

The inode object is keyed by UniqueId. The coherency data being used is
LastWriteTime, LastChangeTime and end of file reported by the server.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: define superblock-level cache index objects and register them
Suresh Jayaraman [Mon, 5 Jul 2010 12:42:27 +0000 (18:12 +0530)]
cifs: define superblock-level cache index objects and register them

Define superblock-level cache index objects (managed by cifsTconInfo structs).
Each superblock object is created in a server-level index object and in itself
an index into which inode-level objects are inserted.

The superblock object is keyed by sharename. The UniqueId/IndexNumber is used to
validate that the exported share is the same since we accessed it last time.

Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: remove unused cifsUidInfo struct
Jeff Layton [Wed, 7 Jul 2010 00:43:08 +0000 (20:43 -0400)]
cifs: remove unused cifsUidInfo struct

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: clean up cifs_find_smb_ses (try #2)
Jeff Layton [Wed, 7 Jul 2010 00:43:02 +0000 (20:43 -0400)]
cifs: clean up cifs_find_smb_ses (try #2)

This patch replaces the earlier patch by the same name. The only
difference is that MAX_PASSWORD_SIZE has been increased to attempt to
match the limits that windows enforces.

Do a better job of matching sessions by authtype. Matching by username
for a Kerberos session is incorrect, and anonymous sessions need special
handling.

Also, in the case where we do match by username, we also need to match
by password. That ensures that someone else doesn't "borrow" an existing
session without needing to know the password.

Finally, passwords can be longer than 16 bytes. Bump MAX_PASSWORD_SIZE
to 512 to match the size that the userspace mount helper allows.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: match secType when searching for existing tcp session
Jeff Layton [Wed, 7 Jul 2010 00:43:02 +0000 (20:43 -0400)]
cifs: match secType when searching for existing tcp session

The secType is a per-tcp session entity, but the current routine doesn't
verify that it is acceptible when attempting to match an existing TCP
session.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: move address comparison into separate function
Jeff Layton [Wed, 7 Jul 2010 00:43:02 +0000 (20:43 -0400)]
cifs: move address comparison into separate function

Move the address comparator out of cifs_find_tcp_session and into a
separate function for cleanliness. Also change the argument to
that function to a "struct sockaddr" pointer. Passing pointers to
sockaddr_storage is a little odd since that struct is generally for
declaring static storage.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
14 years agocifs: set the port in sockaddr in a more clearly defined fashion
Jeff Layton [Wed, 7 Jul 2010 00:43:01 +0000 (20:43 -0400)]
cifs: set the port in sockaddr in a more clearly defined fashion

This patch should replace the patch I sent a couple of weeks ago to
set the port in cifs_convert_address.

Currently we set this in cifs_find_tcp_session, but that's more of a
side effect than anything. Add a new function called cifs_fill_sockaddr.
Have it call cifs_convert_address and then set the port.

This also allows us to skip passing in the port as a separate parm to
cifs_find_tcp_session.

Also, change cifs_convert_address take a struct sockaddr * rather than
void * to make it clearer how this function should be called.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>