iterate_bdevs() should be exported
PATCH 1/1 iterate_bdevs() should be exported
Systems where the rootfs is ZFS currently rely on their initramfs software to to scan the block devices, identify those belonging to a pool and import the pool. The root dataset name (which includes the pool name) is passed to the initramfs via the kernel commandline. This a headache for users whose distributions' sanctioned initramfs software lacks ZFS support. This is also a maintenance headache for the maintainers of initramfs software that has ZFS support because the scan can race with the kernel's block device initialization routines.
I want to change things so that arbitrary initramfs software can mount a ZFS root filesystem provided that it includes the appropriate kernel modules, passes module parameters to kernel modules and includes mount.zfs. This would be accomplished by having the ZFS kernel module receive the root dataset name through a kernel module parameter, and then do the required pool import and rootfs mount when asked to mount /dev/root.
This requires that the ZFS kernel module do a scan of all devices as part of the rootfs mount, for which iterate_bdevs() is perfect. Unfortunately, iterate_bdevs() is not exported, which prevents its use by kernel modules. iterate_bdevs() was recently introduced. It is in the company of several other bdev/device functions that are already exported, so I believe that there should be no problem exporting it as well.
Richard Yao (1):
fs: Export iterate_bdevs
fs/block_dev.c | 1 + 1 file changed, 1 insertion(+)
Signature · 1 line
1.8.1.5
A message that is not in the archive (sent off-list or not yet received): 1372386158-11076-1-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org
PATCH 1/1 fs: Export iterate_bdevs
iterate_bdevs() was recently introduced. It is in the company of several other bdev/device functions that are already exported, so I believe that there should be no problem exporting it as well.
--- fs/block_dev.c | 1 + 1 file changed, 1 insertion(+)
fs/block_dev.c +1 -0
@@ -1713,3 +1713,4 @@ void iterate_bdevs(void (*func)(struct block_device *, void *), void *arg)spin_unlock (&inode_sb_list_lock);iput (old_inode); } +EXPORT_SYMBOL (iterate_bdevs);
Signature · 1 line
1.8.1.5
PATCH 1/1 fs: generic_file_llseek_size() should recognize invalid whence values
In reply to a message not in the archivegeneric_file_llseek_size() handles whence values in a switch statement, but it lacks cases for both SEEK_SET and invalid values. This causes it to treat all invalid whence values as SEEK_SET, which is wrong.
We fix that by adding a case for SEEK_SET and a default case.
--- fs/read_write.c | 3 +++ 1 file changed, 3 insertions(+)
fs/read_write.c +3 -0
@@ -81,6 +81,7 @@ generic_file_llseek_size(struct file *file, loff_t offset, int whence,switch (whence) {case SEEK_END : offset += eof; +case SEEK_SET :break ;case SEEK_CUR :/*
@@ -118,6 +119,8 @@ generic_file_llseek_size(struct file *file, loff_t offset, int whence,return -ENXIO ; offset = eof;break ; +default : +return -EINVAL ; }return lseek_execute (file, inode, offset, maxsize);
Signature · 1 line
1.8.1.5
A message that is not in the archive (sent off-list or not yet received): 1372386158-11076-3-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org
Re: [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values
Please disregard this patch. This was in my outgoing folder from something that I had previously written, but it had no place being sent to the list (again).
Quoted 33 lines · Richard Yao
generic_file_llseek_size()handles whence values in a switch statement, but it lacks cases for bothSEEK_SETand invalid values. This causes it to treat all invalid whence values asSEEK_SET, which is wrong.We fix that by adding a case for
SEEK_SETand a default case.Signed-off-by Richard Yao <[email protected]>--- fs/read_write.c | 3 +++ 1 file changed, 3 insertions(+)fs/read_write.c +3
-0@@ -81,6 +81,7 @@ generic_file_llseek_size(struct file *file, loff_t offset, int whence,switch (whence) {case SEEK_END : offset += eof; +case SEEK_SET :break ;case SEEK_CUR :/* @@ -118,6 +119,8 @@ generic_file_llseek_size(struct file *file, loff_t offset, int whence,return -ENXIO ; offset = eof;break ; +default : +return -EINVAL ; }return lseek_execute (file, inode, offset, maxsize);
Al Viro
maintainerRe: [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values
In reply to Richard YaoQuoted 5 lines · Richard Yao
generic_file_llseek_size()handles whence values in a switch statement, but it lacks cases for bothSEEK_SETand invalid values. This causes it to treat all invalid whence values asSEEK_SET, which is wrong.We fix that by adding a case for
SEEK_SETand a default case.
NAK. Validation of whence is done before we even get to vfs_llseek(). Leaving it to ->llseek() instances would've been an insanity.
A message that is not in the archive (sent off-list or not yet received): 20130628030959.GD4165-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org
Re: [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values
Quoted 10 lines · Al Viro
Quoted 5 lines · Richard Yao
generic_file_llseek_size()handles whence values in a switch statement, but it lacks cases for bothSEEK_SETand invalid values. This causes it to treat all invalid whence values asSEEK_SET, which is wrong.We fix that by adding a case for
SEEK_SETand a default case.NAK. Validation of whence is done before we even get to
vfs_llseek(). Leaving it to ->llseek() instances would've been an insanity.
Agreed. That patch was written before I spotted that and was not meant to go out. It came along for the ride because my outgoing/ folder was dirty.