Patch for lighttpd MKCOL

Justin Huff jjhuff at mspin.net
Tue Apr 10 22:38:04 UTC 2007


I'm using lighttpd (mogstored was leaking mem badly, still need to 
investigate), but I noticed that the tracker wasn't able to create 
directories.

The problem is that lighttpd returns a 405 when trying to create an 
existing dir.  This seems to be the proper behavior 
(http://www.webdav.org/specs/rfc2518.html#rfc.section.8.3.2).

I was getting occasional 403s on PUTs immediately after a MKCOL. I 
expected that the problem was lighttpd's stat caching. I tried 
disabling, but I'm still getting them. Any ideas?

I also noticed a lot of warnings about returning from a function with 
next.  Looks like that got missed in a refactoring.


--Justin

Index: server/lib/MogileFS/Device.pm
===================================================================
--- server/lib/MogileFS/Device.pm       (revision 801)
+++ server/lib/MogileFS/Device.pm       (working copy)
@@ -362,7 +362,7 @@
  sub create_directory {
      my ($self, $uri) = @_;
      return 1 if $self->doesnt_know_mkcol;
-    next if $dir_made{$uri};
+    return 0 if $dir_made{$uri};

      my $hostid = $self->hostid;
      my $host   = $self->host;
@@ -378,7 +378,7 @@
      my $ans = <$sock>;

      # if they don't support this method, remember that
-    if ($ans && $ans =~ m!HTTP/1\.[01] (400|405|501)!) {
+    if ($ans && $ans =~ m!HTTP/1\.[01] (400|501)!) {
          $self->{no_mkcol} = 1;
          # TODO: move this into method on device, which propogates to 
parent
          # and also receive from parent.  so all query workers share 
this knowledge


More information about the mogilefs mailing list