diff options
Diffstat (limited to 'fs/quota/quota.c')
-rw-r--r-- | fs/quota/quota.c | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/fs/quota/quota.c b/fs/quota/quota.c index 8680e257c2bd..d6ee49dda4fd 100644 --- a/fs/quota/quota.c +++ b/fs/quota/quota.c | |||
@@ -167,18 +167,44 @@ static int quota_getquota(struct super_block *sb, int type, qid_t id, | |||
167 | return 0; | 167 | return 0; |
168 | } | 168 | } |
169 | 169 | ||
170 | static void copy_from_if_dqblk(struct fs_disk_quota *dst, struct if_dqblk *src) | ||
171 | { | ||
172 | dst->d_blk_hardlimit = src->dqb_bhardlimit; | ||
173 | dst->d_blk_softlimit = src->dqb_bsoftlimit; | ||
174 | dst->d_bcount = src->dqb_curspace; | ||
175 | dst->d_ino_hardlimit = src->dqb_ihardlimit; | ||
176 | dst->d_ino_softlimit = src->dqb_isoftlimit; | ||
177 | dst->d_icount = src->dqb_curinodes; | ||
178 | dst->d_btimer = src->dqb_btime; | ||
179 | dst->d_itimer = src->dqb_itime; | ||
180 | |||
181 | dst->d_fieldmask = 0; | ||
182 | if (src->dqb_valid & QIF_BLIMITS) | ||
183 | dst->d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD; | ||
184 | if (src->dqb_valid & QIF_SPACE) | ||
185 | dst->d_fieldmask |= FS_DQ_BCOUNT; | ||
186 | if (src->dqb_valid & QIF_ILIMITS) | ||
187 | dst->d_fieldmask |= FS_DQ_ISOFT | FS_DQ_IHARD; | ||
188 | if (src->dqb_valid & QIF_INODES) | ||
189 | dst->d_fieldmask |= FS_DQ_ICOUNT; | ||
190 | if (src->dqb_valid & QIF_BTIME) | ||
191 | dst->d_fieldmask |= FS_DQ_BTIMER; | ||
192 | if (src->dqb_valid & QIF_ITIME) | ||
193 | dst->d_fieldmask |= FS_DQ_ITIMER; | ||
194 | } | ||
195 | |||
170 | static int quota_setquota(struct super_block *sb, int type, qid_t id, | 196 | static int quota_setquota(struct super_block *sb, int type, qid_t id, |
171 | void __user *addr) | 197 | void __user *addr) |
172 | { | 198 | { |
199 | struct fs_disk_quota fdq; | ||
173 | struct if_dqblk idq; | 200 | struct if_dqblk idq; |
174 | 201 | ||
175 | if (copy_from_user(&idq, addr, sizeof(idq))) | 202 | if (copy_from_user(&idq, addr, sizeof(idq))) |
176 | return -EFAULT; | 203 | return -EFAULT; |
177 | if (!sb_has_quota_active(sb, type)) | ||
178 | return -ESRCH; | ||
179 | if (!sb->s_qcop->set_dqblk) | 204 | if (!sb->s_qcop->set_dqblk) |
180 | return -ENOSYS; | 205 | return -ENOSYS; |
181 | return sb->s_qcop->set_dqblk(sb, type, id, &idq); | 206 | copy_from_if_dqblk(&fdq, &idq); |
207 | return sb->s_qcop->set_dqblk(sb, type, id, &fdq); | ||
182 | } | 208 | } |
183 | 209 | ||
184 | static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) | 210 | static int quota_setxstate(struct super_block *sb, int cmd, void __user *addr) |
@@ -212,9 +238,9 @@ static int quota_setxquota(struct super_block *sb, int type, qid_t id, | |||
212 | 238 | ||
213 | if (copy_from_user(&fdq, addr, sizeof(fdq))) | 239 | if (copy_from_user(&fdq, addr, sizeof(fdq))) |
214 | return -EFAULT; | 240 | return -EFAULT; |
215 | if (!sb->s_qcop->set_xquota) | 241 | if (!sb->s_qcop->set_dqblk) |
216 | return -ENOSYS; | 242 | return -ENOSYS; |
217 | return sb->s_qcop->set_xquota(sb, type, id, &fdq); | 243 | return sb->s_qcop->set_dqblk(sb, type, id, &fdq); |
218 | } | 244 | } |
219 | 245 | ||
220 | static int quota_getxquota(struct super_block *sb, int type, qid_t id, | 246 | static int quota_getxquota(struct super_block *sb, int type, qid_t id, |