Whamcloud - gitweb
b=614459
authorpschwan <pschwan>
Mon, 7 Oct 2002 16:46:26 +0000 (16:46 +0000)
committerpschwan <pschwan>
Mon, 7 Oct 2002 16:46:26 +0000 (16:46 +0000)
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
lustre/llite/file.c
lustre/osc/osc_request.c

index 3947602..87a9563 100644 (file)
@@ -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));
index 4170e6b..d54d1ba 100644 (file)
@@ -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,
index c38610f..0ede4f0 100644 (file)
@@ -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,