Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 109901
b: refs/heads/master
c: f9114eb
h: refs/heads/master
i:
  109899: a20753a
v: v3
  • Loading branch information
David Chinner authored and Lachlan McIlroy committed Sep 17, 2008
1 parent 676798c commit cdc403a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 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: b5b8c9acd547244eb2b7d0280ba38b9dd01971cc
refs/heads/master: f9114eba1eb08ee75fd0f1eee780f0290fb3c043
9 changes: 8 additions & 1 deletion trunk/fs/xfs/xfs_dfrag.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,14 @@ xfs_swap_extents(

sbp = &sxp->sx_stat;

xfs_lock_two_inodes(ip, tip, lock_flags);
/*
* we have to do two separate lock calls here to keep lockdep
* happy. If we try to get all the locks in one call, lock will
* report false positives when we drop the ILOCK and regain them
* below.
*/
xfs_lock_two_inodes(ip, tip, XFS_IOLOCK_EXCL);
xfs_lock_two_inodes(ip, tip, XFS_ILOCK_EXCL);
locked = 1;

/* Verify that both files have the same format */
Expand Down
8 changes: 8 additions & 0 deletions trunk/fs/xfs/xfs_vnodeops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,12 @@ xfs_lock_inodes(
#endif
}

/*
* xfs_lock_two_inodes() can only be used to lock one type of lock
* at a time - the iolock or the ilock, but not both at once. If
* we lock both at once, lockdep will report false positives saying
* we have violated locking orders.
*/
void
xfs_lock_two_inodes(
xfs_inode_t *ip0,
Expand All @@ -1848,6 +1854,8 @@ xfs_lock_two_inodes(
int attempts = 0;
xfs_log_item_t *lp;

if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL))
ASSERT((lock_mode & (XFS_ILOCK_SHARED|XFS_ILOCK_EXCL)) == 0);
ASSERT(ip0->i_ino != ip1->i_ino);

if (ip0->i_ino > ip1->i_ino) {
Expand Down

0 comments on commit cdc403a

Please sign in to comment.