diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/ftape/zftape/zftape-init.c linux-2.5/drivers/char/ftape/zftape/zftape-init.c
--- bk-linus/drivers/char/ftape/zftape/zftape-init.c	2002-11-21 02:14:12.000000000 +0000
+++ linux-2.5/drivers/char/ftape/zftape/zftape-init.c	2002-11-21 17:57:57.000000000 +0000
@@ -28,6 +28,7 @@
 #include <linux/kernel.h>
 #include <linux/signal.h>
 #include <linux/major.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
 #ifdef CONFIG_KMOD
 #include <linux/kmod.h>
@@ -203,6 +204,7 @@ static int  zft_mmap(struct file *filep,
 		static struct vm_operations_struct dummy = { NULL, };
 		vma->vm_ops = &dummy;
 #endif
+		vma->vm_flags &= ~VM_IO;
 	}
 	current->blocked = old_sigmask; /* restore mask */
 	TRACE_EXIT result;
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/char/mem.c linux-2.5/drivers/char/mem.c
--- bk-linus/drivers/char/mem.c	2002-11-21 02:13:55.000000000 +0000
+++ linux-2.5/drivers/char/mem.c	2002-11-21 17:57:41.000000000 +0000
@@ -199,10 +199,10 @@ static int mmap_mem(struct file * file, 
 	vma->vm_flags |= VM_RESERVED;
 
 	/*
-	 * Don't dump addresses that are not real memory to a core file.
+	 * Dump addresses that are real memory to a core file.
 	 */
-	if (offset >= __pa(high_memory) || (file->f_flags & O_SYNC))
-		vma->vm_flags |= VM_IO;
+	if (offset < __pa(high_memory) && !(file->f_flags & O_SYNC))
+		vma->vm_flags &= ~VM_IO;
 
 	if (remap_page_range(vma, vma->vm_start, offset, vma->vm_end-vma->vm_start,
 			     vma->vm_page_prot))
@@ -474,6 +474,7 @@ static int mmap_zero(struct file * file,
 		return shmem_zero_setup(vma);
 	if (zeromap_page_range(vma, vma->vm_start, vma->vm_end - vma->vm_start, vma->vm_page_prot))
 		return -EAGAIN;
+	vma->vm_flags &= ~VM_IO;
 	return 0;
 }
 
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/drivers/usb/class/audio.c linux-2.5/drivers/usb/class/audio.c
--- bk-linus/drivers/usb/class/audio.c	2002-11-21 02:18:53.000000000 +0000
+++ linux-2.5/drivers/usb/class/audio.c	2002-11-21 18:01:13.000000000 +0000
@@ -2349,6 +2349,7 @@ static int usb_audio_mmap(struct file *f
 	if (vma->vm_pgoff != 0)
 		goto out;
 
+	vma->vm_flags &= ~VM_IO;
 	ret = dmabuf_mmap(vma, db,  vma->vm_start, vma->vm_end - vma->vm_start, vma->vm_page_prot);
 out:
 	unlock_kernel();
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/fs/ncpfs/mmap.c linux-2.5/fs/ncpfs/mmap.c
--- bk-linus/fs/ncpfs/mmap.c	2002-11-21 02:20:30.000000000 +0000
+++ linux-2.5/fs/ncpfs/mmap.c	2002-11-21 18:02:24.000000000 +0000
@@ -119,5 +119,6 @@ int ncp_mmap(struct file *file, struct v
 	}
 
 	vma->vm_ops = &ncp_file_mmap;
+	vma->vm_flags &= ~VM_IO;
 	return 0;
 }
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/ipc/shm.c linux-2.5/ipc/shm.c
--- bk-linus/ipc/shm.c	2002-11-21 02:24:36.000000000 +0000
+++ linux-2.5/ipc/shm.c	2002-11-21 18:05:15.000000000 +0000
@@ -151,6 +151,7 @@ static int shm_mmap(struct file * file, 
 {
 	UPDATE_ATIME(file->f_dentry->d_inode);
 	vma->vm_ops = &shm_vm_ops;
+	vma->vm_flags &= ~VM_IO;
 	shm_inc(file->f_dentry->d_inode->i_ino);
 	return 0;
 }
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/filemap.c linux-2.5/mm/filemap.c
--- bk-linus/mm/filemap.c	2002-11-21 02:24:41.000000000 +0000
+++ linux-2.5/mm/filemap.c	2002-11-21 18:05:21.000000000 +0000
@@ -1320,6 +1320,7 @@ int generic_file_mmap(struct file * file
 		return -ENOEXEC;
 	UPDATE_ATIME(inode);
 	vma->vm_ops = &generic_file_vm_ops;
+	vma->vm_flags &= ~VM_IO;
 	return 0;
 }
 #else
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/mm/mmap.c linux-2.5/mm/mmap.c
--- bk-linus/mm/mmap.c	2002-11-21 02:24:42.000000000 +0000
+++ linux-2.5/mm/mmap.c	2002-11-21 18:05:21.000000000 +0000
@@ -574,6 +575,11 @@ munmap_back:
 		}
 		vma->vm_file = file;
 		get_file(file);
+		/*
+		 * Subdrivers can clear VM_IO if their mappings are
+		 * valid pages inside mem_map[]
+		 */
+		vma->vm_flags |= VM_IO;
 		error = file->f_op->mmap(file, vma);
 		if (error)
 			goto unmap_and_free_vma;
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/net/socket.c linux-2.5/net/socket.c
--- bk-linus/net/socket.c	2002-11-21 02:24:44.000000000 +0000
+++ linux-2.5/net/socket.c	2002-11-21 18:05:23.000000000 +0000
@@ -832,6 +832,7 @@ static int sock_mmap(struct file * file,
 {
 	struct socket *sock = SOCKET_I(file->f_dentry->d_inode);
 
+	vma->vm_flags &= ~VM_IO;
 	return sock->ops->mmap(file, sock, vma);
 }
 
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/cmpci.c linux-2.5/sound/oss/cmpci.c
--- bk-linus/sound/oss/cmpci.c	2002-11-21 02:26:03.000000000 +0000
+++ linux-2.5/sound/oss/cmpci.c	2002-11-21 18:06:16.000000000 +0000
@@ -1756,6 +1756,7 @@ static int cm_mmap(struct file *file, st
 	ret = -EINVAL;
 	if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
 		goto out;
+	vma->vm_flags &= ~VM_IO;
 	db->mapped = 1;
 	ret = 0;
 out:
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/cs46xx.c linux-2.5/sound/oss/cs46xx.c
--- bk-linus/sound/oss/cs46xx.c	2002-11-21 02:26:04.000000000 +0000
+++ linux-2.5/sound/oss/cs46xx.c	2002-11-21 18:06:16.000000000 +0000
@@ -2474,6 +2474,7 @@ static int cs_mmap(struct file *file, st
 		ret = -EAGAIN;
 		goto out;
 	}
+	vma->vm_flags &= ~VM_IO;
 	dmabuf->mapped = 1;
 
 	CS_DBGOUT(CS_FUNCTION, 2, printk("cs46xx: cs_mmap()-\n") );
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/es1370.c linux-2.5/sound/oss/es1370.c
--- bk-linus/sound/oss/es1370.c	2002-11-21 02:26:04.000000000 +0000
+++ linux-2.5/sound/oss/es1370.c	2002-11-21 18:06:17.000000000 +0000
@@ -1371,6 +1371,7 @@ static int es1370_mmap(struct file *file
 		ret = -EAGAIN;
 		goto out;
 	}
+	vma->vm_flags &= ~VM_IO;
 	db->mapped = 1;
 out:
 	up(&s->sem);
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/es1371.c linux-2.5/sound/oss/es1371.c
--- bk-linus/sound/oss/es1371.c	2002-11-21 02:26:04.000000000 +0000
+++ linux-2.5/sound/oss/es1371.c	2002-11-21 18:06:18.000000000 +0000
@@ -1562,6 +1562,7 @@ static int es1371_mmap(struct file *file
 		ret = -EAGAIN;
 		goto out;
 	}
+	vma->vm_flags &= ~VM_IO;
 	db->mapped = 1;
 out:
 	up(&s->sem);
@@ -2132,6 +2134,7 @@ static int es1371_mmap_dac(struct file *
 	ret = -EAGAIN;
 	if (remap_page_range(vma, vma->vm_start, virt_to_phys(s->dma_dac1.rawbuf), size, vma->vm_page_prot))
 		goto out;
+	vma->vm_flags &= ~VM_IO;
 	s->dma_dac1.mapped = 1;
 	ret = 0;
 out:
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/esssolo1.c linux-2.5/sound/oss/esssolo1.c
--- bk-linus/sound/oss/esssolo1.c	2002-11-21 02:26:04.000000000 +0000
+++ linux-2.5/sound/oss/esssolo1.c	2002-11-21 18:06:18.000000000 +0000
@@ -1248,6 +1248,7 @@ static int solo1_mmap(struct file *file,
 	ret = -EAGAIN;
 	if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
 		goto out;
+	vma->vm_flags &= ~VM_IO;
 	db->mapped = 1;
 	ret = 0;
 out:
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/i810_audio.c linux-2.5/sound/oss/i810_audio.c
--- bk-linus/sound/oss/i810_audio.c	2002-11-21 02:26:05.000000000 +0000
+++ linux-2.5/sound/oss/i810_audio.c	2002-11-21 18:06:19.000000000 +0000
@@ -1675,6 +1693,7 @@ static int i810_mmap(struct file *file, 
 	if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf),
 			     size, vma->vm_page_prot))
 		goto out;
+	vma->vm_flags &= ~VM_IO;
 	dmabuf->mapped = 1;
 	dmabuf->trigger = 0;
 	ret = 0;
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/ite8172.c linux-2.5/sound/oss/ite8172.c
--- bk-linus/sound/oss/ite8172.c	2002-11-21 02:26:06.000000000 +0000
+++ linux-2.5/sound/oss/ite8172.c	2002-11-21 18:06:19.000000000 +0000
@@ -1105,6 +1105,7 @@ static int it8172_mmap(struct file *file
 	unlock_kernel();
 	return -EAGAIN;
     }
+    vma->vm_flags &= ~VM_IO;
     db->mapped = 1;
     unlock_kernel();
     return 0;
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/maestro.c linux-2.5/sound/oss/maestro.c
--- bk-linus/sound/oss/maestro.c	2002-11-21 02:26:06.000000000 +0000
+++ linux-2.5/sound/oss/maestro.c	2002-11-21 18:06:19.000000000 +0000
@@ -2516,6 +2516,7 @@ static int ess_mmap(struct file *file, s
 	ret = -EAGAIN;
 	if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
 		goto out;
+	vma->vm_flags &= ~VM_IO;
 	db->mapped = 1;
 	ret = 0;
 out:
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/maestro3.c linux-2.5/sound/oss/maestro3.c
--- bk-linus/sound/oss/maestro3.c	2002-11-21 02:26:06.000000000 +0000
+++ linux-2.5/sound/oss/maestro3.c	2002-11-21 18:06:20.000000000 +0000
@@ -1566,6 +1566,7 @@ static int m3_mmap(struct file *file, st
     ret = -EAGAIN;
     if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
         goto out;
+    vma->vm_flags &= ~VM_IO;
 
     db->mapped = 1;
     ret = 0;
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/sonicvibes.c linux-2.5/sound/oss/sonicvibes.c
--- bk-linus/sound/oss/sonicvibes.c	2002-11-21 02:26:10.000000000 +0000
+++ linux-2.5/sound/oss/sonicvibes.c	2002-11-21 18:06:24.000000000 +0000
@@ -1552,6 +1552,7 @@ static int sv_mmap(struct file *file, st
 	ret = -EAGAIN;
 	if (remap_page_range(vma, vma->vm_start, virt_to_phys(db->rawbuf), size, vma->vm_page_prot))
 		goto out;
+	vma->vm_flags &= ~VM_IO;
 	db->mapped = 1;
 	ret = 0;
 out:
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/soundcard.c linux-2.5/sound/oss/soundcard.c
--- bk-linus/sound/oss/soundcard.c	2002-11-21 02:26:10.000000000 +0000
+++ linux-2.5/sound/oss/soundcard.c	2002-11-21 18:06:24.000000000 +0000
@@ -480,6 +480,7 @@ static int sound_mmap(struct file *file,
 		return -EAGAIN;
 	}
 
+	vma->vm_flags &= ~VM_IO;
 	dmap->mapping_flags |= DMA_MAP_MAPPED;
 
 	if( audio_devs[dev]->d->mmap)
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/trident.c linux-2.5/sound/oss/trident.c
--- bk-linus/sound/oss/trident.c	2002-11-21 02:26:11.000000000 +0000
+++ linux-2.5/sound/oss/trident.c	2002-11-21 18:06:24.000000000 +0000
@@ -2115,6 +2115,7 @@ static int trident_mmap(struct file *fil
 	if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf),
 			     size, vma->vm_page_prot))
 		goto out;
+	vma->vm_flags &= ~VM_IO;
 	dmabuf->mapped = 1;
 	ret = 0;
 out:
diff -urpN --exclude-from=/home/davej/.exclude bk-linus/sound/oss/ymfpci.c linux-2.5/sound/oss/ymfpci.c
--- bk-linus/sound/oss/ymfpci.c	2002-11-21 02:26:12.000000000 +0000
+++ linux-2.5/sound/oss/ymfpci.c	2002-11-21 18:06:26.000000000 +0000
@@ -1537,6 +1537,7 @@ static int ymf_mmap(struct file *file, s
 	if (remap_page_range(vma, vma->vm_start, virt_to_phys(dmabuf->rawbuf),
 			     size, vma->vm_page_prot))
 		return -EAGAIN;
+	vma->vm_flags &= ~VM_IO;
 	dmabuf->mapped = 1;
 
 /* P3 */ printk(KERN_INFO "ymfpci: using memory mapped sound, untested!\n");
