[Ocfs2-commits] smushran commits r3038 - branches/ocfs2-1.2.6/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Tue Jul 24 13:14:26 PDT 2007


Author: smushran
Date: 2007-07-24 13:14:25 -0700 (Tue, 24 Jul 2007)
New Revision: 3038

Modified:
   branches/ocfs2-1.2.6/fs/ocfs2/file.c
Log:
ocfs2: fix to signal ENOSPC during partial allocation
Signed-off-by: seeda

Modified: branches/ocfs2-1.2.6/fs/ocfs2/file.c
===================================================================
--- branches/ocfs2-1.2.6/fs/ocfs2/file.c	2007-07-24 18:56:01 UTC (rev 3037)
+++ branches/ocfs2-1.2.6/fs/ocfs2/file.c	2007-07-24 20:14:25 UTC (rev 3038)
@@ -990,6 +990,8 @@
 				 u64 newsize)
 {
 	u64 bytes_added = 0;
+	u64 actual_size;
+	int tmp_status;
 	int status;
 
 	if (i_size_read(inode) > newsize) {
@@ -1033,11 +1035,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);
@@ -1048,9 +1052,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