Commit Graph

937 Commits

Author SHA1 Message Date
Brian Behlendorf ec04ed0fbb Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-08-02 13:53:00 -07:00
Brian Behlendorf fd164fdb40 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-08-02 13:52:57 -07:00
Brian Behlendorf 5d145c70f1 Merge branch 'fix-branch' into refs/top-bases/zfs-branch 2010-08-02 13:52:56 -07:00
Brian Behlendorf 8d443f35c4 Merge branch 'fix-stack-ztest' into refs/top-bases/fix-branch 2010-08-02 13:49:04 -07:00
Ned Bass bb20b03060 Move ztest_od_t structures to the heap
A number of ztest functions create one or more 312B ztest_od_t data
structures.  To conserve stack usage, this commit moves all of these data
structures to the heap.  However, I am still seeing ztest segfaults due
to heavy stack usage of the dbuf_findbp() -> dbuf_hold_impl() recursion.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2010-08-02 13:42:25 -07:00
Brian Behlendorf 9f24ae6b22 Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-07-23 10:43:58 -07:00
Brian Behlendorf 7fa6f8b93a Restrict usage of -fstack-check option
The stack check implementation in older versions of gcc has
a fairly low default limit on STACK_CHECK_MAX_FRAME_SIZE of
roughly 4096.  This results in numerous warning when it is
used with code which was designed to run in user space and
thus may be relatively stack heavy.  The avoid these warnings,
which are fatal with -Werror, this patch targets the use of
-fstack-check to libraries which are compiled in both user
space and kernel space.  The only utility which uses this
flag is ztest which is designed to simulate running in the
kernel and must meet the -fstack-check requirements.  All
other user space utilities do not use -fstack-check.

  warning: frame size too large for reliable stack checking
  warning: try reducing the number of local variables
2010-07-23 10:38:07 -07:00
Brian Behlendorf 39f3185fed Merge branch 'linux-events' into refs/top-bases/linux-zfs-branch 2010-07-21 12:50:17 -07:00
Brian Behlendorf 5951864035 Minor formatting fix to align columns
$ sudo ./cmd/zpool/zpool events
TIME                           CLASS
Jul 21 2010 11:36:14.682122000 resource.fs.zfs.statechange
Jul 21 2010 11:36:14.705809000 resource.fs.zfs.statechange
2010-07-21 12:51:07 -07:00
Brian Behlendorf 99ffebbafd Merge commit 'refs/top-bases/linux-events' into linux-events 2010-07-12 10:25:05 -07:00
Brian Behlendorf 220644fcb3 Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-07-12 10:23:08 -07:00
Brian Behlendorf 99694a2e81 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-07-12 10:23:05 -07:00
Brian Behlendorf 4b576456c7 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-07-12 10:23:04 -07:00
Brian Behlendorf b1ac2755a0 Merge branch 'gcc-fortify-source' into refs/top-bases/gcc-branch 2010-07-12 10:23:03 -07:00
Brian Behlendorf 007b891fc7 Fix -Werror=format-security compiler option
Noticed under Ubuntu kernel builds, there were two instances where
printf() was not called with a "%s" and instread directly printed
the string.  This can potentially result in a crash and is considered
bad form by gcc.  It has been fixed by adding the needed "%s".
2010-07-12 10:11:48 -07:00
Brian Behlendorf dc6723965d Merge commit 'refs/top-bases/linux-events' into linux-events 2010-07-01 10:44:09 -07:00
Brian Behlendorf a20538168a Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-07-01 10:42:04 -07:00
Brian Behlendorf 7f54d558c9 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-07-01 10:42:01 -07:00
Brian Behlendorf 428d8d8a9b Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-07-01 10:42:00 -07:00
Brian Behlendorf 049a26b800 Merge branch 'gcc-fortify-source' into refs/top-bases/gcc-branch 2010-07-01 10:41:59 -07:00
Brian Behlendorf 3b54f5030e Use VERIFY() for asprintf due to rpm -D_FORTIFY_SOURCE=2
This check is part of ztest and a memory failure here is unlikely.
However, if this does occur simply exiting is an perfectly valid
way to handle the issue and it resulves the compiler warning.

        ztest.c:5522: error: ignoring return value of 'asprintf',
        declared with attribute warn_unused_result
2010-07-01 10:35:11 -07:00
Brian Behlendorf e983ee681f Merge commit 'refs/top-bases/linux-events' into linux-events 2010-06-29 16:59:40 -07:00
Brian Behlendorf 9c4837d5da Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-06-29 16:57:45 -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 fe14b6802a Merge branch 'linux-ztest' into refs/top-bases/linux-zfs-branch 2010-06-29 13:43:26 -07:00
Brian Behlendorf 82360d2362 Move local variables to heap
We were already modifing this function so it would run in the
local development environment, so let's just do the stack fixes
here are well.  It's all simple enough.
2010-06-29 13:09:51 -07:00
Brian Behlendorf b2fa7c143c Merge commit 'refs/top-bases/linux-events' into linux-events 2010-06-29 11:36:30 -07:00
Brian Behlendorf 43088d22ad Merge commit 'refs/top-bases/linux-ztest' into linux-ztest 2010-06-29 11:35:56 -07:00
Brian Behlendorf 8af57a28ce Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-06-29 11:34:42 -07:00
Brian Behlendorf 5fd2bd24a7 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-29 11:34:38 -07:00
Brian Behlendorf a0796cadf7 Merge branch 'fix-branch' into refs/top-bases/zfs-branch
Conflicts:

	cmd/ztest/ztest.c
2010-06-29 11:34:31 -07:00
Brian Behlendorf 0efc05dd6f Merge branch 'fix-stack-ztest' into refs/top-bases/fix-branch 2010-06-29 11:28:36 -07:00
Brian Behlendorf ef01098ef4 Reduce stack used by ztest
While ztest does run in user space we run it with the same stack
restrictions it would have in kernel space.  This ensures that any
stack related issues which would be hit in the kernel can be caught
and debugged in user space instead.

This patch is a first pass to limit the stack usage of every ztest
function to 1024 bytes.  Subsequent updates can further reduce this
2010-06-29 11:25:08 -07:00
Brian Behlendorf f13bc68113 Merge commit 'refs/top-bases/linux-events' into linux-events 2010-06-29 11:01:46 -07:00
Brian Behlendorf e6bcb5c246 Merge commit 'refs/top-bases/linux-ztest' into linux-ztest 2010-06-29 11:01:11 -07:00
Brian Behlendorf b8229898ab Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-06-29 10:59:58 -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 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 90fa1ce7d6 Merge commit 'refs/top-bases/linux-events' into linux-events 2010-06-28 11:32:19 -07:00
Brian Behlendorf f44dd08b58 Merge branch 'linux-ztest' into refs/top-bases/linux-zfs-branch 2010-06-28 11:31:50 -07:00
Brian Behlendorf 01f2707edd Merge commit 'refs/top-bases/linux-ztest' into linux-ztest 2010-06-28 11:31:48 -07:00
Brian Behlendorf 5b33cbea31 Merge branch 'linux-have-mntent' into refs/top-bases/linux-zfs-branch 2010-06-28 11:30:39 -07:00
Brian Behlendorf 843af873bf Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-06-28 11:30:36 -07:00
Brian Behlendorf 17a1689bd4 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2010-06-28 11:30:35 -07:00
Brian Behlendorf c2793dd0c7 Merge branch 'gcc-missing-braces' into refs/top-bases/gcc-branch 2010-06-28 11:30:34 -07:00
Brian Behlendorf 882ec504ea Minor ztest fixes
Move create/destroy function to correct places.  I'm not sure why
this wasn't caught upstream it should have been, regardless let's
just fix it here.

Personally I find it handy to be able to enable full debugging in
zfs with the 'debug=' command line option so I'm enabled that as
well.
2010-06-28 11:23:50 -07:00
Brian Behlendorf 5b02d6c084 Zero struct for zdb dump_block_stats
Accidentally dropped the zeroing of this structure in the
gcc-missing-braces topic branch which was causing a fall positive
space leak in ztest.  Ensure the structure is zero'ed before use.
2010-06-28 10:48:24 -07:00