diff options
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r-- | fs/quota/dquot.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 831d49a4111f..cfc8dcc16043 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -581,9 +581,17 @@ int dquot_scan_active(struct super_block *sb, | |||
581 | dqstats_inc(DQST_LOOKUPS); | 581 | dqstats_inc(DQST_LOOKUPS); |
582 | dqput(old_dquot); | 582 | dqput(old_dquot); |
583 | old_dquot = dquot; | 583 | old_dquot = dquot; |
584 | ret = fn(dquot, priv); | 584 | /* |
585 | if (ret < 0) | 585 | * ->release_dquot() can be racing with us. Our reference |
586 | goto out; | 586 | * protects us from new calls to it so just wait for any |
587 | * outstanding call and recheck the DQ_ACTIVE_B after that. | ||
588 | */ | ||
589 | wait_on_dquot(dquot); | ||
590 | if (test_bit(DQ_ACTIVE_B, &dquot->dq_flags)) { | ||
591 | ret = fn(dquot, priv); | ||
592 | if (ret < 0) | ||
593 | goto out; | ||
594 | } | ||
587 | spin_lock(&dq_list_lock); | 595 | spin_lock(&dq_list_lock); |
588 | /* We are safe to continue now because our dquot could not | 596 | /* We are safe to continue now because our dquot could not |
589 | * be moved out of the inuse list while we hold the reference */ | 597 | * be moved out of the inuse list while we hold the reference */ |