Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124950
b: refs/heads/master
c: 2175dd9
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Lachlan McIlroy committed Dec 11, 2008
1 parent 1b66348 commit 51a1835
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 15ac08a8b2c129abccf1be47b6ab09491e013db2
refs/heads/master: 2175dd95741bda5f438e4efe388a8c1bb5abf1cc
49 changes: 11 additions & 38 deletions trunk/fs/xfs/xfs_rename.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,6 @@
#include "xfs_vnodeops.h"


/*
* Given an array of up to 4 inode pointers, unlock the pointed to inodes.
* If there are fewer than 4 entries in the array, the empty entries will
* be at the end and will have NULL pointers in them.
*/
STATIC void
xfs_rename_unlock4(
xfs_inode_t **i_tab,
uint lock_mode)
{
int i;

xfs_iunlock(i_tab[0], lock_mode);
for (i = 1; i < 4; i++) {
if (i_tab[i] == NULL)
break;

/*
* Watch out for duplicate entries in the table.
*/
if (i_tab[i] != i_tab[i-1])
xfs_iunlock(i_tab[i], lock_mode);
}
}

/*
* Enter all inodes for a rename transaction into a sorted array.
*/
Expand Down Expand Up @@ -204,19 +179,6 @@ xfs_rename(
*/
xfs_lock_inodes(inodes, num_inodes, XFS_ILOCK_EXCL);

/*
* If we are using project inheritance, we only allow renames
* into our tree when the project IDs are the same; else the
* tree quota mechanism would be circumvented.
*/
if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
(target_dp->i_d.di_projid != src_ip->i_d.di_projid))) {
error = XFS_ERROR(EXDEV);
xfs_rename_unlock4(inodes, XFS_ILOCK_EXCL);
xfs_trans_cancel(tp, cancel_flags);
goto std_return;
}

/*
* Join all the inodes to the transaction. From this point on,
* we can rely on either trans_commit or trans_cancel to unlock
Expand All @@ -241,6 +203,17 @@ xfs_rename(
xfs_trans_ijoin(tp, target_ip, XFS_ILOCK_EXCL);
}

/*
* If we are using project inheritance, we only allow renames
* into our tree when the project IDs are the same; else the
* tree quota mechanism would be circumvented.
*/
if (unlikely((target_dp->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) &&
(target_dp->i_d.di_projid != src_ip->i_d.di_projid))) {
error = XFS_ERROR(EXDEV);
goto error_return;
}

/*
* Set up the target.
*/
Expand Down

0 comments on commit 51a1835

Please sign in to comment.