[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reference counting in netfs

From: Ludovic Courtès
Subject: Re: Reference counting in netfs
Date: Sun, 5 Jan 2003 14:29:19 +0100
User-agent: Mutt/1.3.28i

On Sat, Jan 04, 2003 at 04:44:34PM +0100, Ludovic Courtès wrote:
> If the above scenario is correct, using a mutex for the refcnt count should
> remove the problem since it would enforce the order in which reference
> counts are changed (ie. the ref count would be decreased *before*
> attempt_unlink () checks its value).

I have actually compiled a libnetfs that uses a mutex instead of the spin
lock and recompiled tarfs with it.  Unfortunately, it doesn't make any

Looking more closely at what happens, it turns out that the execution order
on the client side (lookup, deallocate, unlink) is not enforced on the
server side: the corresponding peropen is not necessarily released before
the unlink.  In the following example, thread 1 is unlinking while thread 3
is releasing a peropen:

  5 thread 3109.5  0x01059508 in cthread_body () from /lib/
  4 thread 3109.4  0x010434f4 in netfs_release_peropen (po=0x8073600)
    at /include/machine-lock.h:52
  3 thread 3109.3  netfs_release_peropen (po=0x8073748)
    at /include/machine-lock.h:52
  2 thread 3109.2  0x010ca4cc in evc_wait () from /lib/
* 1 thread 3109.1  0x010e1702 in _hurd_intr_rpc_mach_msg () from 

How can we make sure the reference is dropped *before* attempt_unlink is


reply via email to

[Prev in Thread] Current Thread [Next in Thread]