xfs
[Top] [All Lists]

[PATCH 2/2] xfs: another memory barrier before wake_up_bit()

To: xfs@xxxxxxxxxxx
Subject: [PATCH 2/2] xfs: another memory barrier before wake_up_bit()
From: Alex Elder <elder@xxxxxxxxxxx>
Date: Mon, 04 Feb 2013 10:13:23 -0600
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <510FDDE5.4050103@xxxxxxxxxxx>
References: <510FDDE5.4050103@xxxxxxxxxxx>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
In xfs_inode_item_unpin() there is a call to wake_up_bit() following
an independent test for whether waiters should be awakened.  This
requires a memory barrier in order to guarantee correct operation
(see the comment above wake_up_bit()).

Signed-off-by: Alex Elder <elder@xxxxxxxxxxx>
---
 fs/xfs/xfs_inode_item.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/xfs/xfs_inode_item.c b/fs/xfs/xfs_inode_item.c
index d041d47..a7cacf7 100644
--- a/fs/xfs/xfs_inode_item.c
+++ b/fs/xfs/xfs_inode_item.c
@@ -474,8 +474,10 @@ xfs_inode_item_unpin(

        trace_xfs_inode_unpin(ip, _RET_IP_);
        ASSERT(atomic_read(&ip->i_pincount) > 0);
-       if (atomic_dec_and_test(&ip->i_pincount))
-               wake_up_bit(&ip->i_flags, __XFS_IPINNED_BIT);
+       if (!atomic_dec_and_test(&ip->i_pincount))
+               return;
+       smp_mb();
+       wake_up_bit(&ip->i_flags, __XFS_IPINNED_BIT);
 }

 STATIC uint
-- 
1.7.9.5

<Prev in Thread] Current Thread [Next in Thread>