goto out;
}
}
+
err = do_unionfs_rename(old_dir, old_dentry, new_dir, new_dentry);
-out:
- if (err) {
- /* clear the new_dentry stuff created */
- d_drop(new_dentry);
- } else {
- /*
- * force re-lookup since the dir on ro branch is not renamed,
- * and lower dentries still indicate the un-renamed ones.
- */
- if (S_ISDIR(old_dentry->d_inode->i_mode))
- atomic_dec(&UNIONFS_D(old_dentry)->generation);
- else
- unionfs_postcopyup_release(old_dentry);
-
- /*
- * If the dentry already existed before the rename and is
- * not used by anyone else, we must purge its lower
- * pointers, since it might remain in the cache for a while
- * and the odf might give the same inode number to a new
- * inode, so we don't want the new inode to have the old
- * inode's pointers.
- *
- * If its i_count >= 2 we must not modify its lower
- * pointers. The odf will silly rename this inode so it
- * doesn't give it to another inode
- */
- if (new_dentry->d_inode &&
- atomic_read(&new_dentry->d_inode->i_count) < 2) {
- int bindex;
- struct inode *i = new_dentry->d_inode;
- for (bindex = ibstart(i);
- bindex <= ibend(i);
- bindex++) {
- if (unionfs_lower_inode_idx(i, bindex))
- iput(unionfs_lower_inode_idx(i,
- bindex));
- unionfs_set_lower_inode_idx(i, bindex, NULL);
- }
- }
+ if (err)
+ goto out;
+ /*
+ * force re-lookup since the dir on ro branch is not renamed, and
+ * lower dentries still indicate the un-renamed ones.
+ */
+ if (S_ISDIR(old_dentry->d_inode->i_mode))
+ atomic_dec(&UNIONFS_D(old_dentry)->generation);
+ else
+ unionfs_postcopyup_release(old_dentry);
- /* if all of this renaming succeeded, update our times */
- unionfs_copy_attr_times(old_dir);
- unionfs_copy_attr_times(new_dir);
- unionfs_copy_attr_times(old_dentry->d_inode);
- unionfs_copy_attr_times(new_dentry->d_inode);
- unionfs_check_inode(old_dir);
- unionfs_check_inode(new_dir);
- unionfs_check_dentry(old_dentry);
+ /*
+ * If the dentry already existed before the rename and is not used
+ * by anyone else, we must purge its lower pointers, since it might
+ * remain in the cache for a while and the odf might give the same
+ * inode number to a new inode, so we don't want the new inode to
+ * have the old inode's pointers.
+ *
+ * If its i_count >= 2 we must not modify its lower pointers.
+ * The odf will silly rename this inode so it doesn't give it to
+ * another inode
+ */
+ if (new_dentry->d_inode &&
+ atomic_read(&new_dentry->d_inode->i_count) < 2) {
+ int bindex;
+ struct inode *i = new_dentry->d_inode;
+ for (bindex = ibstart(i); bindex <= ibend(i); bindex++) {
+ if (unionfs_lower_inode_idx(i, bindex))
+ iput(unionfs_lower_inode_idx(i, bindex));
+ unionfs_set_lower_inode_idx(i, bindex, NULL);
+ }
}
+ /* if all of this renaming succeeded, update our times */
+ unionfs_copy_attr_times(old_dir);
+ unionfs_copy_attr_times(new_dir);
+ unionfs_copy_attr_times(old_dentry->d_inode);
+ unionfs_copy_attr_times(new_dentry->d_inode);
+ unionfs_check_inode(old_dir);
+ unionfs_check_inode(new_dir);
+ unionfs_check_dentry(old_dentry);
+ unionfs_check_dentry(new_dentry);
+
+out:
+ if (err) /* clear the new_dentry stuff created */
+ d_drop(new_dentry);
unionfs_unlock_dentry(new_dentry);
unionfs_unlock_dentry(old_dentry);
unionfs_read_unlock(old_dentry->d_sb);