[haiku-gsoc] Re: [HCD]: Bfs bug #1

  • From: "Salvatore Benedetto" <emitrax@xxxxxxxxx>
  • To: haiku-gsoc@xxxxxxxxxxxxx
  • Date: Thu, 19 Jun 2008 20:50:16 +0000

Hi there,

I've been able to find out more about this bug thanks to Ingo suggestions.

First of all, after adding that check with the boolean value in the Vnode class,
bfs does not crash anymore, but the problem still exist of course, it
is just hidden.

I'm not sure if the problem about a vnode not becoming unbusy is about
a race condition,
though condition variables should be used as Ingo pointed out.

Anyway, the other thread that acquires a reference to of the vnde is
the page writer thread and
the low memory handler thread.

Screenshots are attached to bug #2400.

I had a look at the page writer thread and it seems that the thread can acquire
the same reference twice and not realising it at all if the state of
the page is not modified.
See the code belove.

- page writer thread -
            if (cache->store->ops->acquire_unreferenced_ref != NULL) {
                // we need our own reference to the store, as it might
                // currently be destructed
                if (cache->store->ops->acquire_unreferenced_ref(cache->store)
                        != B_OK) {

- At this point we have a reference to the vnode -
            InterruptsSpinLocker locker(sPageLock);

            // state might have change while we were locking the cache
            if (page->state != PAGE_STATE_MODIFIED)

continue; brings us back to the while without realising the reference and
possibly acquiring it once again, thus the error. Unless I am missing something
of course. I'll re-run the test with a patch that releases the reference.

I'm taking a look at the low memory thread handler now.

Any comments?

BTW: I changed the summary of the ticket as this is not a bfs problem,
but rather a vfs one,
so if mentors think I should go "back" to my HCD just let me know please.

Salvatore Benedetto (a.k.a. emitrax)
Student of Computer Engineer
University of Pisa

Other related posts: