From 1184169e91a7d37f7f95267940322009d4bf9fde Mon Sep 17 00:00:00 2001 From: Jan Kara Date: Tue, 9 Feb 2010 18:20:39 +0100 Subject: [PATCH] quota: Fix warning when a delayed write happens before quota is enabled If a delayed-allocation write happens before quota is enabled, the kernel spits out a warning: WARNING: at fs/quota/dquot.c:988 dquot_claim_space+0x77/0x112() because the fact that user has some delayed allocation is not recorded in quota structure. There is no way to really avoid this so just remove the warning and make sure that reserved quota space does not go negative. Signed-off-by: Jan Kara --- fs/quota/dquot.c | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index f11255b..7066c21 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -985,7 +985,7 @@ static inline void dquot_resv_space(struct dquot *dquot, qsize_t number) static void dquot_claim_reserved_space(struct dquot *dquot, qsize_t number) { - WARN_ON(dquot->dq_dqb.dqb_rsvspace < number); + number = min_t(qsize_t, dquot->dq_dqb.dqb_rsvspace, number); dquot->dq_dqb.dqb_curspace += number; dquot->dq_dqb.dqb_rsvspace -= number; } @@ -993,7 +993,10 @@ static void dquot_claim_reserved_space(struct dquot *dquot, static inline void dquot_free_reserved_space(struct dquot *dquot, qsize_t number) { - dquot->dq_dqb.dqb_rsvspace -= number; + if (dquot->dq_dqb.dqb_rsvspace >= number) + dquot->dq_dqb.dqb_rsvspace -= number; + else + dquot->dq_dqb.dqb_rsvspace = 0; } static void dquot_decr_inodes(struct dquot *dquot, qsize_t number) -- 1.6.4.2