summaryrefslogtreecommitdiffstats
path: root/scripts
Commit message (Collapse)AuthorAgeFilesLines
* zpool-create.sh: allow features to be disabledBrian Behlendorf2014-07-2530-60/+66
| | | | | | | | | | | | | | | | The zimport.sh script makes use of the zpool-create.sh script to construct test pools for importing with older versions of ZoL. It is desirable to have a way to disable all the features so new pools can be imported with older code. The simplest and most flexible way to achieve this was to merge the VERBOSE_FLAG and FORCE_FLAG in to a single ZPOOL_FLAGS variable. The contents of this variable will be used in the 'zpool create' allowing us to easily pass arbitrary flags. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Prakash Surya <[email protected]> Closes #2524
* Set LANG to a reasonable default (C)Turbo Fredriksson2014-06-101-1/+1
| | | | | | | | | Set LANG=C before calling 'rpmbuild' to avoid rpmbuild failing on the translated date string in the changelog. Signed-off-by: Turbo Fredriksson <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes: zfsonlinux/spl#306
* Various zimport.sh fixesBrian Behlendorf2014-04-171-26/+31
| | | | | | | | | | | | | | 1) $SPLSRC and $SRCDIR should be changed to $SRC_DIR. These are vestiges of an earlier version of the script and were missed when it was updated. Additionally ensure the directory is created. 2) The 'fail' function should take an integer argument for the error code to return. Otherwise 0 (success) will be mistakenly returned and errors will we incorrectly suppressed. The error code should be meaningful enough to determine where the script failed. Signed-off-by: Brian Behlendorf <[email protected]>
* Make zimport.sh bash dependency explicitBrian Behlendorf2014-04-101-1/+1
| | | | | | | | Unfortunately, the zimport.sh test script really does depend on bash. Moving to /bin/sh should be possible once the shared infrastructure scripts it depends on is made portable. Signed-off-by: Brian Behlendorf <[email protected]>
* Improve zfs.sh error messagesBrian Behlendorf2014-04-102-4/+8
| | | | | | | | | Ensure an error message is logged when the 'zfs.sh' script fails to either load a module or if udev fails to create the /dev/zfs device. Error messages for missing KERNEL_MODULES are suppressed because that functionality may just be built-in to the kernel. Signed-off-by: Brian Behlendorf <[email protected]>
* Dynamically create loop devicesBrian Behlendorf2014-04-091-12/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | Several of the in-tree regression tests depend on the availability of loop devices. If for some reason no loop devices are available the tests will fail. Normally this isn't an issue because most Linux distributions create 8 loop devices by default. This is enough for our purposes. However, recent Fedora releases have only been creating a single loop device and this leads to failures. Alternately, if something else of the system is using the loop devices we may see failures. The fix for this is to update the support scripts to dynamically create loop devices as needed. The scripts need only create a node under /dev/ and the loop driver with create the minor. This behavior has been supported by the loop driver for ages. Additionally this patch updates cleanup_loop_devices() to cleanup loop devices which have already had their file store deleted. This helps prevent stale loop devices from accumulating on the system due to test failures. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Prakash Surya <[email protected]> Closes #2249
* Initial implementation of zed (ZFS Event Daemon)Chris Dunlap2014-04-022-0/+10
| | | | | | | | | | | | | | | | | | | | | | | zed monitors ZFS events. When a zevent is posted, zed will run any scripts that have been enabled for the corresponding zevent class. Multiple scripts may be invoked for a given zevent. The zevent nvpairs are passed to the scripts as environment variables. Events are processed synchronously by the single thread, and there is no maximum timeout for script execution. Consequently, a misbehaving script can delay (or forever block) the processing of subsequent zevents. Plans are to address this in future commits. Initial scripts have been developed to log events to syslog and send email in response to checksum/data/io errors and resilver.finish/scrub.finish events. By default, email will only be sent if the ZED_EMAIL variable is configured in zed.rc (which is serving as a config file of sorts until a proper configuration file is implemented). Signed-off-by: Chris Dunlap <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #2
* Add zimport.sh compatibility test scriptBrian Behlendorf2014-02-213-0/+497
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Verify that an assortment of known good reference pools can be imported using different versions of the ZoL code. By default references pools for the major ZFS implementation will be checked against the most recent ZoL tags and the master development branch. Alternate tags or branches may be verified with the '-s <src-tag> option. Passing the keyword "installed" will instruct the script to test whatever version is installed. Preferentially a reference pool is used for all tests. However, if one does not exist and the pool-tag matches one of the src-tags then a new reference pool will be created using binaries from that source build. This is particularly useful when you need to test your changes before opening a pull request. New reference pools may be added by placing a bzip2 compressed tarball of the pool in the scripts/zpool-example directory and then passing the -p <pool-tag> option. To increase the test coverage reference pools should be collected for all the major ZFS implementations. Having these pools easily available is also helpful to the developers. Care should be taken to run these tests with a kernel supported by all the listed tags. Otherwise build failure will cause false positives. EXAMPLES: The following example will verify the zfs-0.6.2 tag, the master branch, and the installed zfs version can correctly import the listed pools. Note there is no reference pool available for master and installed but because binaries are available one is automatically constructed. The working directory is also preserved between runs (-k) preventing the need to rebuild from source for multiple runs. zimport.sh -k -f /var/tmp/zimport \ -s "zfs-0.6.1 zfs-0.6.2 master installed" \ -p "all master installed" --------------------- ZFS on Linux Source Versions -------------- zfs-0.6.1 zfs-0.6.2 master 0.6.2-180 ----------------------------------------------------------------- Clone SPL Skip Skip Skip Skip Clone ZFS Skip Skip Skip Skip Build SPL Skip Skip Skip Skip Build ZFS Skip Skip Skip Skip ----------------------------------------------------------------- zevo-1.1.1 Pass Pass Pass Pass zol-0.6.1 Pass Pass Pass Pass zol-0.6.2-173 Fail Fail Pass Pass zol-0.6.2 Pass Pass Pass Pass master Fail Fail Pass Pass installed Pass Pass Pass Pass Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Richard Yao <[email protected]> Issue #2094
* Add default FILEDIR path to zpool-config scriptsBrian Behlendorf2014-02-1216-61/+45
| | | | | | | | | | | | | | | | Allow the caller of the zpool-create.sh script to override the default path where file vdevs are created. This allows for greated flexibilty when scripting. Additionally, update the default path from /tmp/ to /var/tmp/ because these days /tmp/ is likely a ramdisk. Even though these files are sparse they may grow large in which case they should be backed by a physical device. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Tim Chase <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #2120
* Fix zconfig.sh test 9Brian Behlendorf2014-02-101-0/+1
| | | | | | | | | | Commit ba6a240 adjusted the behavior of 'zfs create -V'. The caller is no longer guaranteed that udev will have finished creating the /dev/ entries by the time to command exits. It is therefore required that we explicitly block waiting for udev to settle for this test to run reliably. Signed-off-by: Brian Behlendorf <[email protected]>
* cstyle: Allow spaces in all commentsBrian Behlendorf2013-12-181-2/+2
| | | | | | | | | | Update the cstyle.pl script to allow pictures in all comments not just header comments. Recent changes from Illumos such as d3cc8b1 have relocated various pictures in the standard block comments to make the code more readable. Signed-off-by: Brian Behlendorf <[email protected]> Issue #1821
* Silence e2fsck warning in zconfig.shBrian Behlendorf2013-12-161-11/+16
| | | | | | | | | | | | | | | | | | | When running zconfig.sh test 7 and 8 cause the following warning to be printed to the console. It's caused because we're snapshoting a mounted ext2 filesystem which is not in a 'clean' state. This is to be expected since we have no guarentees about the on-disk consistency of the filesystem. EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended To silence the warning and preserve the intent of these test cases they have been updated to unmount the filesystem prior to snapshoting them. This ensures the ext2 filesystem is in a consistent state when the snapshot is taken. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Ned Bass <[email protected]> Closes #1972
* Remove ZFC_IOC_*_MINOR ioctl()sBrian Behlendorf2013-12-161-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Early versions of ZFS coordinated the creation and destruction of device minors from userspace. This was inherently racy and in late 2009 these ioctl()s were removed leaving everything up to the kernel. This significantly simplified the code. However, we never picked up these changes in ZoL since we'd already significantly adjusted this code for Linux. This patch aims to rectify that by finally removing ZFC_IOC_*_MINOR ioctl()s and moving all the functionality down in to the kernel. Since this cleanup will change the kernel/user ABI it's being done in the same tag as the previous libzfs_core ABI changes. This will minimize, but not eliminate, the disruption to end users. Once merged ZoL, Illumos, and FreeBSD will basically be back in sync in regards to handling ZVOLs in the common code. While each platform must have its own custom zvol.c implemenation the interfaces provided are consistent. NOTES: 1) This patch introduces one subtle change in behavior which could not be easily avoided. Prior to this change callers of 'zfs create -V ...' were guaranteed that upon exit the /dev/zvol/ block device link would be created or an error returned. That's no longer the case. The utilities will no longer block waiting for the symlink to be created. Callers are now responsible for blocking, this is why a 'udev_wait' call was added to the 'label' function in scripts/common.sh. 2) The read-only behavior of a ZVOL now solely depends on if the ZVOL_RDONLY bit is set in zv->zv_flags. The redundant policy setting in the gendisk structure was removed. This both simplifies the code and allows us to safely leverage set_disk_ro() to issue a KOBJ_CHANGE uevent. See the comment in the code for futher details on this. 3) Because __zvol_create_minor() and zvol_alloc() may now be called in a sync task they must use KM_PUSHPAGE. References: illumos/illumos-gate@681d9761e8516a7dc5ab6589e2dfe717777e1123 Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Ned Bass <[email protected]> Signed-off-by: Tim Chase <[email protected]> Closes #1969
* Add cstyle.pl utility and cstyle.1 man pageBrian Behlendorf2013-10-302-1/+951
| | | | | | | | | | | | | | | | | | | | | | | | Cstyle is the C source style checker used by Illumos. Since the original ZFS source was written using these style guidelines they must also be followed by ZoL for consistency. The checker has been added to the scripts directory and may be run on a per file basis. New patches should be careful to avoid introducing new style warnings. Additionally, the 'checkstyle' target has been added to the top level Makefile and can be used to check the entire source tree. While Zol has historically attempted to follow the SunOS style guide the lack of a rigorous style checker has allowed various warning to be introduced. Currently there are 2211 reported style violations and we want to gradually eliminate these from the tree. Note the cstyle.1 man page is provided under man/man1/cstyle.1 but since it is a developer utility it is not installed along with the other man pages. Signed-off-by: Brian Behlendorf <[email protected]>
* Add script to fix file names in upstream patchesPrakash Surya2013-10-292-1/+16
| | | | | | | | | | | | | | | | | | | | | Added a simple sed script to do a search and replace on the Illumos ZFS file names and replace them with the ZFS on Linux equivalent. Example usage: # Replace Illumos paths with Linux paths $ ./scripts/zfs2zol-patch.sed arc.c.patch > arc.c.patch.linux # Ensure the script worked as expected $ diff arc.c.patch arc.c.patch.linux # Apply the patch using Linux paths $ patch -p1 < arc.c.patch.linux Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Prakash Surya <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1679
* Add kmod repo integrationBrian Behlendorf2013-08-011-20/+53
| | | | | | | | | | | | | | | | | | When the kmod packaging infrastructure was originally added the dependency on the rpmfusion yum repositories was disabled. This was done at the time in favour of getting local builds working. Now the time has come to conditionally re-enable that functionality so we can properly provide binary kmod packages. ./configure --with-config=srpm make SRPM_DEFINE_KMOD='--define="repo rpmfusion"' srpm-kmod mock rebuild zfs-kmod-x.y.z-r.el6.src.rpm One nice benefit of finishing this work is that the generic and fedora spl-kmod spec files can be merged again. Signed-off-by: Brian Behlendorf <[email protected]>
* Open pools asynchronously after module loadBrian Behlendorf2013-07-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the side effects of calling zvol_create_minors() in zvol_init() is that all pools listed in the cache file will be opened. Depending on the state and contents of your pool this operation can take a considerable length of time. Doing this at load time is undesirable because the kernel is holding a global module lock. This prevents other modules from loading and can serialize an otherwise parallel boot process. Doing this after module inititialization also reduces the chances of accidentally introducing a race during module init. To ensure that /dev/zvol/<pool>/<dataset> devices are still automatically created after the module load completes a udev rules has been added. When udev notices that the /dev/zfs device has been create the 'zpool list' command will be run. This then will cause all the pools listed in the zpool.cache file to be opened. Because this process in now driven asynchronously by udev there is the risk of problems in downstream distributions. Signed-off-by: Brian Behlendorf <[email protected]> Issue #756 Issue #1020 Issue #1234
* Make spl directory setable when building rpms and add --buildrootNathaniel Clark2013-06-211-3/+9
| | | | | | | | | | This adds ability to set the location of spl via defines when building from the spec files. This is useful for build systems that build spl and zfs together without installing the actual rpms. Signed-off-by: Nathaniel Clark <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #1486
* build: resolve orthographic and other grammatical errorsJan Engelhardt2013-04-021-1/+1
| | | | | Signed-off-by: Jan Engelhardt <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]>
* Provide ${kmodname}-devel-kmod for yum-builddepBrian Behlendorf2013-03-251-1/+2
| | | | | | | | | | | | | | In order to ensure that yum-builddep pulls in all the build requirements a generic ${kmodname}-devel-kmod provides line is added. This allows a version of the development headers to be included without requiring knowledge of the kernel version. This is important because unlike rpmbuild which does correctly expand the source rpm spec file, yum-builddep does not. Without this generic provides line mock which relies on yum-builddep is unable to automatically satisfy the dependency. Signed-off-by: Brian Behlendorf <[email protected]>
* Use requested kernel for dkms buildsBrian Behlendorf2013-03-211-0/+2
| | | | | | | | The --with-linux and --with-linux-obj options must be specified as part of the dkms build otherwise the package will be built against the running kernel. Signed-off-by: Brian Behlendorf <[email protected]>
* Use BUILD_DEPENDS option for dkms buildsBrian Behlendorf2013-03-211-0/+1
| | | | | | | | | Support was added to dkms so build dependencies can be specified. This allows us to ensure that the spl package will always be built before the zfs package. Those patches have not yet been merged upstream but they are available in the zfsonlinux/dkms repository. Signed-off-by: Brian Behlendorf <[email protected]>
* Refresh RPM packagingBrian Behlendorf2013-03-184-0/+667
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refresh the existing RPM packaging to conform to the 'Fedora Packaging Guidelines'. This includes adopting the kmods2 packaging standard which is used fod kmods distributed by rpmfusion for Fedora/RHEL. http://fedoraproject.org/wiki/Packaging:Guidelines http://rpmfusion.org/Packaging/KernelModules/Kmods2 While the spec files have been entirely rewritten from a user perspective the only major changes are: * The Fedora packages now have a build dependency on the rpmfusion repositories. The generic kmod packages also have a new dependency on kmodtool-1.22 but it is bundled with the source rpm so no additional packages are needed. * The kernel binary module packages have been renamed from zfs-modules-* to kmod-zfs-* as specificed by kmods2. * The is now a common kmod-zfs-devel-* package in addition to the per-kernel devel packages. The common package contains the development headers while the per-kernel package contains kernel specific build products. Signed-off-by: Brian Behlendorf <[email protected]> Closes #1341
* Replace libexecdir with datadirBrian Behlendorf2013-03-065-90/+16
| | | | | | | | | | According to the FHS. Testing scripts and examples which are all architecture independent should be installed in a subdirectory under /usr/share. http://www.pathname.com/fhs/2.2/fhs-4.11.html Signed-off-by: Brian Behlendorf <[email protected]>
* Add snapdev=[hidden|visible] dataset propertyEric Dillmann2013-03-051-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new snapdev dataset property may be set to control the visibility of zvol snapshot devices. By default this value is set to 'hidden' which will prevent zvol snapshots from appearing under /dev/zvol/ and /dev/<dataset>/. When set to 'visible' all zvol snapshots for the dataset will be visible. This functionality was largely added because when automatic snapshoting is enabled large numbers of read-only zvol snapshots will be created. When creating these devices the kernel will attempt to read their partition tables, and blkid will attempt to identify any filesystems on those partitions. This leads to a variety of issues: 1) The zvol partition tables will be read in the context of the `modprobe zfs` for automatically imported pools. This is undesirable and should be done asynchronously, but for now reducing the number of visible devices helps. 2) Udev expects to be able to complete its work for a new block devices fairly quickly. When many zvol devices are added at the same time this is no longer be true. It can lead to udev timeouts and missing /dev/zvol links. 3) Simply having lots of devices in /dev/ can be aukward from a management standpoint. Hidding the devices your unlikely to ever use helps with this. Any snapshot device which is needed can be made visible by changing the snapdev property. NOTE: This patch changes the default behavior for zvols which was effectively 'snapdev=visible'. Signed-off-by: Brian Behlendorf <[email protected]> Closes #1235 Closes #945 Issue #956 Issue #756
* Retire zpool_id infrastructureBrian Behlendorf2013-01-298-172/+12
| | | | | | | | | | | | | | | | | | | In the interest of maintaining only one udev helper to give vdevs user friendly names, the zpool_id and zpool_layout infrastructure is being retired. They are superseded by vdev_id which incorporates all the previous functionality. Documentation for the new vdev_id(8) helper and its configuration file, vdev_id.conf(5), can be found in their respective man pages. Several useful example files are installed under /etc/zfs/. /etc/zfs/vdev_id.conf.alias.example /etc/zfs/vdev_id.conf.multipath.example /etc/zfs/vdev_id.conf.sas_direct.example /etc/zfs/vdev_id.conf.sas_switch.example Signed-off-by: Brian Behlendorf <[email protected]> Closes #981
* Quiet mkfs.ext2 outputBrian Behlendorf2013-01-281-1/+1
| | | | | | | | | The -q option should quiet the mkfs.ext2 output but certain versions of e2fsprogs appear to ignore it. This can result in an extra 'done' message in the test output. To keep this noise from distracting just direct stdout to /dev/null. Signed-off-by: Brian Behlendorf <[email protected]>
* Stop using /bin/ as a source in zconfig.shBrian Behlendorf2013-01-282-10/+33
| | | | | | | | | | | | | | | | | Test 5, 6, 7, and 7 in zconfig.sh use /bin/ as a source of random directories and files for their test. This has lead to unexpected tests failures because the total size of /bin/ on the test system isn't checked and it is entirely possible for it to be larger than the target filesystem. To resolve this issue we create a somewhat random collection of files and directories in /var/tmp to use. On average we expect about 5MB of data with the worst case being 20MB. This is large enough to be interesting and small enough to always fit in the default test datasets. Signed-off-by: Brian Behlendorf <[email protected]> Closes #1113
* Fix zconfig.sh partitioning errorBrian Behlendorf2013-01-241-2/+2
| | | | | | | | | | | Parted version 3.0 doesn't allow us to specify the start and end percentages as 50% and 100% respectively. This results in: Error: The location 100% is outside the device /dev/zd0 Therefore we change the syntax to 51% and -1 for end of device. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix test script error codesBrian Behlendorf2013-01-241-1/+1
| | | | | | | | | The 'exit $?' command in the INT TERM EXIT trap was overwritting the expected error code with the error code from mv. Fix the issue by removing the 'exit $?'. It's important the we preserve the original error code so failures are easily noticed. Signed-off-by: Brian Behlendorf <[email protected]>
* Implemented sharing datasets via SMB using libshareTurbo Fredriksson2012-12-032-1/+216
| | | | | | | | | Add the initial support for the 'smbshare' option using the existing libshare infrastructure. Because this implementation relies on usershares samba version 3.0.23 is required. Signed-off-by: Brian Behlendorf <[email protected]> Closes #493
* Do not return /dev/loop-control in unused_loop_deviceAndrew Reid2012-10-151-1/+1
| | | | | | | | | | | | | | | | | | The function unused_loop_device in /usr/libexec/zfs/common.sh returns /dev/loop-control on the first call. This device is NOT a loop device (https://github.com/torvalds/linux/commit/770fe30) it is a control device. This in turn causes the script zconfig.sh to fail with: zpool-create.sh: Error 1 creating /tmp/zpool-vdev0 -> /dev/loop-control loopback The patch makes the function return /dev/loop[0-9]* which are loop devices. Signed-off-by: Andrew Reid <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #797
* Force 4K blocksize when testing ext2 on zvol.Etienne Dechamps2012-10-031-1/+3
| | | | | | | | | | | | | | | Currently, mkfs.ext2 on zconfig.sh zvols tries to use a 8K blocksize, probably because by default zvol exposes an optimal I/O size of 8K. Unfortunately, a ext2 blocksize of 8K is not supported by the kernel, so the resulting filesystem is unmountable. This patch fixes the issue by making sure the blocksize is 4K. We have to use -F to force it else mkfs.ext2 won't allow us to use a blocksize smaller than the optimal I/O size. Signed-off-by: Brian Behlendorf <[email protected]> Closes #979
* Remove autotools productsBrian Behlendorf2012-08-276-3131/+1
| | | | | | | | Remove all of the generated autotools products from the repository and update the .gitignore files accordingly. Signed-off-by: Brian Behlendorf <[email protected]> Closes #718
* Set zvol discard_granularity to the volblocksize.Etienne Dechamps2012-08-075-0/+5
| | | | | | | | | | | | | | | | | | Currently, zvols have a discard granularity set to 0, which suggests to the upper layer that discard requests of arbirarily small size and alignment can be made efficiently. In practice however, ZFS does not handle unaligned discard requests efficiently: indeed, it is unable to free a part of a block. It will write zeros to the specified range instead, which is both useless and inefficient (see dnode_free_range). With this patch, zvol block devices expose volblocksize as their discard granularity, so the upper layer is aware that it's not supposed to send discard requests smaller than volblocksize. Signed-off-by: Brian Behlendorf <[email protected]> Closes #862
* Linux 3.5 compat, end_writeback() changed to clear_inode()Richard Yao2012-07-235-0/+5
| | | | | | | | | | | | | | | | The end_writeback() function was changed by moving the call to inode_sync_wait() earlier in to evict(). This effecitvely changes the ordering of the sync but it does not impact the details of the zfs implementation. However, as part of this change end_writeback() was renamed to clear_inode() to reflect the new semantics. This change does impact us and clear_inode() now maps to end_writeback() for kernels prior to 3.5. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #784
* Linux 3.5 compat, iops->truncate_range() removedRichard Yao2012-07-235-0/+5
| | | | | | | | | The vmtruncate_range() support has been removed from the kernel in favor of using the fallocate method in the file_operations table. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #784
* Linux 3.5 compat, eops->encode_fh() takes inodesRichard Yao2012-07-235-0/+5
| | | | | | | | | | | | | | The export_operations member ->encode_fh() has been updated to take both the child and parent inodes. This interface used to take the child dentry and a bool describing if the parent is needed. NOTE: While updating this code I noticed that we do not currently cleanly handle the case where we're passed a connectable parent. This code should be audited to make sure we're doing the right thing. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Issue #784
* Move partition scanning from userspace to module.Etienne Dechamps2012-07-175-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, zpool online -e (dynamic vdev expansion) doesn't work on whole disks because we're invoking ioctl(BLKRRPART) from userspace while ZFS still has a partition open on the disk, which results in EBUSY. This patch moves the BLKRRPART invocation from the zpool utility to the module. Specifically, this is done just before opening the device in vdev_disk_open() which is called inside vdev_reopen(). This requires jumping through some hoops to get to the disk device from the partition device, and to make sure we can still open the partition after the BLKRRPART call. Note that this new code path is triggered on dynamic vdev expansion only; other actions, like creating a new pool, are unchanged and still call BLKRRPART from userspace. This change also depends on API changes which are available in 2.6.37 and latter kernels. The build system has been updated to detect this, but there is no compatibility mode for older kernels. This means that online expansion will NOT be available in older kernels. However, it will still be possible to expand the vdev offline. Signed-off-by: Brian Behlendorf <[email protected]> Closes #808
* Linux 3.4 compat, d_make_root() replaces d_alloc_root()Richard Yao2012-06-115-0/+5
| | | | | | | | | | | | | | | | | | | | torvalds/linux@adc0e91ab142abe93f5b0d7980ada8a7676231fe introduced introduced d_make_root() as a replacement for d_alloc_root(). Further commits appear to have removed d_alloc_root() from the Linux source tree. This causes the following failure: error: implicit declaration of function 'd_alloc_root' [-Werror=implicit-function-declaration] To correct this we update the code to use the current d_make_root() interface for readability. Then we introduce an autotools check to determine if d_make_root() is available. If it isn't then we define some compatibility logic which used the older d_alloc_root() interface. Signed-off-by: Richard Yao <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #776
* Linux 3.3 compat, iops->create()/mkdir()/mknod()Brian Behlendorf2012-04-305-0/+5
| | | | | | | | | | The mode argument of iops->create()/mkdir()/mknod() was changed from an 'int' to a 'umode_t'. To prevent a compiler warning an autoconf check was added to detect the API change and then correctly set a zpl_umode_t typedef. There is no functional change. Signed-off-by: Brian Behlendorf <[email protected]> Closes #701
* Add --enable-debug-dmu-tx configure optionBrian Behlendorf2012-03-235-0/+5
| | | | | | | | | | | | | | | | | | Allow rigorous (and expensive) tx validation to be enabled/disabled indepentantly from the standard zfs debugging. When enabled these checks ensure that all txs are constructed properly and that a dbuf is never dirtied without taking the correct tx hold. This checking is particularly helpful when adding new dmu consumers like Lustre. However, for established consumers such as the zpl with no known outstanding tx construction problems this is just overhead. --enable-debug-dmu-tx - Enable/disable validation of each tx as --disable-debug-dmu-tx it is constructed. By default validation is disabled due to performance concerns. Signed-off-by: Brian Behlendorf <[email protected]>
* Add .zfs control directoryBrian Behlendorf2012-03-225-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for the .zfs control directory. This was accomplished by leveraging as much of the existing ZFS infrastructure as posible and updating it for Linux as required. The bulk of the core functionality is now all there with the following limitations. *) The .zfs/snapshot directory automount support requires a 2.6.37 or newer kernel. The exception is RHEL6.2 which has backported the d_automount patches. *) Creating/destroying/renaming snapshots with mkdir/rmdir/mv in the .zfs/snapshot directory works as expected. However, this functionality is only available to root until zfs delegations are finished. * mkdir - create a snapshot * rmdir - destroy a snapshot * mv - rename a snapshot The following issues are known defeciences, but we expect them to be addressed by future commits. *) Add automount support for kernels older the 2.6.37. This should be possible using follow_link() which is what Linux did before. *) Accessing the .zfs/snapshot directory via NFS is not yet possible. The majority of the ground work for this is complete. However, finishing this work will require resolving some lingering integration issues with the Linux NFS kernel server. *) The .zfs/shares directory exists but no futher smb functionality has yet been implemented. Contributions-by: Rohan Puri <[email protected]> Contributiobs-by: Andrew Barnes <[email protected]> Signed-off-by: Brian Behlendorf <[email protected]> Closes #173
* Cleanly support debug packagesBrian Behlendorf2012-02-275-0/+5
| | | | | | | | | | | | | | | | | | | Allow a source rpm to be rebuilt with debugging enabled. This avoids the need to have to manually modify the spec file. By default debugging is still largely disabled. To enable specific debugging features use the following options with rpmbuild. '--with debug' - Enables ASSERTs # For example: $ rpmbuild --rebuild --with debug zfs-modules-0.6.0-rc6.src.rpm Additionally, ZFS_CONFIG has been added to zfs_config.h for packages which build against these headers. This is critical to ensure both zfs and the dependant package are using the same prototype and structure definitions. Signed-off-by: Brian Behlendorf <[email protected]>
* Add support for DISCARD to ZVOLs.Etienne Dechamps2012-02-095-0/+5
| | | | | | | | | | | | | | | | | | | | DISCARD (REQ_DISCARD, BLKDISCARD) is useful for thin provisioning. It allows ZVOL clients to discard (unmap, trim) block ranges from a ZVOL, thus optimizing disk space usage by allowing a ZVOL to shrink instead of just grow. We can't use zfs_space() or zfs_freesp() here, since these functions only work on regular files, not volumes. Fortunately we can use the low-level function dmu_free_long_range() which does exactly what we want. Currently the discard operation is not added to the log. That's not a big deal since losing discard requests cannot result in data corruption. It would however result in disk space usage higher than it should be. Thus adding log support to zvol_discard() is probably a good idea for a future improvement. Signed-off-by: Brian Behlendorf <[email protected]>
* Support the fallocate() file operation.Etienne Dechamps2012-02-095-0/+5
| | | | | | | | | | | | | | Currently only the (FALLOC_FL_PUNCH_HOLE) flag combination is supported, since it's the only one that matches the behavior of zfs_space(). This makes it pretty much useless in its current form, but it's a start. To support other flag combinations we would need to modify zfs_space() to make it more flexible, or emulate the desired functionality in zpl_fallocate(). Signed-off-by: Brian Behlendorf <[email protected]> Issue #334
* Fix zconfig.sh non-optimal alignmentBrian Behlendorf2012-02-092-56/+67
| | | | | | | | | | | | | | | The recent zvol improvements have changed default suggested alignment for zvols from 512b (default) to 8k (zvol blocksize). Because of this the zconfig.sh tests which create paritions are now generating a warning about non-optimal alignments. This change updates the need zconfig.sh tests such that a partition will be properly aligned. In the process, it shifts from using the sfdisk utility to the parted utility to create partitions. It also moves the creation of labels, partitions, and filesystems in to generic functions in common.sh.in. Signed-off-by: Brian Behlendorf <[email protected]>
* Improve ZVOL queue behavior.Etienne Dechamps2012-02-075-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux block device queue subsystem exposes a number of configurable settings described in Linux block/blk-settings.c. The defaults for these settings are tuned for hard drives, and are not optimized for ZVOLs. Proper configuration of these options would allow upper layers (I/O scheduler) to take better decisions about write merging and ordering. Detailed rationale: - max_hw_sectors is set to unlimited (UINT_MAX). zvol_write() is able to handle writes of any size, so there's no reason to impose a limit. Let the upper layer decide. - max_segments and max_segment_size are set to unlimited. zvol_write() will copy the requests' contents into a dbuf anyway, so the number and size of the segments are irrelevant. Let the upper layer decide. - physical_block_size and io_opt are set to the ZVOL's block size. This has the potential to somewhat alleviate issue #361 for ZVOLs, by warning the upper layers that writes smaller than the volume's block size will be slow. - The NONROT flag is set to indicate this isn't a rotational device. Although the backing zpool might be composed of rotational devices, the resulting ZVOL often doesn't exhibit the same behavior due to the COW mechanisms used by ZFS. Setting this flag will prevent upper layers from making useless decisions (such as reordering writes) based on incorrect assumptions about the behavior of the ZVOL. Signed-off-by: Brian Behlendorf <[email protected]>
* Fix synchronicity for ZVOLs.Etienne Dechamps2012-02-075-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | zvol_write() assumes that the write request must be written to stable storage if rq_is_sync() is true. Unfortunately, this assumption is incorrect. Indeed, "sync" does *not* mean what we think it means in the context of the Linux block layer. This is well explained in linux/fs.h: WRITE: A normal async write. Device will be plugged. WRITE_SYNC: Synchronous write. Identical to WRITE, but passes down the hint that someone will be waiting on this IO shortly. WRITE_FLUSH: Like WRITE_SYNC but with preceding cache flush. WRITE_FUA: Like WRITE_SYNC but data is guaranteed to be on non-volatile media on completion. In other words, SYNC does not *mean* that the write must be on stable storage on completion. It just means that someone is waiting on us to complete the write request. Thus triggering a ZIL commit for each SYNC write request on a ZVOL is unnecessary and harmful for performance. To make matters worse, ZVOL users have no way to express that they actually want data to be written to stable storage, which means the ZIL is broken for ZVOLs. The request for stable storage is expressed by the FUA flag, so we must commit the ZIL after the write if the FUA flag is set. In addition, we must commit the ZIL before the write if the FLUSH flag is set. Also, we must inform the block layer that we actually support FLUSH and FUA. Signed-off-by: Brian Behlendorf <[email protected]>
* Linux 3.3 compat, sops->show_options()Brian Behlendorf2012-02-035-0/+5
| | | | | | | | | | The second argument of sops->show_options() was changed from a 'struct vfsmount *' to a 'struct dentry *'. Add an autoconf check to detect the API change and then conditionally define the expected interface. In either case we are only interested in the zfs_sb_t. Signed-off-by: Brian Behlendorf <[email protected]> Closes #549