Skip to contentSkip to conversation

fix lock inversion in forced unmount

PATCH In review David Chinner 2 participants 2 messages Apr 2, 2008 – Apr 7, 2008 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix lock inversion in forced unmount

Fix lock inversion in forced shutdown.

Recent changes to xlog_state_release_iclog() placed the grant_lock inside the icloglock. forced unmount of the log does this the opposite way around, but does not depend on the order for correct working. Fix the inversion by changing the order locks are gained in xfs_log_force_umount().

---
 fs/xfs/xfs_log.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_log.c +1 -1
Index: 2.6.x-xfs-new/fs/xfs/xfs_log.c
===================================================================
@@ -3502,8 +3502,8 @@ xfs_log_force_umount(
 	 * before we mark the filesystem SHUTDOWN and wake
 	 * everybody up to tell the bad news.
 	 */
-	spin_lock(&log->l_grant_lock);
 	spin_lock(&log->l_icloglock);
+	spin_lock(&log->l_grant_lock);
 	mp->m_flags |= XFS_MOUNT_FS_SHUTDOWN;
 	XFS_BUF_DONE(mp->m_sb_bp);
 	/*