All of lore.kernel.org
 help / color / mirror / Atom feed
* [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; 7+ 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] 7+ messages in thread
* [PATCH] fs: generic_file_llseek_size() should recognize invalid whence values
@ 2013-06-16  0:55 Richard Yao
  0 siblings, 0 replies; 7+ messages in thread
From: Richard Yao @ 2013-06-16  0:55 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-fsdevel, kernel, 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@gentoo.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] 7+ messages in thread

end of thread, other threads:[~2013-06-28  3:42 UTC | newest]

Thread overview: 7+ 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
  -- strict thread matches above, loose matches on Subject: below --
2013-06-16  0:55 Richard Yao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.