public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] FUSE: nfsd with direct_io fix
@ 2005-04-24 15:41 Miklos Szeredi
  0 siblings, 0 replies; only message in thread
From: Miklos Szeredi @ 2005-04-24 15:41 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

This patch fixes an Oops which happens when a filesystem mounted with
the "direct_io" mount option is exported through NFS.  The problem is
that nfsd passes a kernel buffer with the "set_fs(KERNEL_DS)" method
to read and write, but get_user_pages() won't work on such a buffer.
The current fix is "don't do that then".  Long term solution will be
to implement nfs serving in userspace.  Bug spotted by David Shaw.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>

diff -rup linux-2.6.12-rc2-mm3/fs/fuse/file.c linux-fuse/fs/fuse/file.c
--- linux-2.6.12-rc2-mm3/fs/fuse/file.c	2005-04-22 16:00:19.000000000 +0200
+++ linux-fuse/fs/fuse/file.c	2005-04-22 15:50:32.000000000 +0200
@@ -409,6 +409,10 @@ static int fuse_get_user_pages(struct fu
 	unsigned offset = user_addr & ~PAGE_MASK;
 	int npages;
 
+	/* This doesn't work with nfsd */
+	if (!current->mm)
+		return -EPERM;
+
 	nbytes = min(nbytes, (unsigned) FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT);
 	npages = (nbytes + offset + PAGE_SIZE - 1) >> PAGE_SHIFT;
 	npages = min(npages, FUSE_MAX_PAGES_PER_REQ);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-24 15:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-24 15:41 [PATCH] FUSE: nfsd with direct_io fix Miklos Szeredi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox