inode: Fix bug in direct I/O with holes
authorAlan Cox <alan@linux.intel.com>
Fri, 20 Feb 2015 23:55:07 +0000 (23:55 +0000)
committerAlan Cox <alan@linux.intel.com>
Fri, 20 Feb 2015 23:55:07 +0000 (23:55 +0000)
Kernel/inode.c

index 7d5f68b..e9793b9 100644 (file)
@@ -61,7 +61,7 @@ void readi(inoptr ino, uint8_t flag)
                        pblk = bmap(ino, udata.u_offset >> BLKSHIFT, 1);
 
 #if defined(read_direct)
-                       if (!ispipe && amount == BLKSIZE && read_direct(flag) && bfind(dev, pblk) == 0) {
+                       if (!ispipe && pblk != NULLBLK && amount == BLKSIZE && read_direct(flag) && bfind(dev, pblk) == 0) {
                                /* we can transfer direct from disk to the userspace buffer */
                                off_t uostash;
                                usize_t ucstash;