ocfs2: Fix lock inversion in quotas during umount
[safe/jmp/linux-2.6] / fs / ocfs2 / super.c
index 1c2c39f..2c26ce2 100644 (file)
@@ -938,12 +938,16 @@ static void ocfs2_disable_quotas(struct ocfs2_super *osb)
        int type;
        struct inode *inode;
        struct super_block *sb = osb->sb;
+       struct ocfs2_mem_dqinfo *oinfo;
 
        /* We mostly ignore errors in this function because there's not much
         * we can do when we see them */
        for (type = 0; type < MAXQUOTAS; type++) {
                if (!sb_has_quota_loaded(sb, type))
                        continue;
+               /* Cancel periodic syncing before we grab dqonoff_mutex */
+               oinfo = sb_dqinfo(sb, type)->dqi_priv;
+               cancel_delayed_work_sync(&oinfo->dqi_sync_work);
                inode = igrab(sb->s_dquot.files[type]);
                /* Turn off quotas. This will remove all dquot structures from
                 * memory and so they will be automatically synced to global