You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Graham Leggett <mi...@sharp.fm> on 2005/11/24 10:21:22 UTC

MacOSX client, WinXP server, locking problems

Hi all,

While trying to do a subversion operation from a MacOSX machine within a
volume mounted from a WinXP share, I am getting the following error:

subversion/libsvn_subr/io.c:2137: (apr_err=5)
svnadmin: Can't write to file 'rfs-draft/db/write-lock': Input/output error

It looks like locking isn't supported within APR on MacOSX, or maybe this
is a pure MacOSX limitation.

Can anyone confirm whether APR's locking works on WinXP shares mounted on
MacOSX?

I am trying to work out whether this is a config error, or whether it's
just not possible on the platform.

Regards,
Graham
--


Re: MacOSX client, WinXP server, locking problems

Posted by mark benedetto king <mb...@lowlatency.com>.
On Thu, Nov 24, 2005 at 11:21:22AM +0200, Graham Leggett wrote:
> Hi all,
> 
> While trying to do a subversion operation from a MacOSX machine within a
> volume mounted from a WinXP share, I am getting the following error:
> 
> subversion/libsvn_subr/io.c:2137: (apr_err=5)
> svnadmin: Can't write to file 'rfs-draft/db/write-lock': Input/output error
> 
> It looks like locking isn't supported within APR on MacOSX, or maybe this
> is a pure MacOSX limitation.
> 
> Can anyone confirm whether APR's locking works on WinXP shares mounted on
> MacOSX?
> 
> I am trying to work out whether this is a config error, or whether it's
> just not possible on the platform.
> 
> Regards,
> Graham
> --


I was unable to reproduce this behaviour.  Can you be more specific
about what software and OS versions are involved, and how the share
is configured?

--ben


Re: MacOSX client, WinXP server, locking problems

Posted by Brian Pane <br...@apache.org>.
On Nov 25, 2005, at 5:31 AM, Joe Orton wrote:

> On Thu, Nov 24, 2005 at 11:21:22AM +0200, Graham Leggett wrote:
>> Hi all,
>>
>> While trying to do a subversion operation from a MacOSX machine  
>> within a
>> volume mounted from a WinXP share, I am getting the following error:
>>
>> subversion/libsvn_subr/io.c:2137: (apr_err=5)
>> svnadmin: Can't write to file 'rfs-draft/db/write-lock': Input/ 
>> output error
>>
>> It looks like locking isn't supported within APR on MacOSX, or  
>> maybe this
>> is a pure MacOSX limitation.
>
> Probably merely that file locking over SMB/CIFS doesn't work properly,
> though the error message is weird, suggesting that it's a write()
> failure rather than a failure-to-lock.  truss/strace might help show
> what syscall is failing if OS X has such a tool.

OS X has ktrace and kdump, which together can provide a trace of
various things including syscalls.

Brian


Re: MacOSX client, WinXP server, locking problems

Posted by Joe Orton <jo...@redhat.com>.
On Thu, Nov 24, 2005 at 11:21:22AM +0200, Graham Leggett wrote:
> Hi all,
> 
> While trying to do a subversion operation from a MacOSX machine within a
> volume mounted from a WinXP share, I am getting the following error:
> 
> subversion/libsvn_subr/io.c:2137: (apr_err=5)
> svnadmin: Can't write to file 'rfs-draft/db/write-lock': Input/output error
> 
> It looks like locking isn't supported within APR on MacOSX, or maybe this
> is a pure MacOSX limitation.

Probably merely that file locking over SMB/CIFS doesn't work properly, 
though the error message is weird, suggesting that it's a write() 
failure rather than a failure-to-lock.  truss/strace might help show 
what syscall is failing if OS X has such a tool.

joe

Re: MacOSX client, WinXP server, locking problems

Posted by "B. Wells" <b_...@appleisp.net>.
On Nov 24, 2005, at 4:21 AM, Graham Leggett wrote:

> Can anyone confirm whether APR's locking works on WinXP shares  
> mounted on
> MacOSX?

To understand how APR locks files on Mac OS X, take a look at the  
file_io/unix/flock.c file in the APR distribution. You will see that  
the source will compile to use fcntl if that is present or fall back  
to the older (and in some cases less reliable) flock. With Mac OS X,  
fcntl is present and therefore used by APR for file locking.

I also ran into issues with using Subversion on Mac OS X when the  
repositories are located on network shares. It was not surprising  
when Berkeley DB repositories failed, because the Subversion Book  
states in part "If you need multiple computers to access the  
repository, you create an FSFS repository on the network share, not a  
Berkeley DB repository." Unfortunately, even the FSFS repositories  
failed on network shares.

Some tests with fcntl and flock revealed the cause of the problem.  
Here are the results:

HFS Local Drives - fcntl and flock work as expected
AFP Network Share - fcntl not supported; flock seems to work, but no  
locking really happens!
SMB Network Share - fcntl not supported; flock works, but shared  
locks act like exclusive locks

So the obvious thing to do first is to have the flock.c source check  
to see if the file is on an SMB share and use flock instead of fcntl.  
It doesn't stop there, though. Subversion makes recursive shared  
locks on a file. Usually this is not a problem, but it doesn't work  
since shared locks are acting like exclusive locks as revealed in the  
test results. Some sort of convoluted tracking mechanism would be  
needed for these locks to act as proper shared locks...

I was determined to get Subversion working on the SMB network shares  
at work as they haven't yet let me set up a dedicated Subversion  
server. So I wrote a patch for APR 0.9.6 as distributed with  
Subversion 1.2.0. This patch will add extra code when compiled on Mac  
OS X so that SMB shares are special cased for (mostly) proper file  
locking. On other platforms, the patched flock.c compiles as before.  
Feel free to fetch a copy of the patch and make use of it.

http://homepage.mac.com/brianwells/.Public/svn_darwin_flock_patch

It so happens that Subversion 1.2.3 still uses APR 0.9.6, so the  
patch should work fine. The flock.c file has not changed with APR  
0.9.7 or 1.2.2, so the patch may even work for those versions of APR.

Let me know if any of you have questions or suggestions regarding the  
patch.

Thanks,

– Brian Wells
b_wells@appleisp.net