From 21725c3d34b4bdd9fbf2b73dd96e020b4d86b052 Mon Sep 17 00:00:00 2001 From: pschwan Date: Mon, 7 Oct 2002 16:46:26 +0000 Subject: [PATCH] b=614459 b=618273 Peter opened my eyes to a serious problem with the OSC, which was the cause of the O_APPEND extent bug. --- lustre/ldlm/ldlm_request.c | 6 +++++- lustre/llite/file.c | 2 +- lustre/osc/osc_request.c | 9 ++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 3947602..87a9563 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -211,9 +211,13 @@ int ldlm_cli_enqueue(struct lustre_handle *connh, body = lustre_msg_buf(req->rq_reqmsg, 0); ldlm_lock2desc(lock, &body->lock_desc); /* Phil: make this part of ldlm_lock2desc */ - if (type == LDLM_EXTENT) + if (type == LDLM_EXTENT) { memcpy(&body->lock_desc.l_extent, cookie, sizeof(body->lock_desc.l_extent)); + CDEBUG(D_INFO, "extent in body: "LPU64" -> "LPU64"\n", + body->lock_desc.l_extent.start, + body->lock_desc.l_extent.end); + } body->lock_flags = *flags; memcpy(&body->lock_handle1, lockh, sizeof(*lockh)); diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 4170e6b..d54d1ba 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -157,7 +157,7 @@ int ll_size_lock(struct inode *inode, struct lov_stripe_md *lsm, __u64 start, RETURN(-ENOMEM); extent.start = start; - extent.end = ~0; + extent.end = OBD_PUNCH_EOF; rc = obd_enqueue(&sbi->ll_osc_conn, lsm, NULL, LDLM_EXTENT, &extent, sizeof(extent), mode, &flags, ll_lock_callback, diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index c38610f..0ede4f0 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -623,10 +623,13 @@ static int osc_enqueue(struct lustre_handle *connh, struct lov_stripe_md *lsm, int rc; ENTRY; - /* Filesystem locks are given a bit of special treatment: first we + /* Filesystem locks are given a bit of special treatment: if + * this is not a file size lock (which has end == -1), we * fixup the lock to start and end on page boundaries. */ - extent->start &= PAGE_MASK; - extent->end = (extent->end + PAGE_SIZE - 1) & PAGE_MASK; + if (extent->end != OBD_PUNCH_EOF) { + extent->start &= PAGE_MASK; + extent->end = (extent->end + PAGE_SIZE - 1) & PAGE_MASK; + } /* Next, search for already existing extent locks that will cover us */ rc = ldlm_lock_match(obddev->obd_namespace, res_id, type, extent, -- 1.8.3.1