[Ocfs2-commits] seeda commits r3025 - branches/ocfs2-1.2.5/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed May 16 23:58:38 PDT 2007


Author: seeda
Date: 2007-05-16 23:58:37 -0700 (Wed, 16 May 2007)
New Revision: 3025

Modified:
   branches/ocfs2-1.2.5/fs/ocfs2/file.c
Log:
ocfs2: fix to signal ENOSPC during partial allocation

Signed-off-by: smushran



Modified: branches/ocfs2-1.2.5/fs/ocfs2/file.c
===================================================================
--- branches/ocfs2-1.2.5/fs/ocfs2/file.c	2007-05-15 00:50:42 UTC (rev 3024)
+++ branches/ocfs2-1.2.5/fs/ocfs2/file.c	2007-05-17 06:58:37 UTC (rev 3025)
@@ -992,6 +992,8 @@
 				 u64 newsize)
 {
 	u64 bytes_added = 0;
+	u64 actual_size;
+	int tmp_status;
 	int status;
 
 	if (i_size_read(inode) > newsize) {
@@ -1035,11 +1037,13 @@
 		     "status return of %d extending inode "
 		     "%"MLFu64"\n", status,
 		     OCFS2_I(inode)->ip_blkno);
-	status = 0;
+	
+	actual_size = bytes_added + i_size_read(inode);
+	if ((newsize > actual_size) && (status == 0))
+		status = -ENOSPC;
 
-	newsize = bytes_added + i_size_read(inode);
 	if (bytes_added)
-		ocfs2_update_inode_size(inode, newsize);
+		ocfs2_update_inode_size(inode, actual_size);
 
 #ifdef OCFS2_ORACORE_WORKAROUNDS
 	spin_lock(&OCFS2_I(inode)->ip_lock);
@@ -1050,9 +1054,12 @@
 	spin_unlock(&OCFS2_I(inode)->ip_lock);
 #endif
 
+	tmp_status = status;
 	status = ocfs2_zero_extend(inode);
 	if (status < 0)
 		mlog_errno(status);
+	if (tmp_status < 0) 
+		status = tmp_status;
 
 out_unlock:
 	ocfs2_data_unlock(inode, 1);




More information about the Ocfs2-commits mailing list