diff options
author | Ossama Othman <ossama.othman@intel.com> | 2013-11-25 15:00:02 -0800 |
---|---|---|
committer | Ossama Othman <ossama.othman@intel.com> | 2013-11-25 15:00:02 -0800 |
commit | 47ae1cde69cd6bf2c22e20902cefa3f0e25c8cb4 (patch) | |
tree | add9aa20a19f410a91522d4b95df3e93c57f8637 /quotaio_v1.c | |
parent | 8c82de96cd23e4823a2d29eb2de2295c0866b0c9 (diff) | |
download | quota-47ae1cde69cd6bf2c22e20902cefa3f0e25c8cb4.tar.gz quota-47ae1cde69cd6bf2c22e20902cefa3f0e25c8cb4.tar.bz2 quota-47ae1cde69cd6bf2c22e20902cefa3f0e25c8cb4.zip |
Change-Id: I2271f01ae7877d43dde2432a45b49b910ddb6f8f
Signed-off-by: Ossama Othman <ossama.othman@intel.com>
Diffstat (limited to 'quotaio_v1.c')
-rw-r--r-- | quotaio_v1.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/quotaio_v1.c b/quotaio_v1.c index 0edbc16..61bd93e 100644 --- a/quotaio_v1.c +++ b/quotaio_v1.c @@ -174,6 +174,10 @@ static int v1_init_io(struct quota_handle *h) h->qh_info.dqi_bgrace = MAX_DQ_TIME; if (!h->qh_info.dqi_igrace) h->qh_info.dqi_igrace = MAX_IQ_TIME; + h->qh_info.dqi_max_b_limit = ~(uint32_t)0; + h->qh_info.dqi_max_i_limit = ~(uint32_t)0; + h->qh_info.dqi_max_b_usage = ((uint64_t)(~(uint32_t)0)) << V1_DQBLK_SIZE_BITS; + h->qh_info.dqi_max_i_usage = ~(uint32_t)0; return 0; } @@ -191,6 +195,10 @@ static int v1_new_io(struct quota_handle *h) ddqblk.dqb_itime = MAX_IQ_TIME; h->qh_info.dqi_bgrace = MAX_DQ_TIME; h->qh_info.dqi_igrace = MAX_IQ_TIME; + h->qh_info.dqi_max_b_limit = ~(uint32_t)0; + h->qh_info.dqi_max_i_limit = ~(uint32_t)0; + h->qh_info.dqi_max_b_usage = ((uint64_t)(~(uint32_t)0)) << V1_DQBLK_SIZE_BITS; + h->qh_info.dqi_max_i_usage = ~(uint32_t)0; lseek(h->qh_fd, 0, SEEK_SET); if (write(h->qh_fd, &ddqblk, sizeof(ddqblk)) != sizeof(ddqblk)) return -1; @@ -327,6 +335,10 @@ static int v1_commit_dquot(struct dquot *dquot, int flags) } } else { + if (check_dquot_range(dquot) < 0) { + errno = ERANGE; + return -1; + } v1_mem2diskdqblk(&ddqblk, &dquot->dq_dqb); lseek(h->qh_fd, (long)V1_DQOFF(dquot->dq_id), SEEK_SET); if (write(h->qh_fd, &ddqblk, sizeof(ddqblk)) != sizeof(ddqblk)) @@ -348,11 +360,6 @@ static int v1_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct d struct dquot *dquot = get_empty_dquot(); qid_t id = 0; - if (QIO_ENABLED(h)) /* Kernel uses same file? */ - if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type), - h->qh_quotadev, 0, NULL) < 0) - die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev, - strerror(errno)); memset(dquot, 0, sizeof(*dquot)); dquot->dq_h = h; lseek(h->qh_fd, 0, SEEK_SET); |