[Ocfs2-commits] khackel commits r941 - in branches/new-dir-format/src: . inc

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Wed May 26 01:49:36 CDT 2004


Author: khackel
Date: 2004-05-26 00:49:34 -0500 (Wed, 26 May 2004)
New Revision: 941

Modified:
   branches/new-dir-format/src/inc/io.h
   branches/new-dir-format/src/inode.c
   branches/new-dir-format/src/namei.c
Log:
fix for buffers that had been journal dirtied, but 
never GET_DATA_WRITEd



Modified: branches/new-dir-format/src/inc/io.h
===================================================================
--- branches/new-dir-format/src/inc/io.h	2004-05-25 22:45:08 UTC (rev 940)
+++ branches/new-dir-format/src/inc/io.h	2004-05-26 05:49:34 UTC (rev 941)
@@ -107,6 +107,12 @@
 static inline void * OCFS_BH_GET_DATA_READ(struct buffer_head *bh)
 {
 	unsigned char *kaddr;
+	
+	OCFS_ASSERT(bh);
+	if (!bh->b_blocknr) {
+		printk("%d: warning trying to OCFS_BH_GET_DATA_READ block zero!\n", current->pid);
+		ocfs_show_stack(NULL);
+	}		
 
 	while (1) {
 		if (ocfs_bh_sem_lock(bh)==OCFS_BH_SEM_WAIT_ON_MODIFY) {
@@ -153,6 +159,11 @@
 {
 	unsigned char *kaddr;
 
+	OCFS_ASSERT(bh);
+	if (!bh->b_blocknr) {
+		printk("%d: trying to OCFS_BH_GET_DATA_WRITE block zero!\n", current->pid);
+		BUG();
+	}		
 	while (1) {
 		if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {
 #ifdef VERBOSE_BH_SEM
@@ -174,7 +185,12 @@
 static inline void * OCFS_BH_GET_DATA_WRITE_TRYLOCK(struct buffer_head *bh)
 {
 	unsigned char *kaddr;
+	OCFS_ASSERT(bh);
 
+	if (!bh->b_blocknr) {
+		printk("%d: trying to OCFS_BH_GET_DATA_WRITE_TRYLOCK block zero!\n", current->pid);
+		BUG();
+	}		
 	if (ocfs_bh_sem_lock_modify(bh) == OCFS_BH_SEM_WAIT_ON_MODIFY) {
 #ifdef VERBOSE_BH_SEM
 		printk("ocfs2: called getdata for write but "
@@ -201,6 +217,7 @@
 
 static inline void OCFS_BH_PUT_DATA(struct buffer_head *bh)
 {
+	OCFS_ASSERT(bh);
 	kunmap((bh)->b_page);
 	ocfs_bh_sem_unlock(bh);
 }

Modified: branches/new-dir-format/src/inode.c
===================================================================
--- branches/new-dir-format/src/inode.c	2004-05-25 22:45:08 UTC (rev 940)
+++ branches/new-dir-format/src/inode.c	2004-05-26 05:49:34 UTC (rev 941)
@@ -400,7 +400,6 @@
 		       offset, inode->i_ino,
 		       create_ino ? "true" : "false");
 
-	printk("populate inode: setting nlink from %d to %d for %llu\n", inode->i_nlink, fe->link_cnt, offset);
 	inode->i_nlink = fe->link_cnt;
 	switch (inode->i_mode & S_IFMT) {
 	    case S_IFREG:

Modified: branches/new-dir-format/src/namei.c
===================================================================
--- branches/new-dir-format/src/namei.c	2004-05-25 22:45:08 UTC (rev 940)
+++ branches/new-dir-format/src/namei.c	2004-05-26 05:49:34 UTC (rev 941)
@@ -943,6 +943,19 @@
 		goto finally;
 	}
 
+	/* make sure both dirs have bhs
+	 * get an extra ref on old_dir_bh if old==new */
+	if (!new_dir_bh) {
+		if (old_dir_bh) {
+			new_dir_bh = old_dir_bh;
+			get_bh(new_dir_bh);
+		} else {
+			LOG_ERROR_STR("no old_dir_bh!");
+			status = -EIO;
+			goto finally;
+		}
+	}
+
 	if (S_ISDIR(old_inode->i_mode))
 		oldfe_flags = FLAG_DIR;
 
@@ -1022,6 +1035,8 @@
 			goto finally;
 		}
 		got_newlock = 1;
+		LOG_ERROR_ARGS("aha rename over existing... new_de=%p newlockid=%llu newfebh=%p bhblocknr=%lu\n",
+			       new_de, newfe_lockid, newfe_bh, newfe_bh ? newfe_bh->b_blocknr : 0);
 
 		status = ocfs_journal_access(handle, newfe_bh, OCFS_JOURNAL_ACCESS_WRITE);
 		if (status < 0) {
@@ -1091,9 +1106,11 @@
 			LOG_ERROR_STATUS (status);
 			goto finally;
 		}
+		OCFS_BH_GET_DATA_WRITE(new_de_bh); /* write */
 		new_de->inode = le64_to_cpu(GET_INODE_FEOFF(old_inode));
 		new_de->file_type = old_de->file_type;
 		new_dir->i_version = ++event;
+		OCFS_BH_PUT_DATA(new_de_bh);
 		status = ocfs_journal_dirty(handle, new_de_bh);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
@@ -1134,7 +1151,9 @@
 			// BAD
 			goto bail;
 		}
+		OCFS_BH_GET_DATA_WRITE(old_inode_de_bh); /* write */
 		PARENT_INO(old_inode_de_bh->b_data) = le64_to_cpu(GET_INODE_FEOFF(new_dir));
+		OCFS_BH_PUT_DATA(old_inode_de_bh);
 		status = ocfs_journal_dirty(handle, old_inode_de_bh);
 		if (status < 0) {
 			LOG_ERROR_STATUS(status);
@@ -1451,6 +1470,7 @@
 				dir->i_size = offset + sb->s_blocksize;
 				OCFS_BH_PUT_DATA(bh);
 				buf = NULL;
+				status = ocfs_journal_dirty(handle, bh);
 
 				/* update the parent file entry file size */
 				status = ocfs_journal_access(handle, parent_fe_bh, OCFS_JOURNAL_ACCESS_WRITE);



More information about the Ocfs2-commits mailing list