Commit Graph

82 Commits

Author SHA1 Message Date
Brian Behlendorf dfc166d174 Limit sysfs name to KOBJ_NAME_LEN
It appears that in earlier kernels the maximum name length of a
kobject was KOBJ_NAME_LEN (20) bytes.  This was later extended to
dynamically allocate enough memory if it was over KOBJ_NAME_LEN,
and finally it was always made dynamic.  Unfortunately, util this
last step happened it doesn't look like it always safe to use
names larger than KOBJ_NAME_LEN.  For example, under the RHEL5
2.6.18 kernel if the kobject name length exceeds KOBJ_NAME_LEN
a NULL dereference is tripped.

To avoid this issue the build system has been update to check
to see if KOBJ_NAME_LEN is defined.  If it is we have to assume
the maximum kobject name length is only 20 bytes.  This 20 byte
name must minimally include the following components.

  <zpool>/<dataset>[@snapshot[partition]]
2010-08-09 16:44:41 -07:00
Brian Behlendorf 1510a95acd Add splat module to zfs.sh script
The splat module is only needed for the spl regression tests.
But if we add it to MODULES then 'zfs.sh -u' will be able to
unload it if needed,  The downside if 'zfs.sh' will always
load it but it's overhead is minimal and in a production
setting you'll always be doing a 'modprobe zfs' anyway so
this is really just for testing.
2010-07-28 16:47:30 -07:00
Brian Behlendorf 0f237a4379 Add Debian and Slackware style packaging via alien
The long term fix for Debian and Slackware style packaging is
to add native support for building these packages.  Unfortunately,
that is a large chunk of work I don't have time for right now.
That said it would be nice to have at least basic packages for
these distributions.

As a quick short/medium term solution I've settled on using alien
to convert the RPM packages to DEB or TGZ style packages.  The
build system has been updated with the following build targets
which will first build RPM packages and then convert them as
needed to the target package type:

  make rpm: Create .rpm packages
  make deb: Create .deb packages
  make tgz: Create .tgz packages
  make pkg: Create the right package type for your distribution

The solution comes with lot of caveats and your mileage may vary.
But basically the big limitations are that the resulting packages:

  1) Will not have the correct dependency information.
  2) Will not include the kernel version in the release.
  3) Will not handle all differences between distributions.

But the resulting packages should be easy to install and remove
from your system and take care of running 'depmod -a' and such.
As I said at the top this is not the right long term solution.
If any of the upstream distribution maintainers want to jump in
and help do this right for their distribution I'd love the help.
2010-07-28 09:37:04 -07:00
Ned Bass 16a9f68137 Autoconf check for buggy stack guard region
Some buggy NPTL threading implementations include the guard area within
the stack size allocations.  In this case we need to allocate an extra
page to account for the guard area since we only have two pages of usable
stack on Linux.  Added an autoconf test that detects such implementations
by running a test program designed to segfault if the bug is present.
Set a flag NPTL_GUARD_WITHIN_STACK that is tested to decide if extra
stack space must be allocated for the guard area.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2010-07-23 11:35:20 -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 548c9c6829 Use $target_cpu instead of `arch`
We should not be using arch for a few reasons.  First off it might
not be installed on their system, and secondly they may be trying
to cross-compile.
2010-07-14 12:44:42 -07:00
Brian Behlendorf d81440c8ab Check sourcelink is set before passing to readlink
When no source was found in any of the expected paths treat
this as fatal and provide the user with a hint as to what
they should do.
2010-07-14 12:44:37 -07:00
Brian Behlendorf dccff58e11 Only make compiler warnings fatal with --enable-debug
While in theory I like the idea of compiler warnings always being
fatal.  In practice this causes problems when small harmless errors
cause build failures for end users.  To handle this I've updated
the build system such that -Werror is only used when --enable-debug
is passed to configure.  This is how I always build when developing
so I'll catch all build warnings and end users will not get stuck
by minor issues.
2010-07-14 10:41:48 -07:00
Lars Johannsen 77f748fd1c Allow config/build to work with autoconf-2.65
As of autoconf-2.65 the AC_LANG_SOURCE source macro no longer
includes the confdef.h results when expanded.  To handle this
simply explicitly include confdef.h in conftest.c.  This will
cause two copies to of confdef.h to be added to the test for
earlier autoconf versions but this is not harmful.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2010-07-02 13:56:00 -07:00
Brian Behlendorf 61119d3f5b Linux-2.6.33 compat, check <generated/utsrelease.h> for UTS_RELEASE
It seems the upstream community moved the definition of UTS_RELEASE
yet again as of linux-2.6.33.  Update the build system to check in
all three possible locations where your kernel version may be defined.

    $kernelbuild/include/linux/version.h
    $kernelbuild/include/linux/utsrelease.h
    $kernelbuild/include/generated/utsrelease.h
2010-07-01 20:43:36 -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 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 b974e4bf4d Fix error message to reference the new libuuid package.
It used to be the case that libuuid was part of e2fsprogs.  However,
since other projects unrelated to e2fsprogs make use of that library
it was getting aukward to have that dependency.  The package was
split from e2fsprogs and moved to its own devel package in the
util-linux-ng project.  Anyway, I'm just updating the error message
to reflect the new upstream reality.
2010-05-20 10:00:03 -07:00
Brian Behlendorf 4e7fd8ff9d Move build system and core script changes to correct zfs-branch. 2010-05-18 15:05:44 -07:00
Brian Behlendorf 13ad721a84 Move user-arch.m4 change from linux-libspl to zfs-branch. 2010-05-18 12:26:48 -07:00
Brian Behlendorf d69cfcab40 Add top level SPL include path which is needed for *-devel builds 2010-04-22 09:55:07 -07:00
Brian Behlendorf 23ab272555 Add support for 'make -s' silent builds
The cleanest way to do this is to set AM_LIBTOOLFLAGS = --silent.  However,
AM_LIBTOOLFLAGS is not honored by automake-1.9.6-2.1 which is what I have
been using.  To cleanly handle this I am updating to automake-1.11-3 which
is why it looks like there is a lot of churn in the Makefiles.
2010-03-26 15:41:41 -07:00
Brian Behlendorf e96be1888a Allow zfs_config.h to be included by dependant packages (updated)
We need dependent packages to be able to include zfs_config.h to
build properly.  This was partially solved previously be using
AH_BOTTOM to #undef common #defines (PACKAGE, VERSION, etc) which
autoconf always adds and cannot be easily removed.  This solution
works as long as the zfs_config.h is included before your projects
config.h.  That turns out to be easier said than done.  In particular,
this is a problem when your package includes its config.h using the
-include gcc option which ensures the first thing included is your
config.h.

To handle all cases cleanly I have removed the AH_BOTTOM hack and
replaced it with an AC_CONFIG_HEADERS command.  This command runs
immediately after zfs_config.h is written and with a little awk-foo
it strips the offending #defines from the file.  This eliminates
the problem entirely and makes header safe for inclusion.
2010-03-22 16:42:18 -07:00
Brian Behlendorf e7b3766a69 Remove udev dependency when running in-tree
After much contemplation I can't see a clean way to use udev entirely
in-tree for testing.  This patch removed a horrible horrible hack which
would copy the needed udev bits in to place on your system to make it
work.  That however is simply not acceptable, nothing you in in-tree
should ever ever ever install something on your system.

Since I could not come up with a clean way to use udev in-tree.  The
fix is to simply parse the zdev config file and create the needed
symlinks in a sub-diretory or your working tree.  This is not as clean
as using udev but it does work perfectly well for in-tree testing.
2010-03-11 13:56:20 -08:00
Brian Behlendorf 369293803b Allow recursive configure/make
Previously the ZFS configure was dependent on a correct Module{s}.symvers
file which is generated as one of the last steps of the full SPL build.
This meant you could not do a recursive configure because this will
configure all sub-packages before building any of them.

To resolve this issue the ZFS code has been updated to make a very
educated guess as to this file name at configure time.  This means
SPL_SYMBOLS may still be used in various places in the build system
such as modules/Makefile.in.  But we do give up the ability to
seemlessly detect symbols exported by the SPL at ZFS configure time.
At the moment this is not as issue, hopefully it will stay that way.
2010-03-11 09:45:23 -08:00
Brian J. Murrell 3f30f74414 Check for spl in ../spl if not found in install path
If the spl source could not be found in /usr/src/spl-*, also try to
find it in ../spl.  This makes finding it in a development sandbox
more natural.
2010-03-08 16:04:25 -08:00
Brian J. Murrell 0ec3b7e122 When no kernel source has been pointed to, first attempt to use
/lib/modules/$(uname -r)/source.  This will likely fail when building
under a mock (http://fedoraproject.org/wiki/Projects/Mock) chroot
environment since `uname -r` will report the running kernel which
likely is not the kernel in your chroot.  To cleanly handle this
we fallback to using the first kernel in your chroot.

The kernel-devel package which contains all the kernel headers and
a few build products such as Module.symver{s} is all the is required.
Full source is not needed.
2010-03-08 14:53:13 -08:00
Brian Behlendorf fd7578215e Configure checks for kernel build options incompatible with the license
Twice now I've been bitten by building agaist a kernel which is
configured such that it is incompatible with the CDDL license.  These
build failures don't occur until the linking phase at which point they
simply callout the offending symbol.  No location information can be
provided at this point so it often can be confusing what the problem is
particularly when building against a new kernel for the first time.

To help address this I've added a configure check which can be extended
over time to detect known kernel config options which if set will break
the ZFS build.  Currently I have just added CONFIG_DEBUG_LOCK_ALLOC which
makes mutex's GPL-only and is on by default in the RHEL6 alpha builds.
I know for a fact there are other similiar options which can be added
as they are encountered.
2010-03-08 10:27:42 -08:00
Brian Behlendorf 7df02c0f57 Split the udev rule from a specific configuration
While I completely agree the udev is the lesser of many possibles
evils when solving the device issue... it is still evil.  After
attempting to craft a single rule which will work for various
versions of udev in various distros.  I've come to the conclusion
the only maintainable way to solve this issue is to split the rule
from any particular configuration.

This commit provides a generic 60-zpool.rules file which use a
small helper util 'zpool_id' to parse a configuration file by
default located in /etc/zfs/zdev.conf.  The helper script maps
a by-path udev name to a more friendly name of <channel><rank>
for large configurations.

As part of this change all of the support scripts why rely on
this udev naming convention have been updated as needed.  Example
zdev.conf files have also been added for 3 different systems by
you will always need to add one for your exact hardware.

Finally, included in these changes are the proper tweaks to the
build system to ensure everything still get's packaged properly
in the rpms and can run in or out of tree.
2010-03-01 16:51:21 -08:00
Brian Behlendorf c824f39f95 Add a check for the fmode_t type.
This typedef first appears in 2.6.28 kernels as part of some
block device operation reworking.
2009-12-23 14:42:32 -08:00
Brian Behlendorf c8bd25ac98 Add 'srpm' --with-config option for creation of spec files. 2009-11-24 14:13:25 -08:00
Brian Behlendorf 6fabeffd3b Additional ZVOL compatibility autoconf checks and zconfig ZVOL sanity test. 2009-11-20 10:04:56 -08:00
Brian Behlendorf 915205a6e8 Add autoconf checks for zvol integration. 2009-11-16 10:31:10 -08:00
Brian Behlendorf 9ee04032de Linux 2.6.31 logical block size compatibility.
Autoconf check for bdev_logical_block_size() helper which replaced
bdev_hardsect_size() as the correct way to get the sector size.
2009-11-12 12:49:01 -08:00
Brian Behlendorf 5bf14d3400 Update zpool-configs to be udev aware.
To simplify creation and management of test configurations the
dragon and x4550 configureis have been integrated with udev.  Our
current best guess as to how we'll actually manage the disks in
these systems is with a udev mapping scheme.  The current leading
scheme is to map each drive to a simpe <CHANNEL><RANK> id.  In
this mapping each CHANNEL is represented by the letters a-z, and
the RANK is represented by the numbers 1-n.  A CHANNEL should
identify a group of RANKS which are all attached to a single
controller, each RANK represents a disk.  This provides a nice
mechanism to locate a specific drive given a known hardware
configuration.  Various hardware vendors use a similar scheme.

A nice side effect of these changes is it allowed me to make
the raid0/raid10/raidz/raidz2 setup functions generic.  This
makes adding new test configs easy, you just need to create
a udev rules file for your test config which conforms to the
naming scheme.
2009-10-21 11:38:51 -07:00
Brian Behlendorf a09d33e929 Update build system for libblkid integration 2009-10-15 16:25:18 -07:00
Brian Behlendorf 09a8c99097 Additional build system update for libefi library.
This include updating all the Makefile.am to have the correct
include paths and libraries.  In addition, the zlib m4 macro was
updated to more correctly integrate with the Makefiles.  And I
added two new macros libblkid and libuuid which will be needed by
subsequent commits for blkid and uuid support respectively.  The
blkid support is optional, the uuid support is mandatory for libefi.
2009-10-14 15:47:41 -07:00
Brian Behlendorf cb91bbe6ce Additional set of build system tweaks for libefi library. 2009-10-09 16:37:32 -07:00
Brian Behlendorf 4f555da51d Add zfs-test package which includes test infrastructure.
This change extends the existing in-tree test infrastructure such
that it can also be run as part of a the installed package.  This
simplifies testing on multiple systems and is generally all around
useful.  The scripts may still be run in-tree and will use the
in-tree build products as long as .script-config exists.
2009-08-17 21:35:06 -07:00
Brian Behlendorf 9cabcac115 Required autoconf support for vdev_disk integration with 2.6.30 kernels.
2.6.22 API change
Unused destroy_dirty_buffers arg removed from prototype.

2.6.24 API change
Empty write barriers are now supported and we should use them.

2.6.24 API change
Size argument dropped from bio_endio and bi_end_io, because the
bi_end_io is only called once now when the request is complete.
There is no longer any need for a size argument.  This also means
that partial IO's are no longer possibe and the end_io callback
should not check bi->bi_size.  Finally, the return type was updated
to void.

2.6.28 API change
open/close_bdev_excl() renamed to open/close_bdev_exclusive().

2.6.29 API change
BIO_RW_SYNC renamed to BIO_RW_SYNCIO.
2009-07-29 17:14:23 -07:00
Brian Behlendorf 3a431c68c2 Remove LINUXINCLUDE from autoconf wrapper, breaks 2.6.28+ kernels.
Modern kernel build systems at least post 2.6.16 will set this properly
so we should not.  In fact post 2.6.28 the include headers have moved
under arch so the guess we make here is completely wrong.  Letting
the kernel build system set this ensure it will be correct.  Also
drop the ulimit from the Makefile which, not surprisingly, turns out
to be very non-portable.  If your expecting failures set the ulimit
in your shell before kicking off the test suite.
2009-07-27 10:39:28 -07:00
Brian Behlendorf 18ffe73d3f Check arch/default/ path when detecting kernel objects on SLES
We still preferentially use arch/arch looking for a native version
but if that fails it is acceptable to use default.
2009-07-24 16:26:17 -07:00
Brian Behlendorf f984d28e0c Cleanly handle --with-linux=NONE and --with-spl=NONE options
when used to generate source rpms.  These should not be fatal
because we actually don't need them until we build the source
rpm.  When doing mock build this is important because these
dependent rpms will only be installed if they are specificed
in the source rpms spec file.
2009-07-02 10:44:43 -07:00
Brian Behlendorf ef0a712858 Distro friendly build system / packaging improvements.
These changes bring the zfs-0.4.4 tree in to compliance with
the spl-0.4.4 packaging changes.  The bottom line is 2 source
rpms and 4 binary rpms will now be generated when creating
packages there will be:

zfs-<version>.src.rpm
- Fully rebuildable source rpm for libzfs and utils.
zfs-modules-<version>.src.rpm
- Fully rebuildable source rpm for kernel modules.

zfs-<version>.<arch>.rpm
- Binary rpm for libzfs and utils.  The utils in this package are
  compatible with all zfs-module rpms of the same version.
zfs-devel-<version>.<arch>.rpm
- Binary rpm containing headers for building against libzfs libraries.

zfs-modules-<verion>-<kernel>.arch.rpm
- Binary rpm containing the kernel modules for a specific kernel build.
  The package name contains the kernel version and you should have one
  of these packages installed to match every kernel on your system.
zfs-modules-devel-<verion>-<kernel>.arch.rpm
- Binary rpm containing development header and module symbols needed
  for building additional kernel modules which are dependent on the
  zfs module stack.

Expect minor interations on these changes as I validate they work
properly on CHAOS, RHEL, Fedora, and SLES style distros.
2009-07-01 10:53:05 -07:00
Brian Behlendorf 0f1012be0a Add basic zlib autoconf check for user space build. 2009-06-09 16:09:17 -07:00
Brian Behlendorf 999035eb32 Only powerpc64 is currently supported not powerpc. 2009-06-09 14:20:44 -07:00
Brian Behlendorf 9c347d872f Core target arch support for conditional compilation of SUBDIRs
which is used by libspl for it's arch specific atomic implementations.
2009-06-08 16:07:43 -07:00
Brian Behlendorf 119a28815f - Update build system to SPL_META_VERSION not VERSION.
- ZFS_LINUX_COMPILE_IFELSE drop explicit CC and force the kernel build
  system to set it this ensure -m64 is set only when appropriate.
2009-05-22 14:49:41 -07:00
Brian Behlendorf d855b57b7c SLES Fixes (Part 1):
- ZFS_AC_KERNEL updated to exclude -obj entries in /usr/src/ when
  attempting to automatically detect your kernel source.
- ZFS_AC_KERNEL check for *-obj directory when attempting to
  detect the objects for your kernel source.
- ZFS_AC_SPL updated to additionally check for Modules.symvers build
  product.  This seems to be specific to SLES system, for Vanilla,
  Fedora, RHEL, and Chaos kernels the symbol file is just called
  Module.symvers.
- ZFS_CHECK_SYMBOL_EXPORT also should also check the exported SPL
  symbols in addition to the exported core kernel systems.
2009-05-22 09:26:36 -07:00
Brian Behlendorf f8764e9947 Add NONE option for --with-linux and --with-spl.
This is used when you need to configure the project but you don't
actually intend to build it.  Thus you don't really need access to
either the kernel or spl headers and symbols.  At Livermore I use
this when I only intend to use the 'make dist' or 'make srpm' target.
2009-03-12 16:31:28 -07:00
Brian Behlendorf f2e7d57653 Packaging update
Make LINUX_VERSION available to Makefile's, add packaging
for user space include headers.
2009-03-12 15:07:29 -07:00
Brian Behlendorf 74432ad2fb Remove remaining compiler flags for disabling specific compiler checks.
All these errors are now either addressed in a gcc-* topic branch, or
in whatever branch the original warning was introduced by (i.e. I fixed
the bug which just went unnoticed until now due to the compiler flags)
2009-03-12 10:55:56 -07:00
Brian Behlendorf 031709f9d5 Remove --Wno-unused and -Wno-missing braces gcc-* patches have been
added to address these issues.  Other instances unused variables will
be addressed in the topic branch which caused the problem.
2009-03-11 22:12:00 -07:00
Brian Behlendorf 64119ce40d Remove -Wno-parentheses this is handled by the gcc-no-parentheses branch. 2009-03-11 13:59:34 -07:00
Brian Behlendorf 4e945fb768 Remove -Wno-unknown-pragmas compile option, all unknown pragmas
have been removed by the gcc-ident-pragmas topic branch.
2009-03-11 13:14:08 -07:00