diff --git a/mountpoint-s3/tests/reftests/harness.rs b/mountpoint-s3/tests/reftests/harness.rs
index 045362024..76b84d114 100644
--- a/mountpoint-s3/tests/reftests/harness.rs
+++ b/mountpoint-s3/tests/reftests/harness.rs
@@ -576,7 +576,21 @@ impl Harness {
         self.client.add_object(&key, object.clone());
         self.reference.add_remote_key(&key, object);
         // Any local directories along the path are made remote by adding this object
-        self.reference.remove_local_parents(key_as_path);
+        self.reference.remove_local_parents(key_as_path.clone());
+        // If we overwrite a file that is currently part of an inflight write
+        // we have to remove that inflight write, as otherwise we fail when opening the
+        // ino to continue writing.
+        let mut idx : i32 = -1;
+        for inflight_write in &self.inflight_writes.writes {
+            idx += 1;
+            if inflight_write.path == key_as_path {
+                break;
+            }
+        }
+
+        if idx != -1 {
+            self.inflight_writes.remove(InflightWriteIndex(idx as usize));
+        }
     }
 
     /// Perform a DeleteObject on the bucket, to simulate concurrent access to the bucket by a
@@ -1330,4 +1344,43 @@ mod mutations {
             0,
         )
     }
+
+    #[test]
+    fn regression_stale_ino() {
+        run_test(
+            TreeNode::Directory(BTreeMap::from([])),
+            vec![
+                Op::CreateFile(
+                    ValidName(
+                        "a".into(),
+                    ),
+                    DirectoryIndex(
+                        0,
+                    ),
+                    FileContent(
+                        0,
+                        FileSize::Small(0),
+                    ),
+                ),
+                Op::PutObject(
+                    DirectoryIndex(
+                        0,
+                    ),
+                    Name(
+                        "a/a".into(),
+                    ),
+                    FileContent(
+                        0,
+                        FileSize::Small(0),
+                    ),
+                ),
+                Op::FinishWrite(
+                    InflightWriteIndex(
+                        0,
+                    ),
+                ),
+            ],
+            0
+        );
+    }
 }