Commit Graph

1390 Commits

Author SHA1 Message Date
Brian Behlendorf e8856c2879 Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-21 12:04:42 -07:00
Brian Behlendorf e0e0bac5a6 Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch 2009-10-21 12:04:19 -07:00
Brian Behlendorf aec988734b Command 'zpool create' needs to wait on correct partition names.
When creating partition tables we always need to wait until not
only the /dev/<disk><part> device appears.  But just as importantly
if we were originally given a udev path we need to wait for the
/dev/disk/*/<name>-part<part> symlink to be created.  However,
since the partition naming convention differs between /dev/ and
/dev/disk we determine based on the path which convention to
expect and then wait (for a few seconds) for the device to be
created.  Based on my experience with udev on my test nodes it
takes about 300ms for the devices to be created after being
prompted by the kernel.  This time will vary somehwat based
on how complicated your udev rules are, so for safety I threw
in a factor of 10.  We wait 3 seconds for the devices to appears
before erroring out with a failure.

An additional minor fix includes checking the force flag in the
EFI_GPT_PRIMARY_CORRUPT case.  This allows you to force the
update even in the corrupt partition case.

Finally, since these are Linux only changes I've dropped the
devid code entirely here because I still can't think of why we
would need or want it on a Linux system.
2009-10-21 11:50:42 -07:00
Brian Behlendorf 021879aad4 Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-19 14:06:14 -07:00
Brian Behlendorf 3129860fb1 Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch 2009-10-19 14:06:11 -07:00
Brian Behlendorf 5be28776fb Always preserve the passed path at creation time so udev may be used
After spending considerable time thinking about this I've come to the
conclusion that on Linux systems we don't need Solaris style devid
support.  Instead was can simply use udev if we are careful, there
are even some advantages.

The Solaris style devid's are designed to provide a mechanism by which
a device can be opened reliably regardless of it's location in the system.
This is exactly what udev provides us on Linux, a flexible mechanism for
consistently identifing the same devices regardless of probing order.
We just need to be careful to always open the device by the path provided
at creation time, this path must be stored in ZPOOL_CONFIG_PATH.  This
in fact has certain advantages.

For example, if in your system you always want the zpool to be able to
locate the disk regardless of physical location you can create the pool
using /dev/disk/by-id/.  This is perhaps what you'ld want on a desktop
system where the exact location is not that important.  It's more
critical that all the disks can be found.

However, in an enterprise setup there's a good chace that the physical
location of each drive is important.  You have like set things up such
that your raid groups span multiple hosts adapters, such that you can
lose an adapter without downtime.  In this case you would want to use
the /dev/disk/by-path/ path to ensure the path information is preserved
and you always open the disks at the right physical locations.  This
would ensure your system never gets accidently misconfigured and still
just works because the zpool was still able to locate the disk.

Finally, if you want to get really fancy you can always create your
own udev rules.  This way you could implement whatever lookup sceme
you wanted in user space for your drives.  This would include nice
cosmetic things like being able to control the device names in tools
like zpool status, since the name as just based of the device names.

I've yet to come up with a good reason to implement devid support on
Linux since we have udev.  But I've still just commented it out for now
because somebody might come up with a really good I forgot.
2009-10-19 13:46:48 -07:00
Brian Behlendorf 69c211131d Refresh autogen products 2009-10-15 16:46:45 -07:00
Brian Behlendorf 126f4128e2 Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-15 16:46:01 -07:00
Brian Behlendorf 295d45555e Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch 2009-10-15 16:45:13 -07:00
Brian Behlendorf 48d1b0c5ab Cleanly integrate ZFS tools with libblkid.
The majority of this this patch concerns itself with doing a direct
replacement of Solaris's libdiskmgt library with libblkid+libefi.
You'll notice that this patch removes all libdiskmgt code instead of
ifdef'ing it out.  This was done to minimize any confusion when reading
the code because it seems unlikely we will ever port libdiskmgt to Linux.

Despite the replacement the behavior of the tools should have remained
the same with one exception.  For the moment, we are unable to check
the partitions of devices which have an MBR style partition table when
creating a filesystem.  If a non-efi partition sceme is detected on a
whole disk device we prompt the user to explicity use the force option.
It would not be a ton of work to make the tool aware of MBR style
partitions if this becomes a problem.

I've done basic sanity checking for various configurations and all
the issues I'm aware of have been addressed.  Even things like blkid
misidentifing a disk as ext3 when it is added to a zfs pool.  I'm
careful to always zero out the first 4k of any new zfs partition.  That
all said this is all new code and while it looks like it's working right
for me we should keep an eye on it for any strange behavior.
2009-10-15 16:28:47 -07:00
Brian Behlendorf ee1de79aa3 Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-14 16:54:45 -07:00
Brian Behlendorf 553e366ce5 Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch 2009-10-14 16:54:42 -07:00
Brian Behlendorf 22925be29c Add in missing header required by libefi. 2009-10-14 16:50:26 -07:00
Brian Behlendorf 4a704a81ac Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-14 16:32:19 -07:00
Brian Behlendorf c4726e7ad2 Merge branch 'linux-user-disk' into refs/top-bases/linux-zfs-branch 2009-10-14 16:32:16 -07:00
Brian Behlendorf 992be351d5 Changes required to integrate libefi in to Linux.
The major change here is to fix up libefi to be linux aware.  For
the most part this wasn't too hard but there were a few major issues.

First off I needed to handle the DKIOCGMEDIAINFO and DKIOCINFO ioctls.
There is no direct equivilant for these ioctls under linux.  To handle
this I added wrapper functions which under Solaris simple call the ioctls.
But under Linux dig around the system a little bit getting the needed
info to fill in the requested structures.

Secondly the efi_ioctl() call was adapted such that under linux it directly
read or writes out the partition table.  Under Solaris this work was
handed off to the kernel via an ioctl.  In the efi_write() case we also
ensure we prompt the kernel via BLKRRPART to re-scan the new partition
table.  The libefi generated partition tables are correct but older
versions of ~parted-1.8.1 can not read them without a small patch.
The kernel and fdisk are able to read them just fine.

Thirdly efi_alloc_and_init() which is used by zpool to determine if a
device is a 'wholedisk' was updated to be linux aware.  This check is
performed by using the partition number for the device, which the
partition number is 0 on linux it is a 'wholedisk'.  However, certain
device type such as the loopback and ram disks needed to be excluded
because they do not support partitioning.

Forthly the zpool command was made symlink aware so it can correctly
resolve udev entries such as /dev/disk/by-*/*.  This symlinks are
fully expanded ensuring all block devices are recognized.  When a
when a 'wholedisk' block device is detected we now properly write
out an efi label and place zfs in the first partition (0th slice).
This partition is created 1MiB in to the disk to ensure it is aligned
nicely with all high end block devices I'm aware of.

This all works for me now but it did take quite a bit of work to get
it all sorted out.  It would not surprise me if certain special cases
were missed so we should keep any eye of for any odd behavior.
2009-10-14 16:07:48 -07:00
Brian Behlendorf d1e18d0e3b Refresh autogen products 2009-10-14 16:00:33 -07:00
Brian Behlendorf 81609e1773 Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-14 15:59:46 -07:00
Brian Behlendorf f4f805a70e Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch 2009-10-14 15:59:13 -07:00
Brian Behlendorf 84ed1fee34 Merge commit 'refs/top-bases/linux-libspl' into linux-libspl 2009-10-14 15:59:11 -07:00
Brian Behlendorf 245e7692f7 Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2009-10-14 15:58:55 -07:00
Brian Behlendorf aa587c8437 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2009-10-14 15:57:13 -07:00
Brian Behlendorf 085ed9fe82 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2009-10-14 15:57:10 -07:00
Brian Behlendorf cb678c0b31 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2009-10-14 15:57:09 -07:00
Brian Behlendorf a8adb61c00 Merge branch 'gcc-ident-pragmas' into refs/top-bases/gcc-branch 2009-10-14 15:57:08 -07:00
Brian Behlendorf 8a905e7dcc Update vtoc.h header and add missing mhd.h header needed by libefi. 2009-10-14 15:52:24 -07:00
Brian Behlendorf 39d85a8b94 Remove pragmas from new libefi files. 2009-10-14 15:44:22 -07:00
Brian Behlendorf 00c6a706a5 Refresh autogen products 2009-10-09 16:46:19 -07:00
Brian Behlendorf 8dc5609e72 Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-09 16:44:47 -07:00
Brian Behlendorf 9fb47da60f Merge commit 'refs/top-bases/linux-libspl' into linux-libspl 2009-10-09 16:44:10 -07:00
Brian Behlendorf 81ec3f8951 Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2009-10-09 16:43:53 -07:00
Brian Behlendorf 8b6b31f3e4 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2009-10-09 16:42:09 -07:00
Brian Behlendorf cb91bbe6ce Additional set of build system tweaks for libefi library. 2009-10-09 16:37:32 -07:00
Brian Behlendorf f0ac8537ff Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-09 16:23:16 -07:00
Brian Behlendorf cae4a99504 Merge branch 'linux-libspl' into refs/top-bases/linux-zfs-branch 2009-10-09 16:23:13 -07:00
Brian Behlendorf d7e242199c Header efi_partition.h moved to lib/libefi/include/sys/ 2009-10-09 16:18:39 -07:00
Brian Behlendorf 28cdfd90ef Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-09 16:13:31 -07:00
Brian Behlendorf fc2213dfac Merge commit 'refs/top-bases/linux-libspl' into linux-libspl
Conflicts:

	lib/Makefile.am
2009-10-09 16:12:49 -07:00
Brian Behlendorf 7c073d0a7d Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2009-10-09 16:09:54 -07:00
Brian Behlendorf a740d2a8f7 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch
Conflicts:

	lib/Makefile.am
2009-10-09 16:06:51 -07:00
Brian Behlendorf a0337cfcd8 Add libefi library in to the build system. 2009-10-09 15:58:45 -07:00
Brian Behlendorf b04c6f54b9 Merge commit 'refs/top-bases/linux-configure-branch' into linux-configure-branch 2009-10-09 15:46:16 -07:00
Brian Behlendorf 746882c100 Merge commit 'refs/top-bases/linux-libspl' into linux-libspl 2009-10-09 15:45:38 -07:00
Brian Behlendorf 503c5eeb2d Merge commit 'refs/top-bases/linux-user-disk' into linux-user-disk 2009-10-09 15:45:22 -07:00
Brian Behlendorf 90b0761a16 Merge branch 'linux-docs' into refs/top-bases/linux-zfs-branch 2009-10-09 15:43:37 -07:00
Brian Behlendorf e0e0f0ea84 Merge commit 'refs/top-bases/zfs-branch' into zfs-branch 2009-10-09 15:43:33 -07:00
Brian Behlendorf 9302f90662 Merge branch 'gcc-branch' into refs/top-bases/zfs-branch 2009-10-09 15:42:56 -07:00
Brian Behlendorf 926a2e3cc4 Merge commit 'refs/top-bases/gcc-ident-pragmas' into gcc-ident-pragmas 2009-10-09 15:42:48 -07:00
Brian Behlendorf 3728b6d9c1 Merge branch 'gcc-c90' into refs/top-bases/gcc-branch 2009-10-09 15:42:16 -07:00
Brian Behlendorf 1b0e5a1485 Merge commit 'refs/top-bases/gcc-c90' into gcc-c90 2009-10-09 15:42:15 -07:00