summaryrefslogtreecommitdiffstats
path: root/fs/quota
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-08-02 05:44:38 -0400
committerJan Kara <jack@suse.cz>2017-08-17 16:00:07 -0400
commit4580b30ea887fc27e57dabd56724ca24d936dc8a (patch)
treed4982c470250700eb9e509b30560507b5197da44 /fs/quota
parent15512377bd971ecc86f2eab40b841b265b5043de (diff)
quota: Do not dirty bad dquots
Currently we mark dirty even dquots that are not active (i.e., initialization or reading failed for them). Thus later we have to check whether dirty dquot is really active and just clear the dirty bit if not. Avoid this complication by just never marking non-active dquot as dirty. Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota')
-rw-r--r--fs/quota/dquot.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index e1a155e8db15..0393581fe1a3 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -339,6 +339,9 @@ int dquot_mark_dquot_dirty(struct dquot *dquot)
339{ 339{
340 int ret = 1; 340 int ret = 1;
341 341
342 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags))
343 return 0;
344
342 /* If quota is dirty already, we don't have to acquire dq_list_lock */ 345 /* If quota is dirty already, we don't have to acquire dq_list_lock */
343 if (test_bit(DQ_MOD_B, &dquot->dq_flags)) 346 if (test_bit(DQ_MOD_B, &dquot->dq_flags))
344 return 1; 347 return 1;
@@ -624,11 +627,9 @@ int dquot_writeback_dquots(struct super_block *sb, int type)
624 while (!list_empty(dirty)) { 627 while (!list_empty(dirty)) {
625 dquot = list_first_entry(dirty, struct dquot, 628 dquot = list_first_entry(dirty, struct dquot,
626 dq_dirty); 629 dq_dirty);
627 /* Dirty and inactive can be only bad dquot... */ 630
628 if (!test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { 631 WARN_ON(!test_bit(DQ_ACTIVE_B, &dquot->dq_flags));
629 clear_dquot_dirty(dquot); 632
630 continue;
631 }
632 /* Now we have active dquot from which someone is 633 /* Now we have active dquot from which someone is
633 * holding reference so we can safely just increase 634 * holding reference so we can safely just increase
634 * use count */ 635 * use count */
@@ -759,7 +760,7 @@ we_slept:
759 return; 760 return;
760 } 761 }
761 /* Need to release dquot? */ 762 /* Need to release dquot? */
762 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags) && dquot_dirty(dquot)) { 763 if (dquot_dirty(dquot)) {
763 spin_unlock(&dq_list_lock); 764 spin_unlock(&dq_list_lock);
764 /* Commit dquot before releasing */ 765 /* Commit dquot before releasing */
765 ret = dquot->dq_sb->dq_op->write_dquot(dquot); 766 ret = dquot->dq_sb->dq_op->write_dquot(dquot);
@@ -777,8 +778,6 @@ we_slept:
777 } 778 }
778 goto we_slept; 779 goto we_slept;
779 } 780 }
780 /* Clear flag in case dquot was inactive (something bad happened) */
781 clear_dquot_dirty(dquot);
782 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { 781 if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) {
783 spin_unlock(&dq_list_lock); 782 spin_unlock(&dq_list_lock);
784 dquot->dq_sb->dq_op->release_dquot(dquot); 783 dquot->dq_sb->dq_op->release_dquot(dquot);