[Box Backup] backup on nfs-mounted storage

Chris Wilson boxbackup@fluffy.co.uk
Tue, 17 Oct 2006 21:20:12 +0100 (BST)


Hi Ruben,

On Tue, 17 Oct 2006, ruben wrote:

> The bbstored user can create and delete files on the NFS mounted 
> storage.  "root" can create files, but its uid is mapped to the "nobody" 
> uid.  So, root cannot modify files from bbstored.  Should this 
> configuration work?

It depends on whether you need to use the root account for anything. My 
guess is that you might have problems running "bbstoreaccounts check", 
"create", etc. unless you run them as the bbstored user.

You can probably reconfigure the NAS box to squash root to the bbstored 
user instead of the anonymous user. If it runs Linux, that should be as 
simple as adding "(...,anonuid=<uid of bbstored user>)" to the appropriate 
entry/entries in /etc/exports, and running "exportfs -a".

> I assume the problem is the following:
> flock(3, LOCK_EX|LOCK_NB)               = -1 ENOLCK (No locks available)

Yes, that will cause the exception you saw.

> Hmm... I just looked at the source code, and I guess this is indeed the 
> problem.  On Linux, flock can't lock files which are on NFS-mounted 
> storage, one should use fcntl for that.  I see in the source code 
> (NamedLock.cpp) that there is an alternative lock implementation that 
> uses fcntl (if HAVE_DECL_F_SETLK is defined).
>
> So, this should in principle work, if I compile it with the fcntl 
> implementation?

I think so, but I'm not 100% positive that fcntl locks work on NFS either.

> Are there any drawbacks on using the fcntl implementation instead of 
> flock?

I'm not aware of any, but I'm not the best person to ask (Ben or Martin 
would certainly know better than me). Box Backup does its own account 
locking, and bbackupd should not request write access to more than one 
file at a time, as far as I know, so the lock should not actually be 
needed anyway in normal use, as far as I know.

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |