[Ocfs2-commits] mfasheh commits r1281 - trunk/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Fri Jul 16 20:58:31 CDT 2004


Author: mfasheh
Date: 2004-07-16 19:58:29 -0500 (Fri, 16 Jul 2004)
New Revision: 1281

Modified:
   trunk/src/inode.c
Log:
* commit another hack to deal with our lack of holes and our lack of
  zeroing on extends. This needs some testing, though I couldn't corrupt
  anything. Either way, we still need to deal with holes in the middle
  of files...



Modified: trunk/src/inode.c
===================================================================
--- trunk/src/inode.c	2004-07-16 01:02:11 UTC (rev 1280)
+++ trunk/src/inode.c	2004-07-17 00:58:29 UTC (rev 1281)
@@ -822,13 +822,26 @@
 static int ocfs_prepare_write (struct file *file, struct page *page, unsigned from, unsigned to)
 {
 	int ret;
+	void *buff;
+	struct inode *inode = page->mapping->host;
 
 	LOG_SET_CONTEXT(PREPARE_WRITE);
 
 	LOG_ENTRY_ARGS ("(0x%p, 0x%p, %u, %u)\n", file, page, from, to);
 
+	if (!inode)
+		BUG();
+
 	ret = block_prepare_write (page, from, to, ocfs_get_block);
 
+	/* because of our massive security hole. */
+	if ((!PageUptodate(page)) &&
+	    page->index == (unsigned long) (inode->i_size >> PAGE_CACHE_SHIFT)) {
+		buff = kmap(page);
+		memset(buff + to, 0, PAGE_CACHE_SIZE - to);
+		kunmap(page);
+	}
+
 	LOG_EXIT_INT (ret);
 
 	LOG_CLEAR_CONTEXT();
@@ -1218,11 +1231,11 @@
 
 	LOG_SET_CONTEXT(READPAGE);
 
+	LOG_ENTRY_ARGS ("(0x%p, %lu)\n", file, (page ? page->index : 0));
+
 	if (!inode)
 		BUG();
 
-	LOG_ENTRY_ARGS ("(0x%p, %lu)\n", file, (page ? page->index : 0));
-
 	ret = block_read_full_page (page, ocfs_get_block);
 	if (ret < 0)
 		goto bail;



More information about the Ocfs2-commits mailing list