summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2017-06-08 15:05:08 +0200
committerJan Kara <jack@suse.cz>2017-08-17 18:58:44 +0200
commit0cff9151d3fa27574c2201377a080e1b9b87b8ba (patch)
tree47e6eeb87319a8908488e53894ed2469a0f0241b
parent62676838cb39f4e4f44dd697c4d5d4214bda8cb1 (diff)
downloadlinux-0cff9151d3fa27574c2201377a080e1b9b87b8ba.tar.bz2
quota: Acquire dqio_sem for reading in dquot_get_next_id()
dquot_get_next_id() needs dqio_sem only for reading to protect against racing with modification of quota file structure. Reviewed-by: Andreas Dilger <adilger@dilger.ca> Signed-off-by: Jan Kara <jack@suse.cz>
-rw-r--r--fs/quota/dquot.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
index 21358f31923d..8d5ccad3bf3e 100644
--- a/fs/quota/dquot.c
+++ b/fs/quota/dquot.c
@@ -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);