aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/quota_local.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ocfs2/quota_local.c')
-rw-r--r--fs/ocfs2/quota_local.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/fs/ocfs2/quota_local.c b/fs/ocfs2/quota_local.c
index 07deec5e9721..5a460fa82553 100644
--- a/fs/ocfs2/quota_local.c
+++ b/fs/ocfs2/quota_local.c
@@ -444,10 +444,6 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
444 444
445 mlog_entry("ino=%lu type=%u", (unsigned long)lqinode->i_ino, type); 445 mlog_entry("ino=%lu type=%u", (unsigned long)lqinode->i_ino, type);
446 446
447 status = ocfs2_lock_global_qf(oinfo, 1);
448 if (status < 0)
449 goto out;
450
451 list_for_each_entry_safe(rchunk, next, &(rec->r_list[type]), rc_list) { 447 list_for_each_entry_safe(rchunk, next, &(rec->r_list[type]), rc_list) {
452 chunk = rchunk->rc_chunk; 448 chunk = rchunk->rc_chunk;
453 hbh = NULL; 449 hbh = NULL;
@@ -480,12 +476,18 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
480 type); 476 type);
481 goto out_put_bh; 477 goto out_put_bh;
482 } 478 }
479 status = ocfs2_lock_global_qf(oinfo, 1);
480 if (status < 0) {
481 mlog_errno(status);
482 goto out_put_dquot;
483 }
484
483 handle = ocfs2_start_trans(OCFS2_SB(sb), 485 handle = ocfs2_start_trans(OCFS2_SB(sb),
484 OCFS2_QSYNC_CREDITS); 486 OCFS2_QSYNC_CREDITS);
485 if (IS_ERR(handle)) { 487 if (IS_ERR(handle)) {
486 status = PTR_ERR(handle); 488 status = PTR_ERR(handle);
487 mlog_errno(status); 489 mlog_errno(status);
488 goto out_put_dquot; 490 goto out_drop_lock;
489 } 491 }
490 mutex_lock(&sb_dqopt(sb)->dqio_mutex); 492 mutex_lock(&sb_dqopt(sb)->dqio_mutex);
491 spin_lock(&dq_data_lock); 493 spin_lock(&dq_data_lock);
@@ -523,6 +525,8 @@ static int ocfs2_recover_local_quota_file(struct inode *lqinode,
523out_commit: 525out_commit:
524 mutex_unlock(&sb_dqopt(sb)->dqio_mutex); 526 mutex_unlock(&sb_dqopt(sb)->dqio_mutex);
525 ocfs2_commit_trans(OCFS2_SB(sb), handle); 527 ocfs2_commit_trans(OCFS2_SB(sb), handle);
528out_drop_lock:
529 ocfs2_unlock_global_qf(oinfo, 1);
526out_put_dquot: 530out_put_dquot:
527 dqput(dquot); 531 dqput(dquot);
528out_put_bh: 532out_put_bh:
@@ -537,8 +541,6 @@ out_put_bh:
537 if (status < 0) 541 if (status < 0)
538 break; 542 break;
539 } 543 }
540 ocfs2_unlock_global_qf(oinfo, 1);
541out:
542 if (status < 0) 544 if (status < 0)
543 free_recovery_list(&(rec->r_list[type])); 545 free_recovery_list(&(rec->r_list[type]));
544 mlog_exit(status); 546 mlog_exit(status);
@@ -655,6 +657,9 @@ static int ocfs2_local_read_info(struct super_block *sb, int type)
655 struct ocfs2_quota_recovery *rec; 657 struct ocfs2_quota_recovery *rec;
656 int locked = 0; 658 int locked = 0;
657 659
660 /* We don't need the lock and we have to acquire quota file locks
661 * which will later depend on this lock */
662 mutex_unlock(&sb_dqopt(sb)->dqio_mutex);
658 info->dqi_maxblimit = 0x7fffffffffffffffLL; 663 info->dqi_maxblimit = 0x7fffffffffffffffLL;
659 info->dqi_maxilimit = 0x7fffffffffffffffLL; 664 info->dqi_maxilimit = 0x7fffffffffffffffLL;
660 oinfo = kmalloc(sizeof(struct ocfs2_mem_dqinfo), GFP_NOFS); 665 oinfo = kmalloc(sizeof(struct ocfs2_mem_dqinfo), GFP_NOFS);
@@ -733,6 +738,7 @@ static int ocfs2_local_read_info(struct super_block *sb, int type)
733 goto out_err; 738 goto out_err;
734 } 739 }
735 740
741 mutex_lock(&sb_dqopt(sb)->dqio_mutex);
736 return 0; 742 return 0;
737out_err: 743out_err:
738 if (oinfo) { 744 if (oinfo) {
@@ -746,6 +752,7 @@ out_err:
746 kfree(oinfo); 752 kfree(oinfo);
747 } 753 }
748 brelse(bh); 754 brelse(bh);
755 mutex_lock(&sb_dqopt(sb)->dqio_mutex);
749 return -1; 756 return -1;
750} 757}
751 758