Skip to content

Commit 5f530de

Browse files
committed
ocfs2: Use s_umount for quota recovery protection
Currently we use dqonoff_mutex to serialize quota recovery protection and turning of quotas on / off. Use s_umount semaphore instead. Tested-by: Eric Ren <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent ee1ac54 commit 5f530de

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

fs/ocfs2/quota_local.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ struct ocfs2_quota_recovery *ocfs2_begin_quota_recovery(
454454
/* Sync changes in local quota file into global quota file and
455455
* reinitialize local quota file.
456456
* The function expects local quota file to be already locked and
457-
* dqonoff_mutex locked. */
457+
* s_umount locked in shared mode. */
458458
static int ocfs2_recover_local_quota_file(struct inode *lqinode,
459459
int type,
460460
struct ocfs2_quota_recovery *rec)
@@ -597,7 +597,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
597597
printk(KERN_NOTICE "ocfs2: Finishing quota recovery on device (%s) for "
598598
"slot %u\n", osb->dev_str, slot_num);
599599

600-
mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
600+
down_read(&sb->s_umount);
601601
for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
602602
if (list_empty(&(rec->r_list[type])))
603603
continue;
@@ -674,7 +674,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
674674
break;
675675
}
676676
out:
677-
mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
677+
up_read(&sb->s_umount);
678678
kfree(rec);
679679
return status;
680680
}
@@ -840,7 +840,10 @@ static int ocfs2_local_free_info(struct super_block *sb, int type)
840840
}
841841
ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);
842842

843-
/* dqonoff_mutex protects us against racing with recovery thread... */
843+
/*
844+
* s_umount held in exclusive mode protects us against racing with
845+
* recovery thread...
846+
*/
844847
if (oinfo->dqi_rec) {
845848
ocfs2_free_quota_recovery(oinfo->dqi_rec);
846849
mark_clean = 0;

0 commit comments

Comments
 (0)