Commit Graph

175 Commits

Author SHA1 Message Date
Brian Behlendorf acd6237623 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-07-21 10:08:25 -07:00
Brian Behlendorf f39882ec1f Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-07-21 10:08:24 -07:00
Brian Behlendorf a2cf158872 Merge branch 'fix-stack-ztest' into refs/top-bases/fix-branch 2010-07-21 10:08:22 -07:00
Ned Bass 75d868af70 Fixed typo that set thread STACK_SIZE to 24k instead of 8k
__linux__ was mispelled as _linux_ so #ifdef was always
selecting the Solaris STACK_SIZE value.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2010-07-21 10:04:21 -07:00
Brian Behlendorf 6d72cb7326 Fix pthread stack size on 32-bit platforms
For some reason which remains mysterious to me the shared library
which calls pthread_create() must be linked with -pthread.  If this
is not done on 32-bit system the default ulimit stack size is used.
Surprisingly, on a 64-bit system the stack limit specified by the
pthread_attr is honored even when -pthread is not passed when linking
the shared library.
2010-07-21 09:59:39 -07:00
Brian Behlendorf 6f1eda0629 Add configure check for -Wframe-larger-than=<size>
It turns out the gcc option -Wframe-larger-than=<size> which I recently
added to the build system is not supported in older versions of gcc.
Since this is just a flag to ensure I keep stack usage under control
I've added a configure check to detect if gcc supports it.  If it's
available we use it in the proper places, if it's not we don't.
2010-06-29 16:53:02 -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 d2585f5921 Merge branch 'fix-stack-vn_open' into refs/top-bases/fix-branch 2010-06-29 10:15:05 -07:00
Brian Behlendorf edbb93c11d Reduce stack usage by vn_open()
We should not put a 4k maxpathlen buffer on the stack, instead
locate it to the heap.  Even in user space we run ztest with 8K
2010-06-29 10:14:37 -07:00
Brian Behlendorf aa90238713 Merge branch 'fix-pthreads' into refs/top-bases/fix-branch 2010-06-29 10:12:03 -07:00
Brian Behlendorf 9af7aa53eb Set stack frame limit
For all module/library functions ensure so stack frame exceeds 1024
bytes.  Ideally this should be set lower to say 512 bytes but there
are still numerous functions which exceed even this limit.  For now
this is set to 1024 to ensure we catch the worst offenders.

Additionally, set the limit for ztest to 1024 bytes since the idea
here is to catch stack issues in user space before we find them by
overrunning a kernel stack.  This should also be reduced to 512
bytes as soon as all the trouble makes are fixed.

Finally, add -fstack-check to gcc build options when --enable-debug
is specified at configure time.  This ensures that each page on the
stack will be touched and we will generate a segfault on stack
overflow.

Over time we can gradually fix the following functions:

536 zfs:dsl_deadlist_regenerate
536 zfs:dsl_load_sets
536 zfs:zil_parse
544 zfs:zfs_ioc_recv
552 zfs:dsl_deadlist_insert_bpobj
552 zfs:vdev_dtl_sync
584 zfs:copy_create_perms
608 zfs:ddt_class_contains
608 zfs:ddt_prefetch
608 zfs:__dprintf
616 zfs:ddt_lookup
648 zfs:dsl_scan_ddt
696 zfs:dsl_deadlist_merge
736 zfs:ddt_zap_walk
744 zfs:dsl_prop_get_all_impl
872 zfs:dnode_evict_dbufs
2010-06-29 10:08:48 -07:00
Brian Behlendorf 6fe1e37a5e Additional pthread related fixes for ztest
There are 3 fixes in thie commit.  First, update ztest_run() to store
the thread id and not the address of the kthread_t.  This will be freed
on thread exit and is not safe to use.  This is pretty close to how
things were done in the original ztest code before I got there.

Second, for extra paranoia update thread_exit() to return a special
TS_MAGIC value via pthread_exit().  This value is then verified in
pthread_join() to ensure the thread exited cleanly.  This can be
done cleanly because the kthread doesn't provide a return code
mechanism we need to worry about.

Third, replace the ztest deadman thread with a signal handler.  We
cannot use the previous approach because the correct behavior for
pthreads is to wait for all threads to exit before terminating the
process.  Since the deadman thread won't call exit by design we
end up hanging in kernel_exit().  To avoid this we just setup a
SIGALRM signal handle and register a deadman alarm.  IMHO this
is simpler and cleaner anyway.
2010-06-29 10:06:09 -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 ee53c67258 Merge branch 'fix-pthreads' into refs/top-bases/fix-branch 2010-06-28 10:36:17 -07:00
Brian Behlendorf a2e73b7516 Allow joinable threads
There was previous discussion of a race with joinable threads but to
be honest I can neither exactly remember the race, or recrease the
issue.  I believe it may have had to do with pthread_create() returning
without having set kt->tid since this was done in the created thread.
If that was the race then I've 'fixed' it by ensuring the thread id
is set in the thread AND as the first pthread_create() argument.  Why
this wasn't done originally I'm not sure, with luck Ricardo remembers.

Additionally, explicitly set a PAGESIZE guard frame at the end of the
stack to aid in detecting stack overflow.  And add some conditional
logic to set STACK_SIZE correctly for Solaris.
2010-06-28 10:15:29 -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
Brian Behlendorf a2ba5b83f8 Merge branch 'fix-stack-noinline' into refs/top-bases/fix-branch 2010-06-16 14:35:14 -07:00
Brian Behlendorf bbdb8184ec Add fix-stack-noinline topic branch
Certain function must never be automatically inlined by gcc because
they are stack heavy or called recursively.  This patch flags all
such functions I have found as 'noinline' to prevent gcc from making
the optimization.
2010-06-16 14:34:41 -07:00
Brian Behlendorf 48ca6d3590 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-16 14:27:31 -07:00
Brian Behlendorf 7f979b27f4 Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-06-16 14:27:30 -07:00
Brian Behlendorf 30c03a0914 Merge branch 'fix-stack' into refs/top-bases/fix-branch 2010-06-16 14:27:29 -07:00
Brian Behlendorf 2115c30515 Revert fix-stack topic branch
This patch will be broken in to several independent stack reductions
and reapplied as new topic branches.
2010-06-16 14:23:31 -07:00
Brian Behlendorf 08060ef853 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-14 16:25:02 -07:00
Brian Behlendorf eb894076a4 Merge branch 'fix-branch' into refs/top-bases/zfs-branch
Conflicts:

	cmd/ztest/ztest.c
2010-06-14 16:24:45 -07:00
Brian Behlendorf 2969945552 Merge branch 'fix-pthreads' into refs/top-bases/fix-branch 2010-06-14 16:22:00 -07:00
Brian Behlendorf f9f342c5f2 Add fix-pthreads topic branch
This is a portability change which removes the dependence of the Solaris
thread library.  All locations where Solaris thread API was used before
have been replaced with equivilant Solaris kernel style thread calls.
In user space the kernel style threading API is implemented in term of
the portable pthreads library.  This includes all threads, mutexs,
condition variables, reader/writer locks, and taskqs.
2010-06-14 16:20:44 -07:00
Brian Behlendorf c430e23552 Update zfs-branch with build system updates
Required Makefile modifications for updated ZFS code.
2010-06-14 15:46:11 -07:00
Brian Behlendorf 812761eac5 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch
Conflicts:
	cmd/ztest/ztest.c
2010-05-28 15:46:10 -07:00
Brian Behlendorf e27754d9e8 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch
Conflicts:
	cmd/ztest/ztest.c
	lib/libzfs/libzfs_sendrecv.c
	module/zfs/dmu_objset.c
	module/zfs/dnode.c
	module/zfs/dnode_sync.c
	module/zfs/dsl_dataset.c
	module/zfs/include/sys/dmu_tx.h
	module/zfs/include/sys/txg.h
	module/zfs/spa_history.c
2010-05-28 15:45:38 -07:00
Brian Behlendorf 3e2be634a5 Merge branch 'gcc-c90' into refs/top-bases/gcc-branch
Conflicts:
	cmd/zdb/zdb.c
	cmd/zdb/zdb_il.c
	cmd/zfs/zfs_main.c
	cmd/zfs/zfs_util.h
	cmd/zinject/zinject.h
	cmd/zpool/zpool_main.c
	cmd/zpool/zpool_util.c
	cmd/ztest/ztest.c
	lib/libnvpair/include/libnvpair.h
	lib/libnvpair/libnvpair.c
	lib/libzfs/libzfs_changelist.c
	lib/libzfs/libzfs_config.c
	lib/libzfs/libzfs_dataset.c
	lib/libzfs/libzfs_import.c
	lib/libzfs/libzfs_mount.c
	lib/libzfs/libzfs_pool.c
	lib/libzfs/libzfs_sendrecv.c
	module/avl/avl.c
	module/avl/include/sys/avl.h
	module/nvpair/include/sys/nvpair.h
	module/nvpair/nvpair.c
	module/zcommon/include/zfs_comutil.h
	module/zcommon/include/zfs_prop.h
	module/zcommon/zfs_comutil.c
	module/zfs/arc.c
	module/zfs/dbuf.c
	module/zfs/dmu.c
	module/zfs/dmu_objset.c
	module/zfs/dmu_zfetch.c
	module/zfs/dnode_sync.c
	module/zfs/dsl_dataset.c
	module/zfs/dsl_pool.c
	module/zfs/dsl_prop.c
	module/zfs/dsl_synctask.c
	module/zfs/include/sys/dmu_tx.h
	module/zfs/include/sys/dmu_zfetch.h
	module/zfs/include/sys/dsl_synctask.h
	module/zfs/include/sys/refcount.h
	module/zfs/include/sys/txg.h
	module/zfs/include/sys/uberblock.h
	module/zfs/include/sys/zap_leaf.h
	module/zfs/include/sys/zfs_debug.h
	module/zfs/include/sys/zfs_znode.h
	module/zfs/include/sys/zio_compress.h
	module/zfs/include/sys/zvol.h
	module/zfs/lzjb.c
	module/zfs/metaslab.c
	module/zfs/refcount.c
	module/zfs/sha256.c
	module/zfs/spa.c
	module/zfs/spa_boot.c
	module/zfs/uberblock.c
	module/zfs/vdev.c
	module/zfs/zap_micro.c
	module/zfs/zfs_ioctl.c
	module/zfs/zfs_replay.c
	module/zfs/zio.c
	module/zfs/zio_compress.c
2010-05-28 15:34:57 -07:00
Brian Behlendorf 89089d1e4b Merge commit 'refs/top-bases/fix-stack' into fix-stack
Conflicts:
	module/zfs/dmu_objset.c
	module/zfs/spa_history.c
2010-05-28 13:54:08 -07:00
Brian Behlendorf 31630287ca Merge branch 'fix-dbuf_dirty_record_t' into refs/top-bases/fix-branch
Conflicts:
	lib/libzfs/libzfs_sendrecv.c
	module/zfs/dmu_objset.c
	module/zfs/dnode.c
	module/zfs/dsl_dataset.c
	module/zfs/spa_history.c
2010-05-28 13:51:29 -07:00
Brian Behlendorf 428870ff73 Update core ZFS code from build 121 to build 141. 2010-05-28 13:45:14 -07:00
Brian Behlendorf 06da6ccf97 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-05-28 12:42:30 -07:00
Brian Behlendorf 818eafca5b Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-05-28 12:42:30 -07:00
Brian Behlendorf c91169c7c5 Merge branch 'gcc-shadow' into refs/top-bases/gcc-branch
Conflicts:
	lib/libzfs/libzfs_util.c
2010-05-28 12:42:27 -07:00
Brian Behlendorf fb72c6ef81 Revert gcc-shadow using -Wno-shadow I can live with
While I would rather fix all the instances where something is shadowed
it complicates tracking the OpenSolaris code where they either don't
seem to care or have different conflicts.  Anyway, this ends up being
more simply gratutous change than I care for.
2010-05-28 12:34:45 -07:00
Brian Behlendorf ea431b4dc6 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-05-27 16:14:04 -07:00
Brian Behlendorf 319f69734b Merge branch 'feature-branch' into refs/top-bases/zfs-branch
Conflicts:
	cmd/ztest/ztest.c
2010-05-27 16:13:19 -07:00
Brian Behlendorf 390995db28 Revert all remaining changes. 2010-05-27 14:25:06 -07:00
Brian Behlendorf c17d3e05eb Merge branch 'feature-branch' into refs/top-bases/zfs-branch 2010-05-27 13:32:58 -07:00
Brian Behlendorf 51536ea5f4 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-05-27 13:32:58 -07:00
Brian Behlendorf a082023842 Merge commit 'refs/top-bases/feature-branch' into feature-branch
Conflicts:
	cmd/ztest/ztest.c
	lib/libzpool/include/sys/zfs_context.h
	lib/libzpool/kernel.c
	lib/libzpool/taskq.c
2010-05-27 13:30:48 -07:00
Brian Behlendorf 099e8e493a Remove feature-pthreads prior to b141 update.
The pthreads change will need to be reworked and reapplied.
This will be easier to do from scratch rather than sort out
the merge.
2010-05-27 13:23:58 -07:00
Brian Behlendorf 4d5d0f9ef5 Include FMA source and headers in build system 2010-04-29 10:55:27 -07:00
Brian Behlendorf 7223b8df33 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-03-10 09:58:04 -08:00
Brian Behlendorf 54cf7ab2bc Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-03-10 09:58:03 -08:00