* [PATCH] iterate_bdevs() should be exported
@ 2013-06-28 2:22 Richard Yao
[not found] ` <1372386158-11076-1-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 6+ messages in thread
From: Richard Yao @ 2013-06-28 2:22 UTC (permalink / raw)
To: Alexander Viro
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
kernel-aBrp7R+bbdUdnm+yROfE0A, zfs-devel-VKpPRiiRko4/ohRxsw7f2g,
Richard Yao
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(+)
--
1.8.1.5
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] fs: Export iterate_bdevs
[not found] ` <1372386158-11076-1-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
@ 2013-06-28 2:22 ` Richard Yao
2013-06-28 2:22 ` [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values Richard Yao
1 sibling, 0 replies; 6+ messages in thread
From: Richard Yao @ 2013-06-28 2:22 UTC (permalink / raw)
To: Alexander Viro
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
kernel-aBrp7R+bbdUdnm+yROfE0A, zfs-devel-VKpPRiiRko4/ohRxsw7f2g,
Richard Yao
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.
Signed-off-by: Richard Yao <ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
---
fs/block_dev.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 2091db8..0f659f3 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -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);
--
1.8.1.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values
[not found] ` <1372386158-11076-1-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-06-28 2:22 ` [PATCH] fs: Export iterate_bdevs Richard Yao
@ 2013-06-28 2:22 ` Richard Yao
[not found] ` <1372386158-11076-3-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-06-28 3:09 ` Al Viro
1 sibling, 2 replies; 6+ messages in thread
From: Richard Yao @ 2013-06-28 2:22 UTC (permalink / raw)
To: Alexander Viro
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
kernel-aBrp7R+bbdUdnm+yROfE0A, zfs-devel-VKpPRiiRko4/ohRxsw7f2g,
Richard Yao
generic_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.
Signed-off-by: Richard Yao <ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
---
fs/read_write.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/read_write.c b/fs/read_write.c
index 0343000..54b8808 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -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);
--
1.8.1.5
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values
[not found] ` <1372386158-11076-3-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
@ 2013-06-28 2:24 ` Richard Yao
0 siblings, 0 replies; 6+ messages in thread
From: Richard Yao @ 2013-06-28 2:24 UTC (permalink / raw)
To: Richard Yao
Cc: Alexander Viro, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
kernel-aBrp7R+bbdUdnm+yROfE0A, zfs-devel-VKpPRiiRko4/ohRxsw7f2g
[-- Attachment #1: Type: text/plain, Size: 1262 bytes --]
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).
On 06/27/2013 10:22 PM, Richard Yao wrote:
> generic_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.
>
> Signed-off-by: Richard Yao <ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
> ---
> fs/read_write.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/read_write.c b/fs/read_write.c
> index 0343000..54b8808 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -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);
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values
2013-06-28 2:22 ` [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values Richard Yao
[not found] ` <1372386158-11076-3-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
@ 2013-06-28 3:09 ` Al Viro
[not found] ` <20130628030959.GD4165-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
1 sibling, 1 reply; 6+ messages in thread
From: Al Viro @ 2013-06-28 3:09 UTC (permalink / raw)
To: Richard Yao; +Cc: linux-fsdevel, kernel, zfs-devel
On Thu, Jun 27, 2013 at 10:22:38PM -0400, Richard Yao wrote:
> generic_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.
NAK. Validation of whence is done before we even get to vfs_llseek().
Leaving it to ->llseek() instances would've been an insanity.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values
[not found] ` <20130628030959.GD4165-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
@ 2013-06-28 3:42 ` Richard Yao
0 siblings, 0 replies; 6+ messages in thread
From: Richard Yao @ 2013-06-28 3:42 UTC (permalink / raw)
To: Al Viro
Cc: linux-fsdevel-u79uwXL29TY76Z2rM5mHXA,
kernel-aBrp7R+bbdUdnm+yROfE0A, zfs-devel-VKpPRiiRko4/ohRxsw7f2g
[-- Attachment #1: Type: text/plain, Size: 695 bytes --]
On 06/27/2013 11:09 PM, Al Viro wrote:
> On Thu, Jun 27, 2013 at 10:22:38PM -0400, Richard Yao wrote:
>> generic_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.
>
> 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.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 901 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-28 3:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-28 2:22 [PATCH] iterate_bdevs() should be exported Richard Yao
[not found] ` <1372386158-11076-1-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-06-28 2:22 ` [PATCH] fs: Export iterate_bdevs Richard Yao
2013-06-28 2:22 ` [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values Richard Yao
[not found] ` <1372386158-11076-3-git-send-email-ryao-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-06-28 2:24 ` Richard Yao
2013-06-28 3:09 ` Al Viro
[not found] ` <20130628030959.GD4165-3bDd1+5oDREiFSDQTTA3OLVCufUGDwFn@public.gmane.org>
2013-06-28 3:42 ` Richard Yao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).