patch-2.1.52 linux/mm/filemap.c

Next file: linux/mm/memory.c
Previous file: linux/kernel/fork.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.51/linux/mm/filemap.c linux/mm/filemap.c
@@ -952,11 +952,14 @@
 	file.f_reada = 0;
 
 	/*
-	 * WSH: could vm_area struct (and inode) be released while writing?
+	 * If a task terminates while we're swapping the page, the vma and
+	 * and dentry could be released ... increment the count to be safe.
 	 */
+	dget(dentry);
 	down(&inode->i_sem);
 	result = do_write_page(inode, &file, (const char *) page, offset);
 	up(&inode->i_sem);
+	dput(dentry);
 	return result;
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov