patch-2.3.47 linux/fs/buffer.c

Next file: linux/fs/ext2/inode.c
Previous file: linux/fs/binfmt_script.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.46/linux/fs/buffer.c linux/fs/buffer.c
@@ -1692,8 +1692,12 @@
 int generic_commit_write(struct file *file, struct page *page,
 		unsigned from, unsigned to)
 {
-	__block_commit_write((struct inode*)page->mapping->host,page,from,to);
+	struct inode *inode = (struct inode*)page->mapping->host;
+	loff_t pos = ((loff_t)page->index << PAGE_CACHE_SHIFT) + to;
+	__block_commit_write(inode,page,from,to);
 	kunmap(page);
+	if (pos > inode->i_size)
+		inode->i_size = pos;
 	return 0;
 }
 
@@ -2010,7 +2014,6 @@
 	kaddr = (char*)page_address(page);
 	memcpy(kaddr, symname, len-1);
 	mapping->a_ops->commit_write(NULL, page, 0, len-1);
-	inode->i_size = len-1;
 	/*
 	 * Notice that we are _not_ going to block here - end of page is
 	 * unmapped, so this will only try to map the rest of page, see
@@ -2026,7 +2029,6 @@
 	mark_inode_dirty(inode);
 	return 0;
 fail_map:
-	inode->i_size = len-1;
 	UnlockPage(page);
 	page_cache_release(page);
 fail:

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)