Commit Graph

902 Commits

Author SHA1 Message Date
Brian Behlendorf 1f3c757320 Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-08-02 13:22:13 -07:00
Brian Behlendorf 0fee5e7ac8 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-08-02 13:21:53 -07:00
Brian Behlendorf 7b8a233029 Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-08-02 13:21:52 -07:00
Brian Behlendorf bb064e0220 Merge branch 'fix-taskq' into refs/top-bases/fix-branch 2010-08-02 13:21:51 -07:00
Ricardo M. Correia 4ca4dfe9bb Fix taskq_dispatch() call in zio_taskq_dispatch().
The feature branch 'fix-taskq' in Linux's ZFS tree changes the taskq_dispatch()
flag from TQ_SLEEP to TQ_NOSLEEP to avoid sleeping in some circumstances.

However, this has the side effect that taskq_dispatch() now may fail, and since
the return code was not even being checked, it could lead to zio's not being
scheduled to execute.

I'm fixing this in a simplistic but not very elegant way, by just looping until
taskq_dispatch() succeeds.

Signed-off-by: Ricardo M. Correia <ricardo.correia@oracle.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2010-08-02 13:12:54 -07:00
Brian Behlendorf 7195d18e6a Reduce stack using in ZVOL
The dmu_object_info_t structures which are roughly 60 bytes
have been moved from the stack to the heap.  Every little
bit helps and there's absolutely no reason these temporary
working variables need to be on the stack.
2010-08-02 11:51:21 -07:00
Brian Behlendorf 88b37fbe57 Fix zvol_init() lock inversion
During module load we could deadlock because the zvol_init()
callpath took the spa_namespace_lock before the zvol_state_lock.
The rest of the zvol code takes the locks in the opposite order.
In particular, I observed the following deadlock cause by the
lock inversion.

I've fixed the ording by creating an unlocked version of
zvol_create_minor and zvol_remove_minor.  This allows me to
take the zvol_state_lock before the spa_namespace_lock in
zvol_cr_minors_common and simply call the unlocked version.
2010-08-02 11:50:04 -07:00
Brian Behlendorf f162433deb Minor device creation/removal (Kernel)
With the update to onnv_141 how minor devices were created and
removed for ZVOL was substantially changed.  The updated system
is much more tightly integrated with Solaris's /dev/ filesystem.
This is great for Solaris but bad for Linux.

On the kernel side the ZFS_IOC_{CREATE,REMOVE}_MINOR ioctl
entry points have been re-added.  They now call directly in
to the ZVOL to create the needed minor node and add the sysfs
entried for udev.

Also as part of this change I've decided it would really be
best if all the zvols were in a /dev/zvol directory like on
Solaris.  Organizationally this makes sense and on the code
side it allows us to know a block device is a zvol simply by
where it is located in /dev/.  Unless Solaris there still is
to ./dsk or ./rdsk as part of the path.
2010-08-02 11:49:08 -07:00
Brian Behlendorf 96ae916dbe Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-07-28 16:52:38 -07:00
Brian Behlendorf 9662934bd9 Add uninstall Makefile targets
Extend the Makefiles with an uninstall target to cleanly
remove a package which was installed with 'make install'.

Additionally, ensure a 'depmod -a' is run as part of the
install to update the module dependency information.
2010-07-28 16:47:26 -07:00
Brian Behlendorf 0e533b7459 Best effort for minor device removal.
We should just make a best effort when removing zvol minors
from the system during destroy.  Failure here should never
prevent the pool from being destroyed.  For example, if a
pool is so heavily damaged it cannot be opened (part of the
minor removal) we still want to be able to destroy it.  The
worst case here is we may orphan a few minors but even that
is unlikely and not particularly harmful.
2010-07-21 14:20:56 -07:00
Brian Behlendorf 49c7595ad8 Replace SBUG with PANIC macro
The SBUG macro has been removed from the SPL and replaced
with PANIC which is closer to an existing API.  Simply
update the usage in vdev_disk.c.
2010-07-20 13:36:50 -07:00
Brian Behlendorf fc3e47c6d4 Corrently handle return code in blk_end_request_x
This was caught under Debian Lenny builds because they are one of
the few/only current distros based on a 2.6.26 kernel.  In one
of the build conditionals I accidently failed to assign the
return code to rc before returning.
2010-07-14 12:45:16 -07:00
Brian Behlendorf 45cb33f64f Ensure devices are always created/removed
Devices were only being created at module load time or when a
dataset was created.  Similiar devices were not always being
removed at all the correct times.  This patch updates all the
places where devices should either be created or removed.  I'm
reasonably sure I got them all but if theres a case I missed
we can catch it with a follow up patch.

        module load/unload
        zfs create/remove
        zpool import/export
        zpool destroy

This patch also adds a simple regression test to zconfig.sh
to ensure zpool import/export is basically working properly.
This test specifically checks that devices are created
properly, removed after export, created after import, and
removed as a consequence of a zpool destroy.
2010-07-02 12:21:39 -07:00
Brian Behlendorf 122e5b44e1 Add missing mutex_exit(&zvol_state_lock)
With the recent ZVOL update zvol_set_volblocksize() accidentally
lost its mutex_exit().  This was noticed when zvol_create_minor()
blocked on the zvol_state_lock while it was holding the
spa_namespace_lock().  This caused everything to get blocked
up and hung the system.
2010-07-02 12:19:54 -07:00
Brian Behlendorf f5cb411fc1 Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-06-29 16:58:01 -07:00
Brian Behlendorf 5387c446cf Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-06-29 16:57:41 -07:00
Brian Behlendorf f28ca65b92 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-29 16:57:41 -07:00
Brian Behlendorf 015677660a Merge branch 'fix-stack-traverse_visitbp' into refs/top-bases/fix-branch 2010-06-29 16:57:39 -07:00
Brian Behlendorf f20301b41b Minor fix to ensure tv_depth is there when debugging is disabled. 2010-06-29 16:52:42 -07:00
Brian Behlendorf 68b79f258d Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-06-29 11:12:17 -07:00
Brian Behlendorf 2eceb0c47a Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-29 11:12:00 -07:00
Brian Behlendorf b0c8dc3c75 Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-06-29 11:11:59 -07:00
Brian Behlendorf 46b2d46053 Merge branch 'fix-stack-traverse_visitbp' into refs/top-bases/fix-branch 2010-06-29 11:04:51 -07:00
Brian Behlendorf 34229a2f2a Reduce stack usage for recursive traverse_visitbp()
Due to  limited stack space recursive functions are frowned upon in
the Linux kernel.  However, they often are the most elegant solution
to a problem.  The following code preserves the recursive function
traverse_visitbp() but moves the local variables AND function
arguments to the heap to minimize the stack frame size.  Enough
space is initially allocated on the stack for 20 levels of recursion.
This change does ugly-up-the-code but it reduces the worst case
usage from roughly 4160 bytes to 960 bytes on x86_64 archs.
2010-06-29 11:04:26 -07:00
Brian Behlendorf 67850fa14f Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-06-29 11:00:12 -07:00
Brian Behlendorf 0a2b049259 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-29 10:59:54 -07:00
Brian Behlendorf ffeafc898e Merge branch 'fix-branch' into refs/top-bases/zfs-branch
Conflicts:

	cmd/ztest/ztest.c
2010-06-29 10:55:38 -07:00
Brian Behlendorf b873e71b0f Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-06-29 10:29:42 -07:00
Brian Behlendorf 192b36dcfd Merge branch 'gcc-uninit' into refs/top-bases/gcc-branch 2010-06-29 10:25:31 -07:00
Brian Behlendorf 9cdd80e387 Revert traverse_impl() changes
These changes are now taken care of by the fix-stack-traverse_impl
topic branch which not only solves the uninit problem but also
moves these locals off the stack and on to the heap.
2010-06-29 10:24:14 -07:00
Brian Behlendorf 96bd9f434d Merge branch 'fix-stack-traverse_impl' into refs/top-bases/fix-branch 2010-06-29 10:21:53 -07:00
Brian Behlendorf 8e2de85a6d Reduce stack usage of traverse_impl()
Stack use reduced from 560 bytes to 128 bytes.
2010-06-29 10:21:21 -07:00
Brian Behlendorf 51a936233f Merge branch 'fix-stack-dsl_dataset_destroy' into refs/top-bases/fix-branch 2010-06-29 10:12:03 -07:00
Brian Behlendorf 7334572416 Reduce stack usage by dsl_dataset_destroy()
Move dsl_dataset_t local variable from the stack to the heap.
This reduces the stack usage of this function from 2048 bytes
to 176 bytes for x84_64 arches.
2010-06-29 10:11:32 -07:00
Brian Behlendorf f32ec2346b Linux bcopy() requires word aligned memory, use memcpy()
Much to my surprise bcopy() under Linux appears to copy the data in
word sized chunks.  It does the right thing but if you buffer is not
a multiple of the word size you will be reading past the end of your
buffer.  Or at least that is what valgrind is reporting.  We should
be using mempcy() anyway on Linux so replace bcopy() with memcpy()
to resolve the issue.

==305== Thread 211:
==305== Invalid read of size 8
==305==    at 0x3BCD28357D: _wordcopy_fwd_dest_aligned (in /lib64/libc-2.11.1.so)
==305==    by 0x3BCD282B05: bcopy (in /lib64/libc-2.11.1.so)
==305==    by 0x58D7FEF: dmu_write (dmu.c:730)
==305==    by 0x591C942: spa_history_write (spa_history.c:165)
==305==    by 0x591D255: spa_history_log_sync (spa_history.c:277)
==305==    by 0x591D545: log_internal (spa_history.c:450)
==305==    by 0x591D5EC: spa_history_log_internal (spa_history.c:475)
==305==    by 0x5902319: dsl_prop_set_sync (dsl_prop.c:707)
==305==    by 0x5906A7D: dsl_sync_task_group_sync (dsl_synctask.c:199)
==305==    by 0x58FF4EC: dsl_pool_sync (dsl_pool.c:376)
==305==    by 0x591744C: spa_sync (spa.c:5365)
==305==    by 0x5922C85: txg_sync_thread (txg.c:414)
2010-06-28 11:26:20 -07:00
Brian Behlendorf a6411d4033 Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-06-28 10:36:38 -07:00
Brian Behlendorf 744af7fa00 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-28 10:36:20 -07:00
Brian Behlendorf 191d5e833a Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-06-28 10:36:19 -07:00
Brian Behlendorf 8ec85f8aee Merge branch 'fix-stack-dmu_objset_snapshot' into refs/top-bases/fix-branch 2010-06-28 10:36:17 -07:00
Brian Behlendorf 1a967e146f Merge branch 'fix-taskq' into refs/top-bases/fix-branch 2010-06-28 10:36:16 -07:00
Brian Behlendorf df8d7829a8 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-06-28 10:36:13 -07:00
Brian Behlendorf ef3ec1c9ed Merge branch 'gcc-uninit' into refs/top-bases/gcc-branch 2010-06-28 10:36:11 -07:00
Brian Behlendorf 52bb0d8e75 Ensure zio_bad_cksum_t is initialized
This may not strictly be needed but it does keep gcc happy.  We
should keep our eye on this though if the extra bcopy significantly
impacts performance.  It may.
2010-06-28 10:30:38 -07:00
Brian Behlendorf d6ea5e8cef Additional ZVOL cleanup in zvol_set_volsize()
The following cleanup was missed in the first pass when the ZVOL
implementation was updated.  An extra instance of a zvol_state_t
was removed from the stack and the error handling was simplified.
2010-06-28 10:21:24 -07:00
Brian Behlendorf 6914386b85 Never sleep under taskq_dispatch()
There are cases where under Linux it is not safe to sleep in
taskq_dispatch().  Rather than adding Linux specific code to
detect these cases I opted to keep it simple and just never
allow a sleep here.  The impact of this should be minimal.
2010-06-28 10:11:12 -07:00
Brian Behlendorf 0c11631b02 Fix for fix-stack-dmu_objset_snapshot should be 'sn' not '&sn'
I missed a instanse of removing the & operator when reducing the
stack usage in this function.  This unfortunately doesn't cause
a compile warning but it is does cause ztest failures.  Anyway,
update the topic branch to correct this mistake.
2010-06-28 10:06:29 -07:00
Brian Behlendorf 4aba89bb16 Merge commit 'refs/top-bases/linux-kernel-disk' into linux-kernel-disk 2010-06-16 14:43:35 -07:00
Brian Behlendorf 2f457b7bd0 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-16 14:43:17 -07:00
Brian Behlendorf 8de2671680 Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-06-16 14:43:17 -07:00