[PATCH] use tdbbackup, not shutil.copy, skip 'upgrade' of privileges.ldb

Andrew Bartlett abartlet at samba.org
Sun Feb 17 02:09:51 MST 2013


On Sun, 2013-02-17 at 10:41 +0200, Michael Wood wrote:
> On 17 February 2013 10:39, Michael Wood <esiotrot at gmail.com> wrote:
> > Hi
> >
> > On 17 February 2013 10:09, Andrew Bartlett <abartlet at samba.org> wrote:
> >> This series of patches (in on and top of my upgradeprovision branch)
> >> makes an important fix to the upgrade code, because calling shutil.copy
> >> is NOT A SAFE WAY to deal with tdb (indeed any) databases.
> >
> > I thought shutil.copy would be perfectly safe as long as Samba was
> > shut down at the time.  Is this not the case?
> 
> Never mind.  I've just realised that upgradeprovision would be
> accessing tdb files, so shutil.copy does seem suspect, unless it does
> the copies in such a way that there's no chance that any tdb files are
> open at the time.

In converting this, I actually proved this would be an issue, as it
deadlocked waiting for a lock on privileges.ldb (that's why that patch
is first). 

Even aside from the braindamage of posix locking, I don't want to make
assumptions about what other processes are reading the database at the
time (it just isn't reliable to just punt on that kind of thing). 

Andrew Bartlett

-- 
Andrew Bartlett                                http://samba.org/~abartlet/
Authentication Developer, Samba Team           http://samba.org




More information about the samba-technical mailing list