From 1c501bda3f44033bdd8db24103dcefbd8a3f6733 Mon Sep 17 00:00:00 2001 From: Chris Wright Date: Wed, 1 Mar 2006 23:45:36 -0800 Subject: [PATCH] Compile fix for NFS O_DIRECT issue --- ...panic-nfs-client-with-direct-i-o-fix.patch | 46 +++++++++++++++++++ queue/series | 1 + 2 files changed, 47 insertions(+) create mode 100644 queue/normal-user-can-panic-nfs-client-with-direct-i-o-fix.patch diff --git a/queue/normal-user-can-panic-nfs-client-with-direct-i-o-fix.patch b/queue/normal-user-can-panic-nfs-client-with-direct-i-o-fix.patch new file mode 100644 index 00000000000..1ee0fa7f27b --- /dev/null +++ b/queue/normal-user-can-panic-nfs-client-with-direct-i-o-fix.patch @@ -0,0 +1,46 @@ +Compile fix: + +fs/nfs/direct.c: In function 'nfs_get_user_pages': +fs/nfs/direct.c:110: warning: implicit declaration of function 'nfs_free_user_pages' +fs/nfs/direct.c: At top level: +fs/nfs/direct.c:127: warning: conflicting types for 'nfs_free_user_pages' +fs/nfs/direct.c:127: error: static declaration of 'nfs_free_user_pages' follows non-static declaration +fs/nfs/direct.c:110: error: previous implicit declaration of 'nfs_free_user_pages' was here + +This should now be the same as fix that's going upstream. + +Signed-off-by: Chris Wright +Cc: Trond Myklebust +--- + + fs/nfs/direct.c | 7 ++++++- + 1 files changed, 6 insertions(+), 1 deletion(-) + +--- linux-2.6.15.5.orig/fs/nfs/direct.c ++++ linux-2.6.15.5/fs/nfs/direct.c +@@ -57,6 +57,7 @@ + #define NFSDBG_FACILITY NFSDBG_VFS + #define MAX_DIRECTIO_SIZE (4096UL << PAGE_SHIFT) + ++static void nfs_free_user_pages(struct page **pages, int npages, int do_dirty); + static kmem_cache_t *nfs_direct_cachep; + + /* +@@ -106,12 +107,16 @@ nfs_get_user_pages(int rw, unsigned long + result = get_user_pages(current, current->mm, user_addr, + page_count, (rw == READ), 0, + *pages, NULL); ++ up_read(¤t->mm->mmap_sem); ++ /* ++ * If we got fewer pages than expected from get_user_pages(), ++ * the user buffer runs off the end of a mapping; return EFAULT. ++ */ + if (result >= 0 && result < page_count) { + nfs_free_user_pages(*pages, result, 0); + *pages = NULL; + result = -EFAULT; + } +- up_read(¤t->mm->mmap_sem); + } + return result; + } diff --git a/queue/series b/queue/series index f1bab291181..0eb201ecf1c 100644 --- a/queue/series +++ b/queue/series @@ -1,2 +1,3 @@ don-t-reset-rskq_defer_accept-in-reqsk_queue_alloc.patch die_if_kernel-can-return.patch +normal-user-can-panic-nfs-client-with-direct-i-o-fix.patch -- 2.47.3