]> bbs.cooldavid.org Git - net-next-2.6.git/log
net-next-2.6.git
15 years agoBtrfs: fix return value from btrfs_listxattr when buffer size is too small
Yehuda Sadeh Weinraub [Wed, 17 Dec 2008 15:21:26 +0000 (10:21 -0500)]
Btrfs: fix return value from btrfs_listxattr when buffer size is too small

The return value was being overwritten.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
15 years agoBtrfs: shift all end_io work to thread pools
Chris Mason [Wed, 17 Dec 2008 19:51:42 +0000 (14:51 -0500)]
Btrfs: shift all end_io work to thread pools

bio_end_io for reads without checksumming on and btree writes were
happening without using async thread pools.  This means the extent_io.c
code had to use spin_lock_irq and friends on the rb tree locks for
extent state.

There were some irq safe vs unsafe lock inversions between the delallock
lock and the extent state locks.  This patch gets rid of them by moving
all end_io code into the thread pools.

To avoid contention and deadlocks between the data end_io processing and the
metadata end_io processing yet another thread pool is added to finish
off metadata writes.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: properly check free space for tree balancing
Yan Zheng [Wed, 17 Dec 2008 15:21:48 +0000 (10:21 -0500)]
Btrfs: properly check free space for tree balancing

btrfs_insert_empty_items takes the space needed by the btrfs_item
structure into account when calculating the required free space.

So the tree balancing code shouldn't add sizeof(struct btrfs_item)
to the size when checking the free space. This patch removes these
superfluous additions.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
15 years agoBtrfs: fix return value from btrfs_listxattr when buffer size is too small
Yehuda Sadeh Weinraub [Wed, 17 Dec 2008 15:21:03 +0000 (10:21 -0500)]
Btrfs: fix return value from btrfs_listxattr when buffer size is too small

The return value was being overwritten.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
15 years agoBtrfs: delete checksum items before marking blocks free
Chris Mason [Tue, 16 Dec 2008 18:51:01 +0000 (13:51 -0500)]
Btrfs: delete checksum items before marking blocks free

Btrfs maintains a cache of blocks available for allocation in ram.  The
code that frees extents was marking the extents free and then deleting
the checksum items.

This meant it was possible the extent would be reallocated before the
checksum item was actually deleted, leading to races and other
problems as the checksums were updated for the newly allocated extent.

The fix is to delete the checksum before marking the extent free.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Don't use spin*lock_irq for the delalloc lock
Chris Mason [Mon, 15 Dec 2008 20:54:40 +0000 (15:54 -0500)]
Btrfs: Don't use spin*lock_irq for the delalloc lock

The delalloc lock doesn't need to have irqs disabled, nobody that
changes the number of delalloc bytes in the FS is running with irqs off.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Fix compressed writes on truncated pages
Chris Mason [Mon, 15 Dec 2008 16:44:56 +0000 (11:44 -0500)]
Btrfs: Fix compressed writes on truncated pages

The compression code was using isize to limit the amount of data it
sent through zlib.  But, it wasn't properly limiting the looping to
just the pages inside i_size.  The end result was trying to compress
too many pages, including those that had not been setup and properly locked
down.  This made the compression code oops while trying find_get_page on a
page that didn't exist.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: fix nodatasum handling in balancing code
Yan Zheng [Fri, 12 Dec 2008 15:03:38 +0000 (10:03 -0500)]
Btrfs: fix nodatasum handling in balancing code

Checksums on data can be disabled by mount option, so it's
possible some data extents don't have checksums or have
invalid checksums. This causes trouble for data relocation.
This patch contains following things to make data relocation
work.

1) make nodatasum/nodatacow mount option only affects new
files. Checksums and COW on data are only controlled by the
inode flags.

2) check the existence of checksum in the nodatacow checker.
If checksums exist, force COW the data extent. This ensure that
checksum for a given block is either valid or does not exist.

3) update data relocation code to properly handle the case
of checksum missing.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
15 years agoBtrfs: shared seed device
Yan Zheng [Fri, 12 Dec 2008 15:03:26 +0000 (10:03 -0500)]
Btrfs: shared seed device

This patch makes seed device possible to be shared by
multiple mounted file systems. The sharing is achieved
by cloning seed device's btrfs_fs_devices structure.
Thanks you,

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
15 years agoBtrfs: fix leaking block group on balance
Yan Zheng [Thu, 11 Dec 2008 21:30:39 +0000 (16:30 -0500)]
Btrfs: fix leaking block group on balance

The block group structs are referenced in many different
places, and it's not safe to free while balancing.  So, those block
group structs were simply leaked instead.

This patch replaces the block group pointer in the inode with the starting byte
offset of the block group and adds reference counting to the block group
struct.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
15 years agoBtrfs: mnt_drop_write in ioctl_trans_end
Sage Weil [Thu, 11 Dec 2008 21:30:06 +0000 (16:30 -0500)]
Btrfs: mnt_drop_write in ioctl_trans_end

Add missing mnt_drop_write to match the mnt_want_write in
btrfs_ioctl_trans_start.

Signed-off-by: Sage Weil <sage@newdream.net>
15 years agoBtrfs: Add checking of csum tree in balancing code
Yan Zheng [Thu, 11 Dec 2008 01:32:51 +0000 (20:32 -0500)]
Btrfs: Add checking of csum tree in balancing code

This updates the space balancing code for the
new checksum format.

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
15 years agoBtrfs: Delete csum items when freeing extents
Chris Mason [Wed, 10 Dec 2008 14:10:46 +0000 (09:10 -0500)]
Btrfs: Delete csum items when freeing extents

This finishes off the new checksumming code by removing csum items
for extents that are no longer in use.

The trick is doing it without racing because a single csum item may
hold csums for more than one extent.  Extra checks are added to
btrfs_csum_file_blocks to make sure that we are using the correct
csum item after dropping locks.

A new btrfs_split_item is added to split a single csum item so it
can be split without dropping the leaf lock.  This is used to
remove csum bytes from the middle of an item.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Fix compressed checksum fsync log copies
Chris Mason [Tue, 9 Dec 2008 00:15:39 +0000 (19:15 -0500)]
Btrfs: Fix compressed checksum fsync log copies

The fsync logging code makes sure to onl copy the relevant checksum for each
extent based on the file extent pointers it finds.

But for compressed extents, it needs to copy the checksum for the
entire extent.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Add inode sequence number for NFS and reserved space in a few structs
Chris Mason [Mon, 8 Dec 2008 21:40:21 +0000 (16:40 -0500)]
Btrfs: Add inode sequence number for NFS and reserved space in a few structs

This adds a sequence number to the btrfs inode that is increased on
every update.  NFS will be able to use that to detect when an inode has
changed, without relying on inaccurate time fields.

While we're here, this also:

Puts reserved space into the super block and inode

Adds a log root transid to the super so we can pick the newest super
based on the fsync log as well as the main transaction ID.  For now
the log root transid is always zero, but that'll get fixed.

Adds a starting offset to the dev_item.  This will let us do better
alignment calculations if we know the start of a partition on the disk.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Use map_private_extent_buffer during generic_bin_search
Chris Mason [Mon, 8 Dec 2008 21:43:10 +0000 (16:43 -0500)]
Btrfs: Use map_private_extent_buffer during generic_bin_search

It is possible that generic_bin_search will be called on a tree block
that has not been locked.  This happens because cache_block_block skips
locking on the tree blocks.

Since the tree block isn't locked, we aren't allowed to change
the extent_buffer->map_token field.  Using map_private_extent_buffer
avoids any changes to the internal extent buffer fields.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: superblock duplication
Yan Zheng [Mon, 8 Dec 2008 21:46:26 +0000 (16:46 -0500)]
Btrfs: superblock duplication

This patch implements superblock duplication. Superblocks
are stored at offset 16K, 64M and 256G on every devices.
Spaces used by superblocks are preserved by the allocator,
which uses a reverse mapping function to find the logical
addresses that correspond to superblocks. Thank you,

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
15 years agoBtrfs: move data checksumming into a dedicated tree
Chris Mason [Mon, 8 Dec 2008 21:58:54 +0000 (16:58 -0500)]
Btrfs: move data checksumming into a dedicated tree

Btrfs stores checksums for each data block.  Until now, they have
been stored in the subvolume trees, indexed by the inode that is
referencing the data block.  This means that when we read the inode,
we've probably read in at least some checksums as well.

But, this has a few problems:

* The checksums are indexed by logical offset in the file.  When
compression is on, this means we have to do the expensive checksumming
on the uncompressed data.  It would be faster if we could checksum
the compressed data instead.

* If we implement encryption, we'll be checksumming the plain text and
storing that on disk.  This is significantly less secure.

* For either compression or encryption, we have to get the plain text
back before we can verify the checksum as correct.  This makes the raid
layer balancing and extent moving much more expensive.

* It makes the front end caching code more complex, as we have touch
the subvolume and inodes as we cache extents.

* There is potentitally one copy of the checksum in each subvolume
referencing an extent.

The solution used here is to store the extent checksums in a dedicated
tree.  This allows us to index the checksums by phyiscal extent
start and length.  It means:

* The checksum is against the data stored on disk, after any compression
or encryption is done.

* The checksum is stored in a central location, and can be verified without
following back references, or reading inodes.

This makes compression significantly faster by reducing the amount of
data that needs to be checksummed.  It will also allow much faster
raid management code in general.

The checksums are indexed by a key with a fixed objectid (a magic value
in ctree.h) and offset set to the starting byte of the extent.  This
allows us to copy the checksum items into the fsync log tree directly (or
any other tree), without having to invent a second format for them.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Fix sparse endian warnings in struct-funcs.c
Chris Mason [Tue, 2 Dec 2008 16:18:37 +0000 (11:18 -0500)]
Btrfs: Fix sparse endian warnings in struct-funcs.c

The btrfs macros to access individual struct members on disk were
sending the same variable to functions that expected different types
of endianness.  This fix explicitly creates a variable of the correct
type instead of abusing a single variable for mixed purposes.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: rev the disk format for the inode compat and csum selection changes
Chris Mason [Tue, 2 Dec 2008 14:58:02 +0000 (09:58 -0500)]
Btrfs: rev the disk format for the inode compat and csum selection changes

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: delete unused function: btrfs_invalidate_dcache_root
Chris Mason [Tue, 2 Dec 2008 14:57:03 +0000 (09:57 -0500)]
Btrfs: delete unused function: btrfs_invalidate_dcache_root

Snapshot and subvolume creation no longer need this helper.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: add support for multiple csum algorithms
Josef Bacik [Tue, 2 Dec 2008 12:17:45 +0000 (07:17 -0500)]
Btrfs: add support for multiple csum algorithms

This patch gives us the space we will need in order to have different csum
algorithims at some point in the future.  We save the csum algorithim type
in the superblock, and use those instead of define's.

Signed-off-by: Josef Bacik <jbacik@redhat.com>
15 years agoBtrfs: fix panic on error during mount
Josef Bacik [Tue, 2 Dec 2008 11:36:10 +0000 (06:36 -0500)]
Btrfs: fix panic on error during mount

This needs to be applied on top of my previous patches, but is needed for more
than just my new stuff.  We're going to the wrong label when we have an error,
we try to stop the workers, but they are started below all of this code.  This
fixes it so we go to the right error label and not panic when we fail one of
these cases.

Signed-off-by: Josef Bacik <jbacik@redhat.com>
15 years agoBtrfs: add support for compat flags to btrfs
Josef Bacik [Tue, 2 Dec 2008 11:36:08 +0000 (06:36 -0500)]
Btrfs: add support for compat flags to btrfs

This adds the necessary disk format for handling compatibility flags
in the future to handle disk format changes.  We have a compat_flags,
compat_ro_flags and incompat_flags set for the super block.  Compat
flags will be to hold the features that are compatible with older
versions of btrfs, compat_ro flags have features that are compatible
with older versions of btrfs if the fs is mounted read only, and
incompat_flags has features that are incompatible with older versions
of btrfs.  This also axes the compat_flags field for the inode and
just makes the flags field a 64bit field, and changes the root item
flags field to 64bit.

Signed-off-by: Josef Bacik <jbacik@redhat.com>
15 years agoBtrfs: btrfs: pass void __user * to btrfs_ioctl_clone_range
Christoph Hellwig [Tue, 2 Dec 2008 14:52:24 +0000 (09:52 -0500)]
Btrfs: btrfs: pass void __user * to btrfs_ioctl_clone_range

Cleans the code up a little and also avoids a sparse warning due to the
incorrect cast in the current version of the code.

Signed-off-by: Christoph Hellwig <hch@lst.de>
15 years agoBtrfs: clean up btrfs_ioctl a little bit
Christoph Hellwig [Tue, 2 Dec 2008 11:36:08 +0000 (06:36 -0500)]
Btrfs: clean up btrfs_ioctl a little bit

Provide a void __user *argp pointer so that we can avoid duplicating
the cast for various sub-command calls.

Signed-off-by: Christoph Hellwig <hch@lst.de>
15 years agoBtrfs: corret fmode_t annotations
Christoph Hellwig [Tue, 2 Dec 2008 11:36:09 +0000 (06:36 -0500)]
Btrfs: corret fmode_t annotations

Make sure to propagate fmode_t properly and use the right constants for
it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
15 years agoBtrfs: fix shadowed variable declarations
Christoph Hellwig [Tue, 2 Dec 2008 11:36:09 +0000 (06:36 -0500)]
Btrfs: fix shadowed variable declarations

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: make things static and include the right headers
Christoph Hellwig [Tue, 2 Dec 2008 14:54:17 +0000 (09:54 -0500)]
Btrfs: make things static and include the right headers

Shut up various sparse warnings about symbols that should be either
static or have their declarations in scope.

Signed-off-by: Christoph Hellwig <hch@lst.de>
15 years agoBtrfs: remove unneeded btrfs_start_delalloc_inodes call
Sage Weil [Tue, 2 Dec 2008 14:53:09 +0000 (09:53 -0500)]
Btrfs: remove unneeded btrfs_start_delalloc_inodes call

It is called by btrfs_sync_fs.

Signed-off-by: Sage Weil <sage@newdream.net>
15 years agoBtrfs: remove unneeded total_trans
Sage Weil [Tue, 2 Dec 2008 11:36:10 +0000 (06:36 -0500)]
Btrfs: remove unneeded total_trans

Remove unneeded debugging sanity check.  It gets corrupted anyway when
multiple btrfs file systems are mounted, throwing bad warnings along the
way.

Signed-off-by: Sage Weil <sage@newdream.net>
15 years agoBtrfs: sparse lock verification annotations for wait_on_state
Christoph Hellwig [Tue, 2 Dec 2008 11:36:10 +0000 (06:36 -0500)]
Btrfs: sparse lock verification annotations for wait_on_state

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Fix cow semantic in run_delalloc_nocow()
Liu Hui [Tue, 2 Dec 2008 01:31:40 +0000 (20:31 -0500)]
Btrfs: Fix cow semantic in run_delalloc_nocow()

The file preallocation code reversed the logic to force nodatacow.
This fixes it.

15 years agoBtrfs: Fix for lockdep warnings with alloc_mutex and pinned_mutex
Josef Bacik [Thu, 20 Nov 2008 17:16:16 +0000 (12:16 -0500)]
Btrfs: Fix for lockdep warnings with alloc_mutex and pinned_mutex

This the lockdep complaint by having a different mutex to gaurd caching the
block group, so you don't end up with this backwards dependancy.  Thank you,

Signed-off-by: Josef Bacik <jbacik@redhat.com>
15 years agoBtrfs: only flush down bios for writeback pages
Chris Mason [Thu, 20 Nov 2008 15:46:35 +0000 (10:46 -0500)]
Btrfs: only flush down bios for writeback pages

The btrfs write_cache_pages call has a flush function so that it submits
the bio it has been building before it waits on any writeback pages.

This adds a check so that flush only happens on writeback pages.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Fix cow semantic in run_delalloc_nocow()
Liu Hui [Thu, 20 Nov 2008 15:25:31 +0000 (10:25 -0500)]
Btrfs: Fix cow semantic in run_delalloc_nocow()

The file preallocation code reversed the logic to force nodatacow.  This
fixes it.

15 years agoBtrfs: Drop dirty roots created by log replay immediately when
Yan Zheng [Thu, 20 Nov 2008 15:25:19 +0000 (10:25 -0500)]
Btrfs: Drop dirty roots created by log replay immediately when

The log replay produces dirty roots. These dirty roots
should be dropped immediately if the fs is mounted as
ro. Otherwise they can be added to the dirty root list
again when remounting the fs as rw. Thank you,

Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
15 years agoBtrfs: compat code fixes
Chris Mason [Thu, 20 Nov 2008 15:22:27 +0000 (10:22 -0500)]
Btrfs: compat code fixes

The btrfs git kernel trees is used to build a standalone tree for
compiling against older kernels.  This commit makes the standalone tree
work with 2.6.27

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Use current_fsuid/gid
Chris Mason [Thu, 20 Nov 2008 03:00:53 +0000 (22:00 -0500)]
Btrfs: Use current_fsuid/gid

This fixes compile problems with linux-next

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Fixes for 2.6.28-rc API changes
Chris Mason [Thu, 20 Nov 2008 02:17:22 +0000 (21:17 -0500)]
Btrfs: Fixes for 2.6.28-rc API changes

* open/close_bdev_excl -> open/close_bdev_exclusive
* blkdev_issue_discard takes a GFP mask now
* Fix blkdev_issue_discard usage now that it is enabled

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoMerge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs...
Chris Mason [Wed, 19 Nov 2008 20:59:28 +0000 (15:59 -0500)]
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable

15 years agoBtrfs: fix free space accounting when unpinning extents
Josef Bacik [Wed, 19 Nov 2008 20:17:55 +0000 (15:17 -0500)]
Btrfs: fix free space accounting when unpinning extents

This patch fixes what I hope is the last early ENOSPC bug left.  I did not know
that pinned extents would merge into one big extent when inserted on to the
pinned extent tree, so I was adding free space to a block group that could
possibly span multiple block groups.

This is a big issue because first that space doesn't exist in that block group,
and second we won't actually use that space because there are a bunch of other
checks to make sure we're allocating within the constraints of the block group.

This patch fixes the problem by adding the btrfs_add_free_space to
btrfs_update_pinned_extents which makes sure we are adding the appropriate
amount of free space to the appropriate block group.  Thanks much to Lee Trager
for running my myriad of debug patches to help me track this problem down.
Thank you,

Signed-off-by: Josef Bacik <jbacik@redhat.com>
15 years agoBtrfs: Do fsync log replay when mount -o ro, except when on readonly media
Chris Mason [Wed, 19 Nov 2008 20:13:35 +0000 (15:13 -0500)]
Btrfs: Do fsync log replay when mount -o ro, except when on readonly media

fsync log replay can change the filesystem, so it cannot be delayed until
mount -o rw,remount, and it can't be forgotten entirely.  So, this patch
changes btrfs to do with reiserfs, ext3 and xfs do, which is to do the
log replay even when mounted readonly.

On a readonly device if log replay is required, the mount is aborted.

Getting all of this right had required fixing up some of the error
handling in open_ctree.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Avoid writeback stalls
Chris Mason [Wed, 19 Nov 2008 17:44:22 +0000 (12:44 -0500)]
Btrfs: Avoid writeback stalls

While building large bios in writepages, btrfs may end up waiting
for other page writeback to finish if WB_SYNC_ALL is used.

While it is waiting, the bio it is building has a number of pages with the
writeback bit set and they aren't getting to the disk any time soon.  This
lowers the latencies of writeback in general by sending down the bio being
built before waiting for other pages.

The bio submission code tries to limit the total number of async bios in
flight by waiting when we're over a certain number of async bios.  But,
the waits are happening while writepages is building bios, and this can easily
lead to stalls and other problems for people calling wait_on_page_writeback.

The current fix is to let the congestion tests take care of waiting.

sync() and others make sure to drain the current async requests to make
sure that everything that was pending when the sync was started really get
to disk.  The code would drain pending requests both before and after
submitting a new request.

But, if one of the requests is waiting for page writeback to finish,
the draining waits might block that page writeback.  This changes the
draining code to only wait after submitting the bio being processed.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: switch back to wait_on_page_writeback to wait on metadata writes
Chris Mason [Tue, 18 Nov 2008 17:13:12 +0000 (12:13 -0500)]
Btrfs: switch back to wait_on_page_writeback to wait on metadata writes

The extent based waiting was using more CPU, and other fixes have helped
with the unplug storm problems.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Update the disk format for the seed device and new root code
Chris Mason [Tue, 18 Nov 2008 16:50:33 +0000 (11:50 -0500)]
Btrfs: Update the disk format for the seed device and new root code
Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: unplug all devices in the unplug call back
Chris Mason [Tue, 18 Nov 2008 15:31:22 +0000 (10:31 -0500)]
Btrfs: unplug all devices in the unplug call back

For larger multi-device filesystems, there was logic to limit the
number of devices unplugged to just the page that was sent to our sync_page
function.

But, the code wasn't always unplugging the right device.  Since this was
just an optimization, disable it for now.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Some fixes for batching extent insert.
Liu Hui [Tue, 18 Nov 2008 16:30:10 +0000 (11:30 -0500)]
Btrfs: Some fixes for batching extent insert.

In insert_extents(), when ret==1 and last is not zero, it should
check if the current inserted item is the last item in this batching
inserts. If so, it should just break from loop. If not, 'cur =
insert_list->next' will make no sense because the list is empty now,
and 'op' will point to an unexpectable place.

There are also some trivial fixs in this patch including one comment
typo error and deleting two redundant lines.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: prevent loops in the directory tree when creating snapshots
Chris Mason [Tue, 18 Nov 2008 02:14:24 +0000 (21:14 -0500)]
Btrfs: prevent loops in the directory tree when creating snapshots

For a directory tree:

/mnt/subvolA/subvolB

btrfsctl -s /mnt/subvolA/subvolB /mnt

Will create a directory loop with subvolA under subvolB.  This
commit uses the forward refs for each subvol and snapshot to error out
before creating the loop.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Add backrefs and forward refs for subvols and snapshots
Chris Mason [Tue, 18 Nov 2008 01:37:39 +0000 (20:37 -0500)]
Btrfs: Add backrefs and forward refs for subvols and snapshots

Subvols and snapshots can now be referenced from any point in the directory
tree.  We need to maintain back refs for them so we can find lost
subvols.

Forward refs are added so that we know all of the subvols and
snapshots referenced anywhere in the directory tree of a single subvol.  This
can be used to do recursive snapshotting (but they aren't yet) and it is
also used to detect and prevent directory loops when creating new snapshots.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Give each subvol and snapshot their own anonymous devid
Chris Mason [Tue, 18 Nov 2008 01:42:26 +0000 (20:42 -0500)]
Btrfs: Give each subvol and snapshot their own anonymous devid

Each subvolume has its own private inode number space, and so we need
to fill in different device numbers for each subvolume to avoid confusing
applications.

This commit puts a struct super_block into struct btrfs_root so it can
call set_anon_super() and get a different device number generated for
each root.

btrfs_rename is changed to prevent renames across subvols.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Allow subvolumes and snapshots anywhere in the directory tree
Chris Mason [Tue, 18 Nov 2008 02:02:50 +0000 (21:02 -0500)]
Btrfs: Allow subvolumes and snapshots anywhere in the directory tree

Before, all snapshots and subvolumes lived in a single flat directory.  This
was awkward and confusing because the single flat directory was only writable
with the ioctls.

This commit changes the ioctls to create subvols and snapshots at any
point in the directory tree.  This requires making separate ioctls for
snapshot and subvol creation instead of a combining them into one.

The subvol ioctl does:

btrfsctl -S subvol_name parent_dir

After the ioctl is done subvol_name lives inside parent_dir.

The snapshot ioctl does:

btrfsctl -s path_for_snapshot root_to_snapshot

path_for_snapshot can be an absolute or relative path.  btrfsctl breaks it up
into directory and basename components.

root_to_snapshot can be any file or directory in the FS.  The snapshot
is taken of the entire root where that file lives.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: Add some debugging around the ENOSPC bugs
Josef Bacik [Tue, 18 Nov 2008 02:12:00 +0000 (21:12 -0500)]
Btrfs: Add some debugging around the ENOSPC bugs

Some people are still reporting problems with early enospc.  This
will help narrown down the cause.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
15 years agoBtrfs: fix free space leak
Josef Bacik [Tue, 18 Nov 2008 02:11:49 +0000 (21:11 -0500)]
Btrfs: fix free space leak

In my batch delete/update/insert patch I introduced a free space leak.  The
extent that we do the original search on in free_extents is never pinned, so we
always update the block saying that it has free space, but the free space never
actually gets added to the free space tree, since op->del will always be 0 and
it's never actually added to the pinned extents tree.

This patch fixes this problem by making sure we call pin_down_bytes on the
pending extent op and set op->del to the return value of pin_down_bytes so
update_block_group is called with the right value.  This seems to fix the case
where we were getting ENOSPC when there was plenty of space available.

Signed-off-by: Josef Bacik <jbacik@redhat.com>
15 years agoLinux 2.6.28-rc5 v2.6.28-rc5
Linus Torvalds [Sat, 15 Nov 2008 21:42:56 +0000 (13:42 -0800)]
Linux 2.6.28-rc5

15 years agoFix inotify watch removal/umount races
Al Viro [Sat, 15 Nov 2008 01:15:43 +0000 (01:15 +0000)]
Fix inotify watch removal/umount races

Inotify watch removals suck violently.

To kick the watch out we need (in this order) inode->inotify_mutex and
ih->mutex.  That's fine if we have a hold on inode; however, for all
other cases we need to make damn sure we don't race with umount.  We can
*NOT* just grab a reference to a watch - inotify_unmount_inodes() will
happily sail past it and we'll end with reference to inode potentially
outliving its superblock.

Ideally we just want to grab an active reference to superblock if we
can; that will make sure we won't go into inotify_umount_inodes() until
we are done.  Cleanup is just deactivate_super().

However, that leaves a messy case - what if we *are* racing with
umount() and active references to superblock can't be acquired anymore?
We can bump ->s_count, grab ->s_umount, which will almost certainly wait
until the superblock is shut down and the watch in question is pining
for fjords.  That's fine, but there is a problem - we might have hit the
window between ->s_active getting to 0 / ->s_count - below S_BIAS (i.e.
the moment when superblock is past the point of no return and is heading
for shutdown) and the moment when deactivate_super() acquires
->s_umount.

We could just do drop_super() yield() and retry, but that's rather
antisocial and this stuff is luser-triggerable.  OTOH, having grabbed
->s_umount and having found that we'd got there first (i.e.  that
->s_root is non-NULL) we know that we won't race with
inotify_umount_inodes().

So we could grab a reference to watch and do the rest as above, just
with drop_super() instead of deactivate_super(), right? Wrong.  We had
to drop ih->mutex before we could grab ->s_umount.  So the watch
could've been gone already.

That still can be dealt with - we need to save watch->wd, do idr_find()
and compare its result with our pointer.  If they match, we either have
the damn thing still alive or we'd lost not one but two races at once,
the watch had been killed and a new one got created with the same ->wd
at the same address.  That couldn't have happened in inotify_destroy(),
but inotify_rm_wd() could run into that.  Still, "new one got created"
is not a problem - we have every right to kill it or leave it alone,
whatever's more convenient.

So we can use idr_find(...) == watch && watch->inode->i_sb == sb as
"grab it and kill it" check.  If it's been our original watch, we are
fine, if it's a newcomer - nevermind, just pretend that we'd won the
race and kill the fscker anyway; we are safe since we know that its
superblock won't be going away.

And yes, this is far beyond mere "not very pretty"; so's the entire
concept of inotify to start with.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Greg KH <greg@kroah.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoLIS3LV02Dx: remove unused #include <version.h>
Huang Weiyi [Thu, 13 Nov 2008 12:14:17 +0000 (20:14 +0800)]
LIS3LV02Dx: remove unused #include <version.h>

The file(s) below do not use LINUX_VERSION_CODE nor KERNEL_VERSION.
  drivers/hwmon/lis3lv02d.c

This patch removes the said #include <version.h>.

Signed-off-by: Huang Weiyi <weiyi.huang@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'sh/for-2.6.28' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal...
Linus Torvalds [Sat, 15 Nov 2008 20:10:32 +0000 (12:10 -0800)]
Merge branch 'sh/for-2.6.28' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6

* 'sh/for-2.6.28' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6:
  serial: sh-sci: Reorder the SCxTDR write after the TDxE clear.
  sh: __copy_user function can corrupt the stack in case of exception
  sh: Fixed the TMU0 reload value on resume
  sh: Don't factor in PAGE_OFFSET for valid_phys_addr_range() check.
  sh: early printk port type fix
  i2c: fix i2c-sh_mobile rx underrun
  sh: Provide a sane valid_phys_addr_range() to prevent TLB reset with PMB.
  usb: r8a66597-hcd: fix wrong data access in SuperH on-chip USB
  fix sci type for SH7723
  serial: sh-sci: fix cannot work SH7723 SCIFA
  sh: Handle fixmap TLB eviction more coherently.

15 years agoMerge branch 'doc-subdirs' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap...
Linus Torvalds [Sat, 15 Nov 2008 19:51:03 +0000 (11:51 -0800)]
Merge branch 'doc-subdirs' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap/linux-docs

* 'doc-subdirs' of git://git.kernel.org/pub/scm/linux/kernel/git/rdunlap/linux-docs:
  Create/use more directory structure in the Documentation/ tree.

15 years agoAdd 'pr_fmt()' format modifier to pr_xyz macros.
Martin Schwidefsky [Wed, 12 Nov 2008 20:16:43 +0000 (21:16 +0100)]
Add 'pr_fmt()' format modifier to pr_xyz macros.

A common reason for device drivers to implement their own printk macros
is the lack of a printk prefix with the standard pr_xyz macros.
Introduce a pr_fmt() macro that is applied for every pr_xyz macro to the
format string.

The most common use of the pr_fmt macro would be to add the name of the
device driver to all pr_xyz messages in a source file.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh...
Linus Torvalds [Sat, 15 Nov 2008 19:39:09 +0000 (11:39 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh/v9fs:
  9p: restrict RDMA usage

15 years agoMerge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Sat, 15 Nov 2008 19:38:41 +0000 (11:38 -0800)]
Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6

* 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6:
  V4L/DVB (9624): CVE-2008-5033: fix OOPS on tvaudio when controlling bass/treble
  V4L/DVB (9623): tvaudio: Improve debug msg by printing something more human
  V4L/DVB (9622): tvaudio: Improve comments and remove a unneeded prototype
  V4L/DVB (9621): Avoid writing outside shadow.bytes[] array
  V4L/DVB (9620): tvaudio: use a direct reference for chip description
  V4L/DVB (9619): tvaudio: update initial comments
  V4L/DVB (9618): tvaudio: add additional logic to avoid OOPS
  V4L/DVB (9617): tvtime: remove generic_checkmode callback
  V4L/DVB (9616): tvaudio: cleanup - group all callbacks together
  V4L/DVB (9615): tvaudio: instead of using a magic number, use ARRAY_SIZE
  V4L/DVB (9613): tvaudio: fix a memory leak

15 years agoMerge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
Linus Torvalds [Sat, 15 Nov 2008 19:38:02 +0000 (11:38 -0800)]
Merge branch 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6

* 'for-linus' of git://git390.osdl.marist.edu/pub/scm/linux-2.6:
  [S390] fix s390x_newuname
  [S390] dasd: log sense for fatal errors
  [S390] cpu topology: fix locking
  [S390] cio: Fix refcount after moving devices.
  [S390] ftrace: fix kernel stack backchain walking
  [S390] ftrace: disable tracing on idle psw
  [S390] lockdep: fix compile bug
  [S390] kvm_s390: Fix oops in virtio device detection with "mem="
  [S390] sclp: emit error message if assign storage fails
  [S390] Fix range for add_active_range() in setup_memory()

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
Linus Torvalds [Sat, 15 Nov 2008 19:37:40 +0000 (11:37 -0800)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
  [SCSI] dpt_i2o: fix transferred data length for scsi_set_resid()
  [SCSI] scsi_error regression: Fix idempotent command handling
  [SCSI] zfcp: Fix hexdump data in s390dbf traces
  [SCSI] zfcp: fix erp timeout cleanup for port open requests
  [SCSI] zfcp: Wait for port scan to complete when setting adapter online
  [SCSI] zfcp: Fix cast warning
  [SCSI] zfcp: Fix request list handling in error path
  [SCSI] zfcp: fix mempool usage for status_read requests
  [SCSI] zfcp: fix req_list_locking.
  [SCSI] zfcp: Dont clear reference from SCSI device to unit
  [SCSI] qla2xxx: Update version number to 8.02.01-k9.
  [SCSI] qla2xxx: Return a FAILED status when abort mailbox-command fails.
  [SCSI] qla2xxx: Do not honour max_vports from firmware for 2G ISPs and below.
  [SCSI] qla2xxx: Use pci_disable_rom() to manipulate PCI config space.
  [SCSI] qla2xxx: Correct Atmel flash-part handling.
  [SCSI] megaraid: fix mega_internal_command oops

15 years agoRevert "x86: blacklist DMAR on Intel G31/G33 chipsets"
David Woodhouse [Fri, 14 Nov 2008 13:47:31 +0000 (13:47 +0000)]
Revert "x86: blacklist DMAR on Intel G31/G33 chipsets"

This reverts commit e51af6630848406fc97adbd71443818cdcda297b, which was
wrongly hoovered up and submitted about a month after a better fix had
already been merged.

The better fix is commit cbda1ba898647aeb4ee770b803c922f595e97731
("PCI/iommu: blacklist DMAR on Intel G31/G33 chipsets"), where we do
this blacklisting based on the DMI identification for the offending
motherboard, since sometimes this chipset (or at least a chipset with
the same PCI ID) apparently _does_ actually have an IOMMU.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agomm: remove unevictable's show_page_path
KOSAKI Motohiro [Fri, 14 Nov 2008 07:25:01 +0000 (16:25 +0900)]
mm: remove unevictable's show_page_path

Hugh Dickins reported show_page_path() is buggy and unsafe because

 - lack dput() against d_find_alias()
 - don't concern vma->vm_mm->owner == NULL
 - lack lock_page()

it was only for debugging, so rather than trying to fix it, just remove
it now.

Reported-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
CC: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
CC: Rik van Riel <riel@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agomisc: C2port needs <linux/sched.h>
Geert Uytterhoeven [Fri, 14 Nov 2008 07:54:46 +0000 (08:54 +0100)]
misc: C2port needs <linux/sched.h>

m68k allmodconfig:

| drivers/misc/c2port/core.c: In function 'c2port_reset':
| drivers/misc/c2port/core.c:73: error: dereferencing pointer to incomplete type
| drivers/misc/c2port/core.c: In function 'c2port_strobe_ck':
| drivers/misc/c2port/core.c:91: error: dereferencing pointer to incomplete type

Include <linux/sched.h> to fix it, as m68k's local_irq_enable() needs to know
about struct task_struct.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agom68k: Fix off-by-one in m68k_setup_user_interrupt()
Geert Uytterhoeven [Fri, 14 Nov 2008 07:10:19 +0000 (08:10 +0100)]
m68k: Fix off-by-one in m68k_setup_user_interrupt()

commit 69961c375288bdab7604e0bb1c8d22999bb8a347 ("[PATCH] m68k/Atari:
Interrupt updates") added a BUG_ON() with an incorrect upper bound
comparison, which causes an early crash on VME boards, where IRQ_USER is
8, cnt is 192 and NR_IRQS is 200.

Reported-by: Stephen N Chivers <schivers@csc.com.au>
Tested-by: Kars de Jong <jongk@linux-m68k.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years agoMerge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzi...
Linus Torvalds [Sat, 15 Nov 2008 19:33:05 +0000 (11:33 -0800)]
Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev

* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev:
  libata: improve phantom device detection

15 years agoMove "exit_robust_list" into mm_release()
Linus Torvalds [Sat, 15 Nov 2008 18:20:36 +0000 (10:20 -0800)]
Move "exit_robust_list" into mm_release()

We don't want to get rid of the futexes just at exit() time, we want to
drop them when doing an execve() too, since that gets rid of the
previous VM image too.

Doing it at mm_release() time means that we automatically always do it
when we disassociate a VM map from the task.

Reported-by: pageexec@freemail.hu
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Nick Piggin <npiggin@suse.de>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Brad Spengler <spender@grsecurity.net>
Cc: Alex Efros <powerman@powerman.name>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
15 years ago[SCSI] dpt_i2o: fix transferred data length for scsi_set_resid()
Miquel van Smoorenburg [Tue, 4 Nov 2008 23:09:12 +0000 (00:09 +0100)]
[SCSI] dpt_i2o: fix transferred data length for scsi_set_resid()

dpt_i2o.c::adpt_i2o_to_scsi() reads the value at (reply+5) which
should contain the length in bytes of the transferred data. This
would be correct if reply was a u32 *. However it is a void * here,
so we need to read the value at (reply+20) instead.

The value at (reply+5) is usually 0xff0000, which is apparently
'large enough' and didn't cause any trouble until 2.6.27 where

commit 427e59f09fdba387547106de7bab980b7fff77be
Author: James Bottomley <James.Bottomley@HansenPartnership.com>
Date:   Sat Mar 8 18:24:17 2008 -0600

    [SCSI] make use of the residue value

caused this to become visible through e.g. iostat -x .

Signed-off-by: Miquel van Smoorenburg <mikevs@xs4all.net>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
15 years agolibata: improve phantom device detection
Tejun Heo [Thu, 13 Nov 2008 01:04:46 +0000 (10:04 +0900)]
libata: improve phantom device detection

Currently libata uses four methods to detect device presence.

1. PHY status if available.
2. TF register R/W test (only promotes presence, never demotes)
3. device signature after reset
4. IDENTIFY failure detection in SFF state machine

Combination of the above works well in most cases but recently there
have been a few reports where a phantom device causes unnecessary
delay during probe.  In both cases, PHY status wasn't available.  In
one case, it passed #2 and #3 and failed IDENTIFY with ATA_ERR which
didn't qualify as #4.  The other failed #2 but as it passed #3 and #4,
it still caused failure.

In both cases, phantom device reported diagnostic failure, so these
cases can be safely worked around by considering any !ATA_DRQ IDENTIFY
failure as NODEV_HINT if diagnostic failure is set.

Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
15 years ago9p: restrict RDMA usage
Randy Dunlap [Wed, 12 Nov 2008 21:05:17 +0000 (13:05 -0800)]
9p: restrict RDMA usage

linux-next:

Make 9p's RDMA option depend on INET since it uses Infiniband rdma_*
functions and that code depends on INET.  Otherwise 9p can try to
use symbols which don't exist.

ERROR: "rdma_destroy_id" [net/9p/9pnet_rdma.ko] undefined!
ERROR: "rdma_connect" [net/9p/9pnet_rdma.ko] undefined!
ERROR: "rdma_create_id" [net/9p/9pnet_rdma.ko] undefined!
ERROR: "rdma_create_qp" [net/9p/9pnet_rdma.ko] undefined!
ERROR: "rdma_resolve_route" [net/9p/9pnet_rdma.ko] undefined!
ERROR: "rdma_disconnect" [net/9p/9pnet_rdma.ko] undefined!
ERROR: "rdma_resolve_addr" [net/9p/9pnet_rdma.ko] undefined!

I used an if/endif block so that the menu items would remain
presented together.

Also correct an article adjective.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
15 years agoCreate/use more directory structure in the Documentation/ tree.
Randy Dunlap [Thu, 13 Nov 2008 21:33:24 +0000 (21:33 +0000)]
Create/use more directory structure in the Documentation/ tree.

Create Documentation/blockdev/ sub-directory and populate it.
Populate the Documentation/serial/ sub-directory.
Move MSI-HOWTO.txt to Documentation/PCI/.
Move ioctl-number.txt to Documentation/ioctl/.
Update all relevant 00-INDEX files.
Update all relevant Kconfig files and source files.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
15 years ago[S390] fix s390x_newuname
Martin Schwidefsky [Fri, 14 Nov 2008 17:18:09 +0000 (18:18 +0100)]
[S390] fix s390x_newuname

The uname system call for 64 bit compares current->personality without
masking the upper 16 bits. If e.g. READ_IMPLIES_EXEC is set the result
of a uname system call will always be s390x even if the process uses
the s390 personality.

Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] dasd: log sense for fatal errors
Stefan Haberland [Fri, 14 Nov 2008 17:18:08 +0000 (18:18 +0100)]
[S390] dasd: log sense for fatal errors

The logging of sense data for fatal errors was accidentally removed
during Hyper PAV implementation.

Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] cpu topology: fix locking
Heiko Carstens [Fri, 14 Nov 2008 17:18:07 +0000 (18:18 +0100)]
[S390] cpu topology: fix locking

cpu_coregroup_map used to grab a mutex on s390 since it was only
called from process context.
Since c7c22e4d5c1fdebfac4dba76de7d0338c2b0d832 "block: add support
for IO CPU affinity" this is not true anymore.
It now also gets called from softirq context.

To prevent possible deadlocks change this in architecture code and
use a spinlock instead of a mutex.

Cc: stable@kernel.org
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] cio: Fix refcount after moving devices.
Cornelia Huck [Fri, 14 Nov 2008 17:18:06 +0000 (18:18 +0100)]
[S390] cio: Fix refcount after moving devices.

In ccw_device_move_to_orphanage(), a replacing ccw_device
is searched via get_{disc,orphaned}_ccwdev_by_dev_id()
which obtain a reference on the returned ccw_device.
This reference must be given up again after the device
has been moved to its new parent.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] ftrace: fix kernel stack backchain walking
Heiko Carstens [Fri, 14 Nov 2008 17:18:05 +0000 (18:18 +0100)]
[S390] ftrace: fix kernel stack backchain walking

With CONFIG_IRQSOFF_TRACER the trace_hardirqs_off() function includes
a call to __builtin_return_address(1). But we calltrace_hardirqs_off()
from early entry code. There we have just a single stack frame.
So this results in a kernel stack backchain walk that would walk beyond
the kernel stack. Following the NULL terminated backchain this results
in a lowcore read access.

To fix this we simply call trace_hardirqs_off_caller() and pass the
current instruction pointer.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] ftrace: disable tracing on idle psw
Heiko Carstens [Fri, 14 Nov 2008 17:18:04 +0000 (18:18 +0100)]
[S390] ftrace: disable tracing on idle psw

Disable tracing on idle psw. Otherwise it would give us huge
preempt off times for idle. Which is rather pointless.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] lockdep: fix compile bug
Heiko Carstens [Fri, 14 Nov 2008 17:18:03 +0000 (18:18 +0100)]
[S390] lockdep: fix compile bug

arch/s390/kernel/built-in.o: In function `cleanup_io_leave_insn':
mem_detect.c:(.text+0x10592): undefined reference to `lockdep_sys_exit'

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] kvm_s390: Fix oops in virtio device detection with "mem="
Christian Borntraeger [Fri, 14 Nov 2008 17:18:02 +0000 (18:18 +0100)]
[S390] kvm_s390: Fix oops in virtio device detection with "mem="

The current virtio model on s390 has the descriptor page above the main
memory. The guest virtio detection will oops if the mem= parameter is
used to reduce/change the memory size.
We have to use real_memory_size instead of max_pfn to detect the virtio
descriptor pages.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
15 years ago[S390] sclp: emit error message if assign storage fails
Heiko Carstens [Fri, 14 Nov 2008 17:18:01 +0000 (18:18 +0100)]
[S390] sclp: emit error message if assign storage fails

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years ago[S390] Fix range for add_active_range() in setup_memory()
Gerald Schaefer [Fri, 14 Nov 2008 17:18:00 +0000 (18:18 +0100)]
[S390] Fix range for add_active_range() in setup_memory()

add_active_range() expects start_pfn + size as end_pfn value, i.e. not
the pfn of the last page frame but the one behind that.
We used the pfn of the last page frame so far, which can lead to a
BUG_ON in move_freepages(), when the kernelcore parameter is specified
(page_zone(start_page) != page_zone(end_page)).

Signed-off-by: Gerald Schaefer <gerald.schaefer@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
15 years agoV4L/DVB (9624): CVE-2008-5033: fix OOPS on tvaudio when controlling bass/treble
Mauro Carvalho Chehab [Fri, 14 Nov 2008 13:46:59 +0000 (10:46 -0300)]
V4L/DVB (9624): CVE-2008-5033: fix OOPS on tvaudio when controlling bass/treble

This bug were supposed to be fixed by 5ba2f67afb02c5302b2898949ed6fc3b3d37dcf1,
where a call to NULL happens.

Not all tvaudio chips allow controlling bass/treble. So, the driver
has a table with a flag to indicate if the chip does support it.

Unfortunately, the handling of this logic were broken for a very long
time (probably since the first module version). Due to that, an OOPS
were generated for devices that don't support bass/treble.

This were the resulting OOPS message before the patch, with debug messages
enabled:

tvaudio' 1-005b: VIDIOC_S_CTRL
BUG: unable to handle kernel NULL pointer dereference at 00000000
IP: [<00000000>]
*pde = 22fda067 *pte = 00000000
Oops: 0000 [#1] SMP
Modules linked in: snd_hda_intel snd_seq_dummy snd_seq_oss snd_seq_midi_event snd_seq snd_seq_device
snd_pcm_oss snd_mixer_oss snd_pcm snd_timer snd_hwdep snd soundcore tuner_simple tuner_types tea5767 tuner
tvaudio bttv bridgebnep rfcomm l2cap bluetooth it87 hwmon_vid hwmon fuse sunrpc ipt_REJECT
nf_conntrack_ipv4 iptable_filter ip_tables ip6t_REJECT xt_tcpudp nf_conntrack_ipv6 xt_state nf_conntrack
ip6table_filter ip6_tables x_tables ipv6 dm_mirrordm_multipath dm_mod configfs videodev v4l1_compat
ir_common 8139cp compat_ioctl32 v4l2_common 8139too videobuf_dma_sg videobuf_core mii btcx_risc tveeprom
i915 button snd_page_alloc serio_raw drm pcspkr i2c_algo_bit i2c_i801 i2c_core iTCO_wdt
iTCO_vendor_support sr_mod cdrom sg ata_generic pata_acpi ata_piix libata sd_mod scsi_mod ext3 jbdmbcache
uhci_hcd ohci_hcd ehci_hcd [last unloaded: soundcore]

Pid: 15413, comm: qv4l2 Not tainted (2.6.25.14-108.fc9.i686 #1)
EIP: 0060:[<00000000>] EFLAGS: 00210246 CPU: 0
EIP is at 0x0
EAX: 00008000 EBX: ebd21600 ECX: e2fd9ec4 EDX: 00200046
ESI: f8c0f0c4 EDI: f8c0f0c4 EBP: e2fd9d50 ESP: e2fd9d2c
 DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
Process qv4l2 (pid: 15413, ti=e2fd9000 task=ebe44000 task.ti=e2fd9000)
Stack: f8c0c6ae e2ff2a00 00000d00 e2fd9ec4 ebc4e000 e2fd9d5c f8c0c448 00000000
       f899c12a e2fd9d5c f899c154 e2fd9d68 e2fd9d80 c0560185 e2fd9d88 f8f3e1d8
       f8f3e1dc ebc4e034 f8f3e18c e2fd9ec4 00000000 e2fd9d90 f899c286 c008561c
Call Trace:
 [<f8c0c6ae>] ? chip_command+0x266/0x4b6 [tvaudio]
 [<f8c0c448>] ? chip_command+0x0/0x4b6 [tvaudio]
 [<f899c12a>] ? i2c_cmd+0x0/0x2f [i2c_core]
 [<f899c154>] ? i2c_cmd+0x2a/0x2f [i2c_core]
 [<c0560185>] ? device_for_each_child+0x21/0x49
 [<f899c286>] ? i2c_clients_command+0x1c/0x1e [i2c_core]
 [<f8f283d8>] ? bttv_call_i2c_clients+0x14/0x16 [bttv]
 [<f8f23601>] ? bttv_s_ctrl+0x1bc/0x313 [bttv]
 [<f8f23445>] ? bttv_s_ctrl+0x0/0x313 [bttv]
 [<f8b6096d>] ? __video_do_ioctl+0x1f84/0x3726 [videodev]
 [<c05abb4e>] ? sock_aio_write+0x100/0x10d
 [<c041b23e>] ? kmap_atomic_prot+0x1dd/0x1df
 [<c043a0c9>] ? enqueue_hrtimer+0xc2/0xcd
 [<c04f4fa4>] ? copy_from_user+0x39/0x121
 [<f8b622b9>] ? __video_ioctl2+0x1aa/0x24a [videodev]
 [<c04054fd>] ? do_notify_resume+0x768/0x795
 [<c043c0f7>] ? getnstimeofday+0x34/0xd1
 [<c0437b77>] ? autoremove_wake_function+0x0/0x33
 [<f8b62368>] ? video_ioctl2+0xf/0x13 [videodev]
 [<c048c6f0>] ? vfs_ioctl+0x50/0x69
 [<c048c942>] ? do_vfs_ioctl+0x239/0x24c
 [<c048c995>] ? sys_ioctl+0x40/0x5b
 [<c0405bf2>] ? syscall_call+0x7/0xb
 [<c0620000>] ? cpuid4_cache_sysfs_exit+0x3d/0x69
 =======================
Code:  Bad EIP value.
EIP: [<00000000>] 0x0 SS:ESP 0068:e2fd9d2c

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9623): tvaudio: Improve debug msg by printing something more human
Mauro Carvalho Chehab [Thu, 13 Nov 2008 21:12:43 +0000 (18:12 -0300)]
V4L/DVB (9623): tvaudio: Improve debug msg by printing something more human

Before the patch, the used ioctl were printed as an hexadecimal code,
hard to be understand without consulting the way _IO macros work.
Instead, use the V4L default handler for printing such errors into a way
that would be easier to understand.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9622): tvaudio: Improve comments and remove a unneeded prototype
Mauro Carvalho Chehab [Thu, 13 Nov 2008 20:25:04 +0000 (17:25 -0300)]
V4L/DVB (9622): tvaudio: Improve comments and remove a unneeded prototype

Some comments are not clear enough. Improve it to allow a better
understanding of the driver behavior.

While there, remove an unneeded struct prototype.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9621): Avoid writing outside shadow.bytes[] array
Mauro Carvalho Chehab [Thu, 13 Nov 2008 20:03:28 +0000 (17:03 -0300)]
V4L/DVB (9621): Avoid writing outside shadow.bytes[] array

There were no check about the limits of shadow.bytes array. This offers
a risk of writing values outside the limits, overriding other data
areas.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9620): tvaudio: use a direct reference for chip description
Mauro Carvalho Chehab [Thu, 13 Nov 2008 19:22:53 +0000 (16:22 -0300)]
V4L/DVB (9620): tvaudio: use a direct reference for chip description

Instead of storing the pointer for the proper entry at chip description
table, the driver were storing an indirect reference, by using an index.
Better to reference directly the data.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9619): tvaudio: update initial comments
Mauro Carvalho Chehab [Thu, 13 Nov 2008 17:07:54 +0000 (14:07 -0300)]
V4L/DVB (9619): tvaudio: update initial comments

A driver used on several bttv boards since 2000 is not experimental
anymore ;) Remove it from the comments.

While there, update copyrights addind a quick note about the "recent"
updates since 2005.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9618): tvaudio: add additional logic to avoid OOPS
Mauro Carvalho Chehab [Thu, 13 Nov 2008 17:01:15 +0000 (14:01 -0300)]
V4L/DVB (9618): tvaudio: add additional logic to avoid OOPS

This patch checks for volume, bass, treble, set mode and get mode
callbacks before actually enabling the code that would use them.

Instead of aborting the driver for load, this patch will allow it to
load with a reduced number of functionatities.

This prevents OOPS if some board entry is missing a needed callback.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9617): tvtime: remove generic_checkmode callback
Mauro Carvalho Chehab [Thu, 13 Nov 2008 16:55:39 +0000 (13:55 -0300)]
V4L/DVB (9617): tvtime: remove generic_checkmode callback

generic_checkmode() were called, via a callback, for some tvaudio chips.
There's just one callback code used on all those boards. So, it makes no
sense on keeping this as a callback.

Since there were some OOPS reported on tvaudio on kerneloops.org, this
patch removes this callback, adding the code at the only place were it
is called: inside chip_tread. A flag were added to indicate the need for
a kernel thread to set stereo mode on cards that needs it.

Using this more direct approach simplifies the code, making it more
robust against human errors.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9616): tvaudio: cleanup - group all callbacks together
Mauro Carvalho Chehab [Thu, 13 Nov 2008 16:14:15 +0000 (13:14 -0300)]
V4L/DVB (9616): tvaudio: cleanup - group all callbacks together

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9615): tvaudio: instead of using a magic number, use ARRAY_SIZE
Mauro Carvalho Chehab [Thu, 13 Nov 2008 16:10:11 +0000 (13:10 -0300)]
V4L/DVB (9615): tvaudio: instead of using a magic number, use ARRAY_SIZE

Also, the default standard is the first one. So, fix the comment at the
array.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoV4L/DVB (9613): tvaudio: fix a memory leak
Mauro Carvalho Chehab [Thu, 13 Nov 2008 16:06:33 +0000 (13:06 -0300)]
V4L/DVB (9613): tvaudio: fix a memory leak

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
Linus Torvalds [Thu, 13 Nov 2008 23:55:07 +0000 (15:55 -0800)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (25 commits)
  USB: net: asix: add support for Cables-to-Go USB Ethernet adapter
  USB: gadget: cdc-acm deadlock fix
  USB: EHCI: fix divide-by-zero bug
  USB: EHCI: fix handling of dead controllers
  usb: r8a66597-hcd: fix wrong data access in SuperH on-chip USB
  ub: stub pre_reset and post_reset to fix oops
  USB: SISUSB2VGA driver: add 0x0711, 0x0903
  usb: unusual devs patch for Nokia 7610 Supernova
  USB: remove optional bus bindings in isp1760, fixing runtime warning
  + usb-serial-cp2101-add-enfora-gsm2228.patch added to -mm tree
  USB: storage: adjust comment in Kconfig
  USB: Fix PS3 USB shutdown problems
  USB: unusual_devs entry for Argosy USB mass-storage interface
  USB: cdc-acm.c: fix recursive lock in acm_start_wb error path
  USB: CP2101 Add device ID for AMB2560
  USB: mention URB_FREE_BUFFER in usb_free_urb documentation
  USB: Add YISO u893 usb modem vendor and product IDs to option driver
  usb: musb: fix BULK request on different available endpoints
  usb: musb: fix debug global variable name
  usb: musb: Removes compilation warning in gadget mode
  ...

15 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
Linus Torvalds [Thu, 13 Nov 2008 23:53:30 +0000 (15:53 -0800)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm

* git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm:
  dm: avoid destroying table in dm_any_congested
  dm: move pending queue wake_up end_io_acct
  dm mpath: warn if args ignored
  dm mpath: avoid attempting to activate null path
  dm stripe: fix init failure
  dm raid1: flush workqueue before destruction

15 years agodm: avoid destroying table in dm_any_congested
Chandra Seetharaman [Thu, 13 Nov 2008 23:39:14 +0000 (23:39 +0000)]
dm: avoid destroying table in dm_any_congested

dm_any_congested() just checks for the DMF_BLOCK_IO and has no
code to make sure that suspend waits for dm_any_congested() to
complete.  This patch adds such a check.

Without it, a race can occur with dm_table_put() attempting to
destroying the table in the wrong thread, the one running
dm_any_congested() which is meant to be quick and return
immediately.

Two examples of problems:
1. Sleeping functions called from congested code, the caller
   of which holds a spin lock.
2. An ABBA deadlock between pdflush and multipathd. The two locks
   in contention are inode lock and kernel lock.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
15 years agodm: move pending queue wake_up end_io_acct
Mikulas Patocka [Thu, 13 Nov 2008 23:39:10 +0000 (23:39 +0000)]
dm: move pending queue wake_up end_io_acct

This doesn't fix any bug, just moves wake_up immediately after decrementing
md->pending, for better code readability.

It must be clear to anyone manipulating md->pending to wake up
the queue if md->pending reaches zero, so move the wakeup as close to
the decrementing as possible.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
15 years agodm mpath: warn if args ignored
Chandra Seetharaman [Thu, 13 Nov 2008 23:39:06 +0000 (23:39 +0000)]
dm mpath: warn if args ignored

Currently dm ignores the parameters provided to hardware handlers
without providing any notifications to the user.

This patch just prints a warning message so that the user knows that
the arguments are ignored.

Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>