From c00c84cb9bba6311bbb8a8d97bf7e923149eb666 Mon Sep 17 00:00:00 2001 From: "Alexander.Zarochentsev" Date: Tue, 15 Jun 2010 23:00:13 +0400 Subject: [PATCH] b=22755 Don't leak grant if shrink grant comes in write RPC a=oleg.drokin i=di.wang i=andreas.dilger i=johann --- lustre/obdfilter/filter_io.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lustre/obdfilter/filter_io.c b/lustre/obdfilter/filter_io.c index 3b6c2fb..71d7e28 100644 --- a/lustre/obdfilter/filter_io.c +++ b/lustre/obdfilter/filter_io.c @@ -736,7 +736,11 @@ static int filter_preprw_write(int cmd, struct obd_export *exp, struct obdo *oa, /* do not zero out oa->o_valid as it is used in filter_commitrw_write() * for setting UID/GID and fid EA in first write time. */ - if (oa->o_valid & OBD_MD_FLGRANT) + /* If OBD_FL_SHRINK_GRANT is set, the client just returned us some grant + * so no sense in allocating it some more. We either return the grant + * back to the client if we have plenty of space or we don't return + * anything if we are short. This was decided in filter_grant_incoming*/ + if (oa->o_valid & OBD_MD_FLGRANT &&!(oa->o_valid & OBD_FL_SHRINK_GRANT)) oa->o_grant = filter_grant(exp, oa->o_grant, oa->o_undirty, left, 1); -- 1.8.3.1