Skip to content

Commit

Permalink
quota: Acquire dqio_sem for reading in dquot_get_next_id()
Browse files Browse the repository at this point in the history
dquot_get_next_id() needs dqio_sem only for reading to protect against
racing with modification of quota file structure.

Reviewed-by: Andreas Dilger <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
  • Loading branch information
jankara committed Aug 17, 2017
1 parent 6267683 commit 0cff915
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/quota/dquot.c
Original file line number Diff line number Diff line change
Expand Up @@ -2079,9 +2079,9 @@ int dquot_get_next_id(struct super_block *sb, struct kqid *qid)
return -ESRCH;
if (!dqopt->ops[qid->type]->get_next_id)
return -ENOSYS;
down_write(&dqopt->dqio_sem);
down_read(&dqopt->dqio_sem);
err = dqopt->ops[qid->type]->get_next_id(sb, qid);
up_write(&dqopt->dqio_sem);
up_read(&dqopt->dqio_sem);
return err;
}
EXPORT_SYMBOL(dquot_get_next_id);
Expand Down

0 comments on commit 0cff915

Please sign in to comment.