summaryrefslogtreecommitdiff
path: root/fs/quota/quota_v1.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-06-08 15:48:16 +0200
committerJan Kara <jack@suse.cz>2017-08-17 19:03:09 +0200
commit8fc32c2b0db2c9ee0dffebea65bcdea03a29ba5a (patch)
tree1ad92b623f562ac9f160fb4ea8e4c9073d2cb4f5 /fs/quota/quota_v1.c
parent47cdc11deed639ae1d4050efbc284d328c3c2fa5 (diff)
quota: Push dqio_sem down to ->write_dqblk()
Push down acquisition of dqio_sem into ->write_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.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/quota/quota_v1.c b/fs/quota/quota_v1.c
index 12d69cda57cc..94cceb76b9a3 100644
--- a/fs/quota/quota_v1.c
+++ b/fs/quota/quota_v1.c
@@ -83,7 +83,9 @@ static int v1_commit_dqblk(struct dquot *dquot)
short type = dquot->dq_id.type;
ssize_t ret;
struct v1_disk_dqblk dqblk;
+ struct quota_info *dqopt = sb_dqopt(dquot->dq_sb);
+ down_write(&dqopt->dqio_sem);
v1_mem2disk_dqblk(&dqblk, &dquot->dq_dqb);
if (((type == USRQUOTA) && uid_eq(dquot->dq_id.uid, GLOBAL_ROOT_UID)) ||
((type == GRPQUOTA) && gid_eq(dquot->dq_id.gid, GLOBAL_ROOT_GID))) {
@@ -97,6 +99,7 @@ static int v1_commit_dqblk(struct dquot *dquot)
ret = dquot->dq_sb->s_op->quota_write(dquot->dq_sb, type,
(char *)&dqblk, sizeof(struct v1_disk_dqblk),
v1_dqoff(from_kqid(&init_user_ns, dquot->dq_id)));
+ up_write(&dqopt->dqio_sem);
if (ret != sizeof(struct v1_disk_dqblk)) {
quota_error(dquot->dq_sb, "dquota write failed");
if (ret >= 0)