From 21ab1f38ed948768772f2fd6e2bb7f5bdddc4fa4 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 3 Jun 2010 16:22:29 +1000 Subject: [PATCH] --- yaml --- r: 200187 b: refs/heads/master c: f9369729496a0f4c607a4cc1ea4dfeddbbfc505a h: refs/heads/master i: 200185: b5668256557af38b7616513ab1738220a5342c6c 200183: e883d8156121154ce22120286ca75b65564995dd v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_iget.c | 26 ++++++++++---------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index d471e61f885d..a435b68cceaa 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 070ecdca54dde9577d2697088e74e45568f48efb +refs/heads/master: f9369729496a0f4c607a4cc1ea4dfeddbbfc505a diff --git a/trunk/fs/xfs/xfs_iget.c b/trunk/fs/xfs/xfs_iget.c index f44a367907a8..75df75f43d48 100644 --- a/trunk/fs/xfs/xfs_iget.c +++ b/trunk/fs/xfs/xfs_iget.c @@ -741,30 +741,24 @@ xfs_ilock_demote( } #ifdef DEBUG -/* - * Debug-only routine, without additional rw_semaphore APIs, we can - * now only answer requests regarding whether we hold the lock for write - * (reader state is outside our visibility, we only track writer state). - * - * Note: this means !xfs_isilocked would give false positives, so don't do that. - */ int xfs_isilocked( xfs_inode_t *ip, uint lock_flags) { - if ((lock_flags & (XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)) == - XFS_ILOCK_EXCL) { - if (!ip->i_lock.mr_writer) - return 0; + if (lock_flags & (XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)) { + if (!(lock_flags & XFS_ILOCK_SHARED)) + return !!ip->i_lock.mr_writer; + return rwsem_is_locked(&ip->i_lock.mr_lock); } - if ((lock_flags & (XFS_IOLOCK_EXCL|XFS_IOLOCK_SHARED)) == - XFS_IOLOCK_EXCL) { - if (!ip->i_iolock.mr_writer) - return 0; + if (lock_flags & (XFS_IOLOCK_EXCL|XFS_IOLOCK_SHARED)) { + if (!(lock_flags & XFS_IOLOCK_SHARED)) + return !!ip->i_iolock.mr_writer; + return rwsem_is_locked(&ip->i_iolock.mr_lock); } - return 1; + ASSERT(0); + return 0; } #endif