[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: CVS update: subversion/subversion/libsvn_fs dag.h

From: Greg Stein <gstein_at_lyra.org>
Date: 2000-12-09 04:29:31 CET

On Fri, Dec 08, 2000 at 04:33:25PM -0000, jimb@tigris.org wrote:
>...
> +/* Commit the transaction SVN_TXN in FS, as part of the Berkeley DB
> + transaction DB_TXN. This entails:
> + - marking the tree of mutable nodes at SVN_TXN's root as immutable,
> + and marking all their contents as stable
> + - creating a new revision, with SVN_TXN's root as its root directory
> + - deleting SVN_TXN from `transactions'
> +
> + Beware! This does not make sure that SVN_TXN is based on the very
> + latest revision in FS. If the caller doesn't take care of this,
> + you may lose people's work!

There is a race condition here.

Assume the FS does the check for the revision, then calls the commit
function. In between the check and the commit, somebody else could have
called commit_txn.

I believe that you want to pass a "base revision" number to the function.
Lock the root revision table, check if the base is the latest, commit the
change, then unlock the root table.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/
Received on Sat Oct 21 14:36:16 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.