From 9a8ae30e73cb8827dd0a8ae5fd505db457cfb7ed Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Fri, 9 Jun 2017 08:45:43 +0200 Subject: quota: Push dqio_sem down to ->write_file_info() Push down acquisition of dqio_sem into ->write_file_info() callback. Mostly for consistency with other operations. Reviewed-by: Andreas Dilger Signed-off-by: Jan Kara --- fs/quota/quota_v2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'fs/quota/quota_v2.c') diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c index f82638e43c07..5e47012d2f57 100644 --- a/fs/quota/quota_v2.c +++ b/fs/quota/quota_v2.c @@ -154,10 +154,12 @@ static int v2_read_file_info(struct super_block *sb, int type) static int v2_write_file_info(struct super_block *sb, int type) { struct v2_disk_dqinfo dinfo; - struct mem_dqinfo *info = sb_dqinfo(sb, type); + struct quota_info *dqopt = sb_dqopt(sb); + struct mem_dqinfo *info = &dqopt->info[type]; struct qtree_mem_dqinfo *qinfo = info->dqi_priv; ssize_t size; + down_write(&dqopt->dqio_sem); spin_lock(&dq_data_lock); info->dqi_flags &= ~DQF_INFO_DIRTY; dinfo.dqi_bgrace = cpu_to_le32(info->dqi_bgrace); @@ -170,6 +172,7 @@ static int v2_write_file_info(struct super_block *sb, int type) dinfo.dqi_free_entry = cpu_to_le32(qinfo->dqi_free_entry); size = sb->s_op->quota_write(sb, type, (char *)&dinfo, sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF); + up_write(&dqopt->dqio_sem); if (size != sizeof(struct v2_disk_dqinfo)) { quota_error(sb, "Can't write info structure"); return -1; -- cgit v1.2.3