xfs: memory barrier before wake_up_bit()
authorAlex Elder <elder@inktank.com>
Mon, 4 Feb 2013 16:13:11 +0000 (10:13 -0600)
committerBen Myers <bpm@sgi.com>
Thu, 7 Feb 2013 15:39:48 +0000 (09:39 -0600)
In xfs_ifunlock() there is a call to wake_up_bit() after clearing
the flush lock on the xfs inode.  This is not guaranteed to be safe,
as noted in the comments above wake_up_bit() beginning with:

    In order for this to function properly, as it uses
    waitqueue_active() internally, some kind of memory
    barrier must be done prior to calling this.

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Dave Chinner <david@fromorbit.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_inode.h

index 22baf6ea4fac8435af2bf38e23f9bf973bbd8643..237e7f6f2ab31ef80456b7a2c60b3080f076c69c 100644 (file)
@@ -419,6 +419,7 @@ static inline void xfs_iflock(struct xfs_inode *ip)
 static inline void xfs_ifunlock(struct xfs_inode *ip)
 {
        xfs_iflags_clear(ip, XFS_IFLOCK);
+       smp_mb();
        wake_up_bit(&ip->i_flags, __XFS_IFLOCK_BIT);
 }