From 5c8853a32d3076ad89266dfc4af9a1f0848ef740 Mon Sep 17 00:00:00 2001 From: Fan Yong Date: Wed, 6 Feb 2013 00:38:04 +0800 Subject: [PATCH] LU-2645 ldlm: use correct lvb size to reply 1.8 lock enqueue For 1.8 client, it does not support variable-sized LVB. The 2.4 server should correctly distinguish whether the client support it or not, and fill the reply buffer with suitable LVB size when processing lock enqueue. Test-Parameters: envdefinitions=SLOW=yes,ENABLE_QUOTA=yes \ clientjob=lustre-b1_8 clientbuildno=256 testlist=runtests Signed-off-by: Fan Yong Change-Id: I9241efe25dc64b26e86c4e75da72ab74bb1bc750 Reviewed-on: http://review.whamcloud.com/5459 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Jinshan Xiong Reviewed-by: Jian Yu Reviewed-by: Keith Mannthey Reviewed-by: Oleg Drokin --- lustre/ofd/ofd_lvb.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lustre/ofd/ofd_lvb.c b/lustre/ofd/ofd_lvb.c index edadc69..be22922 100644 --- a/lustre/ofd/ofd_lvb.c +++ b/lustre/ofd/ofd_lvb.c @@ -281,7 +281,13 @@ static int ofd_lvbo_size(struct ldlm_lock *lock) static int ofd_lvbo_fill(struct ldlm_lock *lock, void *buf, int buflen) { struct ldlm_resource *res = lock->l_resource; - int lvb_len = min_t(int, res->lr_lvb_len, buflen); + int lvb_len; + + lvb_len = ofd_lvbo_size(lock); + LASSERT(lvb_len <= res->lr_lvb_len); + + if (lvb_len > buflen) + lvb_len = buflen; lock_res(res); memcpy(buf, res->lr_lvb_data, lvb_len); -- 1.8.3.1