diff options
Diffstat (limited to 'fs/quota/dquot.c')
-rw-r--r-- | fs/quota/dquot.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 6c849de5dc8f..4c2213f7ed36 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -570,7 +570,7 @@ out: | |||
570 | } | 570 | } |
571 | EXPORT_SYMBOL(dquot_scan_active); | 571 | EXPORT_SYMBOL(dquot_scan_active); |
572 | 572 | ||
573 | int vfs_quota_sync(struct super_block *sb, int type) | 573 | int vfs_quota_sync(struct super_block *sb, int type, int wait) |
574 | { | 574 | { |
575 | struct list_head *dirty; | 575 | struct list_head *dirty; |
576 | struct dquot *dquot; | 576 | struct dquot *dquot; |
@@ -615,6 +615,33 @@ int vfs_quota_sync(struct super_block *sb, int type) | |||
615 | spin_unlock(&dq_list_lock); | 615 | spin_unlock(&dq_list_lock); |
616 | mutex_unlock(&dqopt->dqonoff_mutex); | 616 | mutex_unlock(&dqopt->dqonoff_mutex); |
617 | 617 | ||
618 | if (!wait || (sb_dqopt(sb)->flags & DQUOT_QUOTA_SYS_FILE)) | ||
619 | return 0; | ||
620 | |||
621 | /* This is not very clever (and fast) but currently I don't know about | ||
622 | * any other simple way of getting quota data to disk and we must get | ||
623 | * them there for userspace to be visible... */ | ||
624 | if (sb->s_op->sync_fs) | ||
625 | sb->s_op->sync_fs(sb, 1); | ||
626 | sync_blockdev(sb->s_bdev); | ||
627 | |||
628 | /* | ||
629 | * Now when everything is written we can discard the pagecache so | ||
630 | * that userspace sees the changes. | ||
631 | */ | ||
632 | mutex_lock(&sb_dqopt(sb)->dqonoff_mutex); | ||
633 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | ||
634 | if (type != -1 && cnt != type) | ||
635 | continue; | ||
636 | if (!sb_has_quota_active(sb, cnt)) | ||
637 | continue; | ||
638 | mutex_lock_nested(&sb_dqopt(sb)->files[cnt]->i_mutex, | ||
639 | I_MUTEX_QUOTA); | ||
640 | truncate_inode_pages(&sb_dqopt(sb)->files[cnt]->i_data, 0); | ||
641 | mutex_unlock(&sb_dqopt(sb)->files[cnt]->i_mutex); | ||
642 | } | ||
643 | mutex_unlock(&sb_dqopt(sb)->dqonoff_mutex); | ||
644 | |||
618 | return 0; | 645 | return 0; |
619 | } | 646 | } |
620 | EXPORT_SYMBOL(vfs_quota_sync); | 647 | EXPORT_SYMBOL(vfs_quota_sync); |