aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_sync.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2010-03-01 06:30:31 -0500
committerAlex Elder <aelder@sgi.com>2010-03-01 20:14:36 -0500
commitf1f724e4b523d444c5a598d74505aefa3d6844d2 (patch)
tree49408b17a42628b7a0fbc1d5bf163bb716e73545 /fs/xfs/linux-2.6/xfs_sync.c
parenta14a5ab58f9d783ec3a2a287320fab22e1764813 (diff)
xfs: fix locking for inode cache radix tree tag updates
The radix-tree code requires it's users to serialize tag updates against other updates to the tree. While XFS protects tag updates against each other it does not serialize them against updates of the tree contents, which can lead to tag corruption. Fix the inode cache to always take pag_ici_lock in exclusive mode when updating radix tree tags. Signed-off-by: Christoph Hellwig <hch@lst.de> Reported-by: Patrick Schreurs <patrick@news-service.com> Tested-by: Patrick Schreurs <patrick@news-service.com> Signed-off-by: Alex Elder <aelder@sgi.com>
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_sync.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index a9f6d20aff41..f9fc154d9f72 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -688,12 +688,12 @@ xfs_inode_set_reclaim_tag(
688 struct xfs_perag *pag; 688 struct xfs_perag *pag;
689 689
690 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino)); 690 pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
691 read_lock(&pag->pag_ici_lock); 691 write_lock(&pag->pag_ici_lock);
692 spin_lock(&ip->i_flags_lock); 692 spin_lock(&ip->i_flags_lock);
693 __xfs_inode_set_reclaim_tag(pag, ip); 693 __xfs_inode_set_reclaim_tag(pag, ip);
694 __xfs_iflags_set(ip, XFS_IRECLAIMABLE); 694 __xfs_iflags_set(ip, XFS_IRECLAIMABLE);
695 spin_unlock(&ip->i_flags_lock); 695 spin_unlock(&ip->i_flags_lock);
696 read_unlock(&pag->pag_ici_lock); 696 write_unlock(&pag->pag_ici_lock);
697 xfs_perag_put(pag); 697 xfs_perag_put(pag);
698} 698}
699 699