From: Miklos Szeredi 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 Signed-off-by: Andrew Morton --- fs/fuse/file.c | 4 ++++ 1 files changed, 4 insertions(+) diff -puN fs/fuse/file.c~fuse-direct-i-o-nfsd-with-direct_io-fix fs/fuse/file.c --- 25/fs/fuse/file.c~fuse-direct-i-o-nfsd-with-direct_io-fix 2005-05-10 02:22:10.000000000 -0700 +++ 25-akpm/fs/fuse/file.c 2005-05-10 02:22:10.000000000 -0700 @@ -382,6 +382,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); _