mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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 <zren@suse.com> Signed-off-by: Jan Kara <jack@suse.cz>
This commit is contained in:
parent
ee1ac541a2
commit
5f530de63c
1 changed files with 7 additions and 4 deletions
|
@ -454,7 +454,7 @@ out:
|
||||||
/* Sync changes in local quota file into global quota file and
|
/* Sync changes in local quota file into global quota file and
|
||||||
* reinitialize local quota file.
|
* reinitialize local quota file.
|
||||||
* The function expects local quota file to be already locked and
|
* The function expects local quota file to be already locked and
|
||||||
* dqonoff_mutex locked. */
|
* s_umount locked in shared mode. */
|
||||||
static int ocfs2_recover_local_quota_file(struct inode *lqinode,
|
static int ocfs2_recover_local_quota_file(struct inode *lqinode,
|
||||||
int type,
|
int type,
|
||||||
struct ocfs2_quota_recovery *rec)
|
struct ocfs2_quota_recovery *rec)
|
||||||
|
@ -597,7 +597,7 @@ int ocfs2_finish_quota_recovery(struct ocfs2_super *osb,
|
||||||
printk(KERN_NOTICE "ocfs2: Finishing quota recovery on device (%s) for "
|
printk(KERN_NOTICE "ocfs2: Finishing quota recovery on device (%s) for "
|
||||||
"slot %u\n", osb->dev_str, slot_num);
|
"slot %u\n", osb->dev_str, slot_num);
|
||||||
|
|
||||||
mutex_lock(&sb_dqopt(sb)->dqonoff_mutex);
|
down_read(&sb->s_umount);
|
||||||
for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
|
for (type = 0; type < OCFS2_MAXQUOTAS; type++) {
|
||||||
if (list_empty(&(rec->r_list[type])))
|
if (list_empty(&(rec->r_list[type])))
|
||||||
continue;
|
continue;
|
||||||
|
@ -674,7 +674,7 @@ out_put:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex);
|
up_read(&sb->s_umount);
|
||||||
kfree(rec);
|
kfree(rec);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
@ -840,7 +840,10 @@ static int ocfs2_local_free_info(struct super_block *sb, int type)
|
||||||
}
|
}
|
||||||
ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);
|
ocfs2_release_local_quota_bitmaps(&oinfo->dqi_chunk);
|
||||||
|
|
||||||
/* dqonoff_mutex protects us against racing with recovery thread... */
|
/*
|
||||||
|
* s_umount held in exclusive mode protects us against racing with
|
||||||
|
* recovery thread...
|
||||||
|
*/
|
||||||
if (oinfo->dqi_rec) {
|
if (oinfo->dqi_rec) {
|
||||||
ocfs2_free_quota_recovery(oinfo->dqi_rec);
|
ocfs2_free_quota_recovery(oinfo->dqi_rec);
|
||||||
mark_clean = 0;
|
mark_clean = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue