src/dbfs/op_base.c
changeset 40 03017f5f0087
parent 29 5de62ca9a5aa
--- a/src/dbfs/op_base.c	Wed Oct 22 18:17:08 2008 +0300
+++ b/src/dbfs/op_base.c	Wed Oct 22 21:07:17 2008 +0300
@@ -192,12 +192,26 @@
     
     // validate
     assert(op);
-    assert(!op->req);
     assert(op->open);
     assert(op->ino == ino);
+    
+    // detect concurrent requests
+    if (op->req) {
+        // must handle req ourself, shouldn't fail the other req
+        WARNING("op.%p: concurrent req: %p -> %p", op, op->req, req);
+        
+        // XXX: ignore error errors...
+        fuse_reply_err(req, EBUSY);
 
-    // store the new req
-    op->req = req;
+        return NULL;
+
+    } else
+        // store the new req
+        op->req = req;
+    
+    // inodes change?
+    if (op->ino != ino)
+        XERROR(err = EBADF, "op.%p: wrong ino: %u -> %lu", op, op->ino, ino);
     
     // detect earlier failures
     if (!op->trans && (err = EIO))