[Ocfs2-commits] mfasheh commits r1533 - branches/dlm-changes/src

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Sep 30 21:31:08 CDT 2004


Author: mfasheh
Date: 2004-09-30 21:31:06 -0500 (Thu, 30 Sep 2004)
New Revision: 1533

Modified:
   branches/dlm-changes/src/namei.c
Log:
* create file / mkdir and symlink no longer abort.



Modified: branches/dlm-changes/src/namei.c
===================================================================
--- branches/dlm-changes/src/namei.c	2004-10-01 02:27:18 UTC (rev 1532)
+++ branches/dlm-changes/src/namei.c	2004-10-01 02:31:06 UTC (rev 1533)
@@ -91,8 +91,7 @@
 			     struct buffer_head *parent_fe_bh,
 			     ocfs_journal_handle *handle,
 			     struct inode *inode,
-			     ocfs2_alloc_context *inode_ac,
-			     struct buffer_head *de_bh);
+			     ocfs2_alloc_context *inode_ac);
 
 static int ocfs_fill_new_dir(ocfs_super *osb, 
 			     ocfs_journal_handle *handle,
@@ -372,11 +371,12 @@
 		LOG_ERROR_STATUS (status = -ENOMEM);
 		goto leave;
 	}
+	ocfs_handle_set_always_commits(handle, 1);
 
 	/* do the real work now. */
 	status = ocfs_mknod_locked(osb, dir, dentry, mode, dev,
 				   &new_fe_bh, parent_fe_bh, handle, 
-				   inode, inode_ac, de_bh);
+				   inode, inode_ac);
 	if (status < 0) {
 		if (status != -EINTR)
 			LOG_ERROR_STATUS(status);
@@ -413,9 +413,7 @@
 			LOG_ERROR_STATUS(status);
 			goto leave;
 		}
-		fe = (ocfs2_dinode *) parent_fe_bh->b_data;
-		fe->i_links_count++;
-		fe = NULL;
+		dirfe->i_links_count++;
 		status = ocfs_journal_dirty(handle, parent_fe_bh);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
@@ -424,14 +422,20 @@
 		dir->i_nlink++;
 	}
 
+	status = ocfs_add_entry(handle, dentry, inode, fe->i_blkno,
+				parent_fe_bh, de_bh);
+	if (status < 0) {
+		LOG_ERROR_STATUS (status);
+		goto leave;
+	}
+
 	insert_inode_hash (inode);
 	d_instantiate (dentry, inode);
-	ocfs_commit_trans(handle);
 
 	status = 0;
 leave:
-	if ((status < 0) && handle)
-		ocfs_abort_trans(handle);
+	if (handle)
+		ocfs_commit_trans(handle);
 
 	if (status == -ENOSPC)
 		LOG_TRACE_STR ("Disk is full");
@@ -473,8 +477,7 @@
 			     struct buffer_head *parent_fe_bh,
 			     ocfs_journal_handle *handle,
 			     struct inode *inode,
-			     ocfs2_alloc_context *inode_ac,
-			     struct buffer_head *de_bh)
+			     ocfs2_alloc_context *inode_ac)
 {
 	int status = 0;
 	ocfs2_dinode *fe = NULL;
@@ -571,14 +574,6 @@
 	/* Inode is not yet fully populated, but we need some fields
 	 * for add_entry. */
 	inode->i_mode = mode;
-
-	status = ocfs_add_entry(handle, dentry, inode, fe_blkno,
-				parent_fe_bh, de_bh);
-	if (status < 0) {
-		LOG_ERROR_STATUS (status);
-		goto leave;
-	}
-
 	SET_BH_SEQNUM(inode, *new_fe_bh);
 leave:
 	if (status < 0 && *new_fe_bh) {
@@ -1614,7 +1609,7 @@
 	if (status < 0) {
 		if (status != -EINTR)
 			LOG_ERROR_STATUS (status);
-		goto abort_trans;
+		goto bail;
 	}
 	ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, 0, dir);
 	ocfs_handle_add_inode(handle, dir);
@@ -1623,7 +1618,7 @@
 	if (!dirfe->i_links_count) {
 		/* can't make a file in a deleted directory. */
 		status = -ENOENT;
-		goto abort_trans;
+		goto bail;
 	}
 
 	status = ocfs_prepare_dir_for_insert(osb, dir, parent_fe_bh, 
@@ -1631,19 +1626,19 @@
 					     dentry->d_name.len, &de_bh);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status = -ENOMEM);
-		goto abort_trans;
+		goto bail;
 	}
 
 	status = ocfs_reserve_new_inode(osb, handle, &inode_ac);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status = -ENOMEM);
-		goto abort_trans;
+		goto bail;
 	}
 
 	status = ocfs_reserve_bits(osb, handle, 1, &data_ac);
 	if (status < 0) {
 		LOG_ERROR_STATUS (status = -ENOMEM);
-		goto abort_trans;
+		goto bail;
 	}
 
 	handle = ocfs_start_trans(osb, handle, credits);
@@ -1651,14 +1646,15 @@
 		LOG_ERROR_STATUS (status = -ENOMEM);
 		goto bail;
 	}
+	ocfs_handle_set_always_commits(handle, 1);
 
 	status = ocfs_mknod_locked(osb, dir, dentry, 
  				   S_IFLNK | S_IRWXUGO, 0,
  				   &new_fe_bh, parent_fe_bh, handle,
-				   inode, inode_ac, de_bh);
+				   inode, inode_ac);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
-		goto abort_trans;
+		goto bail;
 	}
 
 	fe = (ocfs2_dinode *) new_fe_bh->b_data;
@@ -1685,7 +1681,7 @@
 			LOG_ERROR_STATUS(status);
 			status = -ENOSPC;
 		}
-		goto abort_trans;
+		goto bail;
 	}
 	inode->i_rdev = 0;
 	inode->i_size = newsize;
@@ -1694,30 +1690,33 @@
 	status = ocfs_mark_inode_dirty(handle, inode, new_fe_bh);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
-		goto abort_trans;
+		goto bail;
 	}
 
 	status = ocfs_inode_fill_ext_map(osb, new_fe_bh, inode);
 	if (status < 0) {
 		LOG_ERROR_STATUS(status);
-		goto abort_trans;
+		goto bail;
 	}
 
 	status = ocfs_create_symlink_data(osb, handle, inode, symname);
-	if (status < 0)
-		LOG_ERROR_STATUS(status);
-
-abort_trans:
 	if (status < 0) {
-		ocfs_abort_trans(handle);
-	} else {
-		insert_inode_hash (inode);
-		d_instantiate (dentry, inode);
+		LOG_ERROR_STATUS (status);
+		goto bail;
+	}
 
-		ocfs_commit_trans(handle);
+	status = ocfs_add_entry(handle, dentry, inode, fe->i_blkno,
+				parent_fe_bh, de_bh);
+	if (status < 0) {
+		LOG_ERROR_STATUS (status);
+		goto bail;
 	}
 
+	insert_inode_hash (inode);
+	d_instantiate (dentry, inode);
 bail:
+	if (handle)
+		ocfs_commit_trans(handle);
 	if (new_fe_bh)
 		brelse(new_fe_bh);
 	if (parent_fe_bh)



More information about the Ocfs2-commits mailing list