Commit Graph

1309 Commits

Author SHA1 Message Date
Brian Behlendorf feb723fa7d Merge branch 'linux-events' into refs/top-bases/linux-zfs-branch 2010-05-14 12:55:10 -07:00
Brian Behlendorf 97d19a5e45 Add linux-events topic branch for zevent handling.
This topic branch leverages the Solaris style FMA call points
in ZFS to create a user space visible event notification system
under Linux.  This new system is called zevent and it unifies
all previous Solaris style ereports and sysevent notifications.

Under this Linux specific scheme when a sysevent or ereport event
occurs an nvlist describing the event is created which looks almost
exactly like a Solaris ereport.  These events are queued up in the
kernel when they occur and conditionally logged to the console.
It is then up to a user space application to consume the events
and do whatever it likes with them.

To make this possible the existing /dev/zfs ABI has been extended
with two new ioctls which behave as follows.

* ZFS_IOC_EVENTS_NEXT
Get the next pending event.  The kernel will keep track of the last
event consumed by the file descriptor and provide the next one if
available.  If no new events are available the ioctl() will block
waiting for the next event.  This ioctl may also be called in a
non-blocking mode by setting zc.zc_guid = ZEVENT_NONBLOCK.  In the
non-blocking case if no events are available ENOENT will be returned.
It is possible that ESHUTDOWN will be returned if the ioctl() is
called while module unloading is in progress.  And finally ENOMEM
may occur if the provided nvlist buffer is not large enough to
contain the entire event.

* ZFS_IOC_EVENTS_CLEAR
Clear are events queued by the kernel.  The kernel will keep a fairly
large number of recent events queued, use this ioctl to clear the
in kernel list.  This will effect all user space processes consuming
events.

The zpool command has been extended to use this events ABI with the
'events' subcommand.  You may run 'zpool events -v' to output a
verbose log of all recent events.  This is very similar to the
Solaris 'fmdump -ev' command with the key difference being it also
includes what would be considered sysevents under Solaris.  You
may also run in follow mode with the '-f' option.  To clear the
in kernel event queue use the '-c' option.

$ sudo cmd/zpool/zpool events -fv
TIME                        CLASS
May 13 2010 16:31:15.777711000 ereport.fs.zfs.config.sync
        class = "ereport.fs.zfs.config.sync"
        ena = 0x40982b7897700001
        detector = (embedded nvlist)
                version = 0x0
                scheme = "zfs"
                pool = 0xed976600de75dfa6
        (end detector)

        time = 0x4bec8bc3 0x2e5aed98
        pool = "zpios"
        pool_guid = 0xed976600de75dfa6
        pool_context = 0x0

While the 'zpool events' command is handy for interactive debugging
it is not expected to be the primary consumer of zevents.  This ABI
was primarily added to facilitate the addition of a user space
monitoring daemon.  This daemon would consume all events posted by
the kernel and based on the type of event perform an action.  For
most events simply forwarding them on to syslog is likely enough.
But this interface also cleanly allows for more sophisticated
actions to be taken such as generating an email for a failed drive
2010-05-14 12:40:44 -07:00
Brian Behlendorf 6ae8aa39ab Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2010-05-14 10:59:57 -07:00
Brian Behlendorf 20ee89f0f2 Add nvpair_alloc_fixed.c in to libnvpair build. 2010-05-14 10:55:02 -07:00
Brian Behlendorf 3809bc6ac5 Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch 2010-05-14 10:44:12 -07:00
Brian Behlendorf 9b8aa5f57e Extend libspl as required for linux FMA integration.
These changes lay some of the ground work for supporting something
similar to FMA event under Solaris.  In particular these changes
add or modify the following areas.

First off an implementation of the gethrestime() function is added
to libspl.  Secondly, the missing type processorid_t has been added.
And finally the lib/libspl/include/sys/fm/{protocol.h|util.h} stub
headers have been removed in favor of updating the full versions
in module/zfs/include/sys/fm/{protocol.h|util.h} to work cleanly
in both user and kernel space.
2010-05-14 10:33:00 -07:00
Brian Behlendorf 8e870b63d0 Merge branch 'linux-have-sysevent' into refs/top-bases/linux-zfs-branch 2010-04-29 13:15:30 -07:00
Brian Behlendorf d6f1146154 Remove changes from linux-have-sysevent to prepare for topic branch removal. 2010-04-29 13:12:25 -07:00
Brian Behlendorf 35afc56620 Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch 2010-04-29 12:33:39 -07:00
Brian Behlendorf c14cca5c07 Add fm_init/fm_fini stubs for user space FMA update. 2010-04-29 12:25:18 -07:00
Brian Behlendorf 0ff721ce5d Merge commit 'refs/top-bases/linux-libspl' into linux-libspl 2010-04-29 11:02:17 -07:00
Brian Behlendorf 208e42ffe6 Merge commit 'refs/top-bases/linux-have-sysevent' into linux-have-sysevent 2010-04-29 11:01:23 -07:00
Brian Behlendorf ea12ca13bf Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module 2010-04-29 11:01:22 -07:00
Brian Behlendorf 76d877a211 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2010-04-29 11:00:49 -07:00
Brian Behlendorf 4d5d0f9ef5 Include FMA source and headers in build system 2010-04-29 10:55:27 -07:00
Brian Behlendorf fb427cf371 Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch 2010-03-23 14:58:27 -07:00
Brian Behlendorf ee2a998f37 Move zfs_config.h include to command line -include
Remove the few places in the code where zfs_config.h is included.
It is now added to the gcc compile line to ensure the config results
2010-03-23 14:54:00 -07:00
Brian Behlendorf 20894b4487 Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch 2010-03-10 12:09:33 -08:00
Brian Behlendorf c7c19c1259 Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch 2010-03-10 12:09:32 -08:00
Ricardo M. Correia 2c79a2fa6a Fix a few zdb bugs when trying to open a pool
Specifically, the following bugs are fixed in this patch:

1) zdb wasn't getting the correct device size when the vdev is a
block device.  In Solaris, fstat64() returns the device size but
in Linux an ioctl() is needed.

2) We were opening block devices with O_DIRECT, which caused pread64()
to fail with EINVAL due to memory alignment issues.  This was fixed by
the previous umem cache alignment fix in stub implementation to align
objects correctly.  But we still needed to add a check for the error here.

3) We also make sure that we don't try to open a block device in write
mode in userspace.  This shouldn't happen, because zdb opens devices
in read-only mode, and ztest only uses files.
2010-03-10 12:03:48 -08:00
Ricardo M. Correia c557557e4a Add umem_alloc_aligned() and honor cache_align field for umem caches
Under linux we open block devices with O_DIRECT which means we must
provide aligned memory buffers.  This patch adds the needed umem
interfaces or in the case of caches simply honors alignment provided
at cache creation time.
2010-03-10 11:51:43 -08:00
Brian Behlendorf 3670186d0a Merge commit 'refs/top-bases/linux-libspl' into linux-libspl 2010-03-10 09:59:28 -08:00
Brian Behlendorf 1186ea3781 Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2010-03-10 09:59:14 -08:00
Brian Behlendorf 724a450233 Merge commit 'refs/top-bases/linux-have-sysevent' into linux-have-sysevent 2010-03-10 09:58:38 -08:00
Brian Behlendorf c1c14c18c8 Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module 2010-03-10 09:58:37 -08:00
Brian Behlendorf a97cedc2df Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2010-03-10 09:58:07 -08: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
Brian Behlendorf 166355dcf0 Merge branch 'fix-error-handling' into refs/top-bases/fix-branch 2010-03-10 09:54:43 -08:00
Ricardo M. Correia 62a0ac8f22 Fix some incorrect error handling.
In vn_open(), if fstat64() returned an error, the real errno
was being obscured by calling close().

Add error handling for both pwrite64() calls in vn_rdwr().
2010-03-10 09:53:53 -08:00
Brian Behlendorf 6521b99461 Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch 2010-03-09 13:43:29 -08:00
Ricardo M. Correia f1c8b3a435 Fix duplicate uuid_t typedef.
This typedef is being done in both lib/libefi/include/sys/uuid.h and
/usr/include/uuid/uuid.h, both of which are included in lib/libefi/rdwr_efi.c.

This leads to the following error:

In file included from ../../lib/libefi/include/sys/efi_partition.h:29,
                 from ../../lib/libefi/rdwr_efi.c:41:
../../lib/libefi/include/sys/uuid.h:81: error: redefinition of typedef 'uuid_t'
/usr/include/uuid/uuid.h:19: note: previous declaration of 'uuid_t' was here

The reason that we didn't see this before, is because of a strange feature in
gcc where some types of warnings/errors are silently ignored if they come from
system headers. But depending on the order of how system headers end up
included, libefi's uuid.h may actually be included after uuid/uuid.h, which
leads to the error above.

It is safe to remove this duplicate typedef because we are already
dependent on the linux uuid.h header and it's exceptionally unlikely
they will ever change the size.
2010-03-09 13:38:55 -08:00
Brian Behlendorf fdab6de381 Merge commit 'refs/top-bases/linux-libspl' into linux-libspl 2010-03-09 12:31:32 -08:00
Brian Behlendorf 4b2b113239 Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2010-03-09 12:31:18 -08:00
Brian Behlendorf feac56bf5a Merge commit 'refs/top-bases/linux-have-sysevent' into linux-have-sysevent 2010-03-09 12:30:44 -08:00
Brian Behlendorf 17a96f44f3 Merge commit 'refs/top-bases/linux-kernel-module' into linux-kernel-module 2010-03-09 12:30:43 -08:00
Brian Behlendorf 573328741b Merge branch 'linux-have-fm' into refs/top-bases/linux-zfs-branch 2010-03-09 12:30:21 -08:00
Brian Behlendorf 8f63d438cd Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2010-03-09 12:30:18 -08:00
Brian Behlendorf 48e74ed68b Merge branch 'feature-branch' into refs/top-bases/zfs-branch
Conflicts:

	cmd/ztest/ztest.c
2010-03-09 12:30:03 -08:00
Brian Behlendorf 9a3d5378c6 Clean up emulation of kernel threads in userspace.
Updated to use pthread thread specific data rather than keeping
a global list.  This also fixes at least one easily reproducible
crash in ztest
2010-03-09 12:25:28 -08:00
Brian Behlendorf 2feb4008e6 Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch 2009-11-20 12:12:33 -08:00
Brian Behlendorf aebe6818a9 Linux ZVOL implementation; user-side changes
At last a useful user space interface for the Linux ZFS port arrives.
With the addition of the ZVOL real ZFS based block devices are available
and can be compared head to head with Linux's MD and LVM block drivers.
The Linux ZVOL has not yet had any performance work done but from a user
perspective it should be functionally complete and behave like any other
Linux block device.

The ZVOL has so far been tested using zconfig.sh on the following x86_64
based platforms: FC11, CHAOS4, RHEL5, RHEL6, and SLES11.  However, more
testing is required to ensure everything is working as designed.

What follows in a somewhat detailed list of changes includes in this
commit to make ZVOL's possible.  A few other issues were addressed in
the context of these changes which will also be mentioned.

* zvol_create_link_common() simplified to simply issue to ioctl to
create the device and then wait up to 10 seconds for it to appear.
The device will be created within a few miliseconds by udev under
/dev/<pool>/<volume>.  Note this naming convention is slightly
different than on Solaris by I feel is more Linuxy.

* Removed support for dump vdevs.  This concept is specific to Solaris
and done not map cleanly to Linux.  Under Linux generating system cores
is perferably done over the network via netdump, or alternately to a
block device via O_DIRECT.
2009-11-20 12:00:08 -08:00
Brian Behlendorf e576375b9f Merge branch 'linux-have-zpl' into refs/top-bases/linux-zfs-branch 2009-11-15 16:11:05 -08:00
Brian Behlendorf e588ef08cb Revert contents of linux-have-zpl topic branch. 2009-11-15 16:06:10 -08:00
Brian Behlendorf d876a087ff Merge branch 'linux-have-zvol' into refs/top-bases/linux-zfs-branch 2009-11-15 15:58:22 -08:00
Brian Behlendorf b38252d3ec Revert contents of linux-have-zvol topic branch. 2009-11-15 15:52:29 -08:00
Brian Behlendorf a5485c5560 Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch 2009-11-02 14:16:19 -08:00
Brian Behlendorf 238511d277 Add missing sys/dktp/*.h headers to package. 2009-11-02 14:08:08 -08:00
Brian Behlendorf 22c51d6136 Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch 2009-10-27 15:03:46 -07:00
Brian Behlendorf a9accbcb57 Always open using O_EXCL to ensure the device is not in use.
Allow partition tables on md devices but not dm- devices.
2009-10-27 14:58:12 -07:00