aboutsummaryrefslogtreecommitdiffstats
path: root/fs/quota/quota_v1.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-06-08 15:30:45 +0200
committerJan Kara <jack@suse.cz>2017-08-17 19:01:00 +0200
commite342e38df925973b86cd46d40bbe7f083414e2ad (patch)
treeace185b868c9439b20fc9febf997e29770d4dc37 /fs/quota/quota_v1.c
parentquota: Protect dquot writeout with dq_lock (diff)
downloadlinux-dev-e342e38df925973b86cd46d40bbe7f083414e2ad.tar.xz
linux-dev-e342e38df925973b86cd46d40bbe7f083414e2ad.zip
quota: Push dqio_sem down to ->read_dqblk()
Push down acquisition of dqio_sem into ->read_dqblk() callback. It will allow quota formats to decide whether they need it or not. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota/quota_v1.c')
-rw-r--r--fs/quota/quota_v1.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
index 8fe79beced5c..d534c4043237 100644
--- a/fs/quota/quota_v1.c
+++ b/fs/quota/quota_v1.c
@@ -56,10 +56,12 @@ static int v1_read_dqblk(struct dquot *dquot)
{
int type = dquot->dq_id.type;
struct v1_disk_dqblk dqblk;
+ struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
- if (!sb_dqopt(dquot->dq_sb)->files[type])
+ if (!dqopt->files[type])
return -EINVAL;
+ down_read(&dqopt->dqio_sem);
/* Set structure to 0s in case read fails/is after end of file */
memset(&dqblk, 0, sizeof(struct v1_disk_dqblk));
dquot->dq_sb->s_op->quota_read(dquot->dq_sb, type, (char *)&dqblk,
@@ -73,6 +75,7 @@ static int v1_read_dqblk(struct dquot *dquot)
dquot->dq_dqb.dqb_isoftlimit == 0)
set_bit(DQ_FAKE_B, &dquot->dq_flags);
dqstats_inc(DQST_READS);
+ up_read(&dqopt->dqio_sem);
return 0;
}