[Ocfs2-commits] mfasheh commits r2233 - trunk/fs/ocfs2

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu May 12 19:39:08 CDT 2005


Author: mfasheh
Signed-off-by: jlbec
Date: 2005-05-12 19:39:06 -0500 (Thu, 12 May 2005)
New Revision: 2233

Modified:
   trunk/fs/ocfs2/journal.c
   trunk/fs/ocfs2/super.c
Log:
* deal with errors during mount better 

Signed-off-by: jlbec



Modified: trunk/fs/ocfs2/journal.c
===================================================================
--- trunk/fs/ocfs2/journal.c	2005-05-12 23:53:41 UTC (rev 2232)
+++ trunk/fs/ocfs2/journal.c	2005-05-13 00:39:06 UTC (rev 2233)
@@ -644,11 +644,8 @@
 	journal = osb->journal;
 	inode = journal->j_inode;
 
-	if (journal->j_state != OCFS_JOURNAL_LOADED) {
-		status = -EINVAL;
-		mlog_errno(status);
+	if (journal->j_state != OCFS_JOURNAL_LOADED)
 		goto done;
-	}
 
 	/* need to inc inode use count as journal_destroy will iput. */
 	if (!igrab(inode))

Modified: trunk/fs/ocfs2/super.c
===================================================================
--- trunk/fs/ocfs2/super.c	2005-05-12 23:53:41 UTC (rev 2232)
+++ trunk/fs/ocfs2/super.c	2005-05-13 00:39:06 UTC (rev 2233)
@@ -307,15 +307,19 @@
 	sb->s_op = &ocfs_sops;
 	sb->s_export_op = &ocfs_export_ops;
 	sb->s_flags |= MS_NOATIME;
+	sb->s_fs_info = NULL;
 
 	status = ocfs_mount_volume(sb);
+	/* ocfs_mount_volume may set osb even on error so we want to
+	 * pull it off for proper cleanup. */
+	osb = OCFS2_SB(sb);
+
 	if (status < 0)
 		goto read_super_error;
 
 	/* this is needed to support O_LARGEFILE */
 	sb->s_maxbytes = ocfs2_max_file_offset(sb->s_blocksize_bits);
 
-	osb = OCFS_SB(sb);
 	if (!osb) {
 		status = -EINVAL;
 		goto read_super_error;
@@ -694,12 +698,12 @@
 		goto leave;
 	}
 
-	if ((osb = kmalloc (sizeof(ocfs_super), GFP_KERNEL)) == NULL) {
+	osb = kcalloc(1, sizeof(ocfs_super), GFP_KERNEL);
+	if (!osb) {
 		status = -ENOMEM;
 		mlog_errno(status);
 		goto leave;
 	}
-	memset(osb, 0, sizeof(ocfs_super));
 
 	sb->s_fs_info = osb;
 	osb->sb = sb;
@@ -820,6 +824,8 @@
 	osb = OCFS_SB(sb);
 	OCFS_ASSERT(osb);
 
+	ocfs2_wait_for_okp_destruction(osb);
+
 	ocfs_shutdown_local_alloc(osb);
 
 	/* disable any new recovery threads and wait for any currently
@@ -839,28 +845,30 @@
 	ocfs_sync_blockdev(sb);
 
 	/* Remove the proc element for this volume */
-	ocfs_proc_remove_volume (osb);
+	ocfs_proc_remove_volume(osb);
 
-	tmp = ocfs2_super_lock(osb, 1);
-	if (tmp < 0) {
-		mlog_errno(tmp);
-		return;
-	}
+	/* No dlm means we've failed during mount, so skip all the
+	 * steps which depended on that to complete. */
+	if (osb->dlm) {
+		tmp = ocfs2_super_lock(osb, 1);
+		if (tmp < 0) {
+			mlog_errno(tmp);
+			return;
+		}
 
-	tmp = ocfs2_request_umount_vote(osb);
-	if (tmp < 0)
-		mlog_errno(tmp);
+		tmp = ocfs2_request_umount_vote(osb);
+		if (tmp < 0)
+			mlog_errno(tmp);
 
-	ocfs2_wait_for_okp_destruction(osb);
+		ocfs2_put_slot(osb);
 
-	ocfs2_put_slot(osb);
+		ocfs_release_system_inodes(osb);
 
-	ocfs_release_system_inodes(osb);
+		ocfs2_unregister_net_handlers(osb);
 
-	ocfs2_unregister_net_handlers(osb);
+		ocfs2_dlm_shutdown(osb);
+	}
 
-	ocfs2_dlm_shutdown(osb);
-
 	ocfs2_clear_hb_callbacks(osb);
 
 	ocfs2_stop_heartbeat(osb);
@@ -870,7 +878,7 @@
 	printk("ocfs2: Unmounting device (%u,%u) on (node %d)\n",
 	       MAJOR(osb->sb->s_dev), MINOR(osb->sb->s_dev), osb->node_num);
 
-	ocfs_delete_osb (osb);
+	ocfs_delete_osb(osb);
 	kfree(osb);
 	sb->s_dev = 0;
 }				/* ocfs_dismount_volume */



More information about the Ocfs2-commits mailing list