Index: namei.c =================================================================== --- namei.c (revision 1316) +++ namei.c (working copy) @@ -548,8 +548,6 @@ struct buffer_head *fe_bh = NULL; struct buffer_head *parent_fe_bh = NULL; ocfs2_dinode *fe = NULL; - int cleanup_parent = 0; - int cleanup_fe = 0; ocfs_super *osb = OCFS_SB(dir->i_sb); LOG_SET_CONTEXT(LINK); @@ -576,6 +574,9 @@ goto bail; } + ocfs_handle_set_checkpoint(handle, 0); + ocfs_handle_set_sync(handle, 0); + down_write(&OCFS_I(dir)->ip_io_sem); /* lock the parent directory */ @@ -588,8 +589,9 @@ LOG_ERROR_STATUS (err); goto bail; } - cleanup_parent = 1; + ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, FLAG_FILE_CREATE|FLAG_DIR, dir); + down_write(&OCFS_I(inode)->ip_io_sem); err = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE, @@ -601,8 +603,9 @@ LOG_ERROR_STATUS (err); goto bail; } - cleanup_fe = 1; + ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, FLAG_FILE_CREATE, inode); + err = ocfs_journal_access(handle, fe_bh, OCFS_JOURNAL_ACCESS_WRITE); if (err < 0) { LOG_ERROR_STATUS(err); @@ -643,25 +646,6 @@ else if (handle) ocfs_commit_trans(handle); - if (cleanup_parent) { - tmpstat = ocfs_release_lock (osb, OCFS_LKM_EXMODE, - FLAG_FILE_CREATE | FLAG_DIR, dir); - if (tmpstat < 0) - LOG_ERROR_STATUS (tmpstat); - up_write(&OCFS_I(dir)->ip_io_sem); - - } - - if (cleanup_fe) { - tmpstat = ocfs_release_lock(osb, OCFS_LKM_EXMODE, - FLAG_FILE_CREATE - | FLAG_FILE_UPDATE_OIN, - inode); - if (tmpstat < 0) - LOG_ERROR_STATUS (tmpstat); - up_write(&OCFS_I(inode)->ip_io_sem); - } - if (fe_bh) brelse(fe_bh); if (parent_fe_bh) @@ -729,6 +713,7 @@ LOG_ERROR_STATUS(status); goto leave; } + ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, FLAG_FILE_CREATE|FLAG_DIR, parentInode); @@ -998,7 +983,6 @@ struct buffer_head *new_dir_bh = NULL; __u32 oldfe_flags = FLAG_RELEASE_DENTRY | FLAG_FILE_RENAME; __u32 newfe_flags = FLAG_RELEASE_DENTRY; - int got_oldlock = 0, got_newlock = 0; struct ocfs2_dir_entry *old_de = NULL, *new_de = NULL; // dirent for old_dentry // and new_dentry struct buffer_head *new_de_bh = NULL, *old_de_bh = NULL; // bhs for above @@ -1048,7 +1032,8 @@ LOG_ERROR_STATUS(status = -ENOMEM); goto bail; } - + ocfs_handle_set_checkpoint(handle, 0); + ocfs_handle_set_sync(handle, 0); /* if old and new are the same, this'll just do one lock. */ status = ocfs_double_lock(osb, handle, OCFS_LKM_EXMODE, @@ -1084,8 +1069,9 @@ LOG_ERROR_STATUS(status); goto finally; } - got_oldlock = 1; + ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, oldfe_flags, old_inode); + if (S_ISDIR(old_inode->i_mode)) { status = -EIO; old_inode_de_bh = ocfs_bread (handle, old_inode, 0, 0, &status, 0); @@ -1155,8 +1141,11 @@ LOG_ERROR_STATUS(status); goto finally; } - got_newlock = 1; + ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, + newfe_flags, new_inode); + + /* if our caching is working right, then after the * verify_update_inode, newfe->i_nlink == * new_inode->i_nlink */ @@ -1294,16 +1283,7 @@ status = 0; bail: - if (got_oldlock) { - ocfs_release_lock(osb, OCFS_LKM_EXMODE, oldfe_flags, - old_inode); - } - if (got_newlock) { - ocfs_release_lock(osb, OCFS_LKM_EXMODE, newfe_flags, - new_inode); - } - double_up_write(&OCFS_I(old_dir)->ip_io_sem, &OCFS_I(new_dir)->ip_io_sem); up_write(&OCFS_I(old_inode)->ip_io_sem); @@ -1460,7 +1440,6 @@ struct buffer_head *parent_fe_bh = NULL; ocfs2_dinode *fe = NULL; ocfs_journal_handle *handle = NULL; - int got_lock = 0; int credits; LOG_SET_CONTEXT(SYMLINK); @@ -1501,6 +1480,8 @@ goto bail; } + ocfs_handle_set_checkpoint(handle, 0); + ocfs_handle_set_sync(handle, 0); /* lock the parent directory */ status = ocfs_acquire_lock(osb, OCFS_LKM_EXMODE, FLAG_FILE_CREATE | FLAG_DIR, @@ -1510,8 +1491,11 @@ LOG_ERROR_STATUS (status); goto abort_trans; } - got_lock = 1; + ocfs_handle_add_lock(handle, OCFS_LKM_EXMODE, + FLAG_FILE_CREATE|FLAG_DIR, dir); + + status = ocfs_mknod_locked(osb, dir, dentry, S_IFLNK | S_IRWXUGO, 0, &new_fe_bh, parent_fe_bh, handle, @@ -1574,14 +1558,6 @@ ocfs_commit_trans(handle); } - if (got_lock) { - int tmpstat; - tmpstat = ocfs_release_lock (osb, OCFS_LKM_EXMODE, - FLAG_FILE_CREATE | FLAG_DIR, dir); - if (tmpstat < 0) - LOG_ERROR_STATUS (tmpstat); - } - bail: up_write(&OCFS_I(dir)->ip_io_sem); if (new_fe_bh) { Index: file.c =================================================================== --- file.c (revision 1316) +++ file.c (working copy) @@ -940,6 +940,9 @@ goto leave; } + ocfs_handle_set_checkpoint(handle, 0); + ocfs_handle_set_sync(handle, 0); + status = ocfs_acquire_lock (osb, OCFS_LKM_EXMODE, FLAG_FILE_TRUNCATE|FLAG_FILE_UPDATE_OIN, &bh, inode);