Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux...
[sfrench/cifs-2.6.git] / mm / readahead.c
index 337b20e946f6891ed9ae322d22c8e24a1b27f40e..dfa9a1a03a116c7659d0d71134a3450a8d69026f 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <linux/kernel.h>
 #include <linux/fs.h>
+#include <linux/gfp.h>
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/blkdev.h>
@@ -502,7 +503,7 @@ void page_cache_sync_readahead(struct address_space *mapping,
                return;
 
        /* be dumb */
-       if (filp->f_mode & FMODE_RANDOM) {
+       if (filp && (filp->f_mode & FMODE_RANDOM)) {
                force_page_cache_readahead(mapping, filp, offset, req_size);
                return;
        }