From f38be400af1a453ba83ae10242e1b9a59dbb363e Mon Sep 17 00:00:00 2001
From: uid707 <uid707>
Date: Tue, 9 Mar 2004 08:47:20 +0000
Subject: [PATCH] Set loi_kms_valid even if we get a lock back that has rss ==
 kms.  This happens for zero-length files, and without this we will revoke our
 own lock the next time we write to the file because osc_enqueue() won't
 match. b=2818

---
 lustre/lov/lov_obd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lustre/lov/lov_obd.c b/lustre/lov/lov_obd.c
index 6267ef541d..9c9fbb1e94 100644
--- a/lustre/lov/lov_obd.c
+++ b/lustre/lov/lov_obd.c
@@ -2080,10 +2080,11 @@ static int lov_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm,
 
                         LASSERT(lock != NULL);
                         loi->loi_rss = tmp;
-                        // Extend KMS up to the end of this lock, and no further
+                        /* Extend KMS up to the end of this lock and no further
+                         * A lock on [x,y] means a KMS of up to y + 1 bytes! */
                         if (tmp > lock->l_policy_data.l_extent.end)
                                 tmp = lock->l_policy_data.l_extent.end + 1;
-                        if (tmp > loi->loi_kms) {
+                        if (tmp >= loi->loi_kms) {
                                 CDEBUG(D_INODE, "lock acquired, setting rss="
                                        LPU64", kms="LPU64"\n", loi->loi_rss,
                                        tmp);
-- 
GitLab