[haiku-commits] r37687 - haiku/trunk/src/tests/system/kernel/file_corruption/fs

  • From: ingo_weinhold@xxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 22 Jul 2010 14:20:45 +0200 (CEST)

Author: bonefish
Date: 2010-07-22 14:20:45 +0200 (Thu, 22 Jul 2010)
New Revision: 37687
Changeset: http://dev.haiku-os.org/changeset/37687

Modified:
   haiku/trunk/src/tests/system/kernel/file_corruption/fs/checksumfs.cpp
Log:
* checksumfs_lookup(): The flags return parameter was never set, leading to
  weird behavior when running in kernel.
* checksumfs_io(): Try to lock with timeout when the request is VIP. This
  works around a potential quasi-deadlock: Most write support FS hooks
  potentially allocate memory (e.g. in block_cache_get*()) while holding a
  write lock to a node. When memory is low they have to wait for pages to
  become available. The page writer might block on such node which in turn
  would prevent modified pages from becoming eligible for recycling. Should
  only in rare low memory cases have led to a problem.


Modified: haiku/trunk/src/tests/system/kernel/file_corruption/fs/checksumfs.cpp
===================================================================
--- haiku/trunk/src/tests/system/kernel/file_corruption/fs/checksumfs.cpp       
2010-07-22 12:09:44 UTC (rev 37686)
+++ haiku/trunk/src/tests/system/kernel/file_corruption/fs/checksumfs.cpp       
2010-07-22 12:20:45 UTC (rev 37687)
@@ -975,6 +975,7 @@
        vnode->private_node = node;
        vnode->ops = &gCheckSumFSVnodeOps;
        *_type = node->Mode();
+       *_flags = 0;
 
        return B_OK;
 }
@@ -1083,7 +1084,15 @@
        }
 
        // Read-lock the file -- we'll unlock it in the finished hook.
-       file->ReadLock();
+       if (io_request_is_vip(request)) {
+               // We cannot wait for the node lock indefinitely. So try 
read-locking
+               // with a timeout (0.1 s).
+               if (!file->ReadLockWithTimeout(B_RELATIVE_TIMEOUT, 100000)) {
+               notify_io_request(request, B_BUSY);
+                       RETURN_ERROR(B_BUSY);
+               }
+       } else
+               file->ReadLock();
 
        RETURN_ERROR(do_iterative_fd_io(volume->FD(), request,
                iterative_io_get_vecs_hook, iterative_io_finished_hook, file));


Other related posts:

  • » [haiku-commits] r37687 - haiku/trunk/src/tests/system/kernel/file_corruption/fs - ingo_weinhold