Changeset 18463
- Timestamp:
- Jul 10, 2008, 1:21:27 PM (18 years ago)
- Location:
- trunk/Nebulous
- Files:
-
- 3 edited
-
Changes (modified) (1 diff)
-
lib/Nebulous/Client.pm (modified) (2 diffs)
-
lib/Nebulous/Util.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/Changes
r18455 r18463 1 1 Revision history for Nebulous 2 3 0.10 4 - retry all calls to open() 2 5 3 6 0.09 Wed Jul 9 16:36:27 HST 2008 -
trunk/Nebulous/lib/Nebulous/Client.pm
r18455 r18463 1 1 # Copyright (c) 2004-2008 Joshua Hoblitt 2 2 # 3 # $Id: Client.pm,v 1.5 6 2008-07-10 02:38:58jhoblitt Exp $3 # $Id: Client.pm,v 1.57 2008-07-10 23:21:27 jhoblitt Exp $ 4 4 5 5 package Nebulous::Client; … … 171 171 $log->debug( "URI is: $uri" ); 172 172 173 # XXX this is a attempt to work around some sort of nasty NFS bug where174 # occasionally stat()/open() on a file on an NFS mounted filesystem will175 # fail EVEN THOU THE FILE ACTUALLY EXISTS.176 #177 # The instance file attempting to be opened should always exist as it was178 # created by the Nebulous server.179 173 my $fh; 180 for (my $i = 0; $i < 10; $i++) { 181 eval { 182 $fh = _open_uri( $uri, '+<' ); 183 }; 184 if ($@ =~ qr/file doesn't exist/) { 185 $self->set_err($@); 186 sleep 1; 187 } else { 188 last; 189 } 190 } 174 eval { 175 $fh = _open_uri( $uri, '+<' ); 176 }; 191 177 $log->logdie( $@ ) if $@; 192 178 -
trunk/Nebulous/lib/Nebulous/Util.pm
r17845 r18463 1 1 # Copyright (c) 2004 Joshua Hoblitt 2 2 # 3 # $Id: Util.pm,v 1.1 2 2008-05-29 03:59:30jhoblitt Exp $3 # $Id: Util.pm,v 1.13 2008-07-10 23:21:27 jhoblitt Exp $ 4 4 5 5 package Nebulous::Util; … … 70 70 my ( $path, $flags ) = @_; 71 71 72 die "can't open file $path: file doesn't exist" 73 unless -e $path; 74 CORE::open( my $fh, $flags, $path ) 75 or die "can't open file $path: $!"; 76 72 # XXX this is a attempt to work around some sort of nasty NFS bug where 73 # occasionally stat()/open() on a file on an NFS mounted filesystem will 74 # fail EVEN THOU THE FILE ACTUALLY EXISTS. 75 # 76 # The instance file attempting to be opened should always exist as it was 77 # created by the Nebulous server. 78 my $fh; 79 for (my $i = 0; $i < 60; $i++) { 80 eval { 81 die "can't open file $path: file doesn't exist" 82 unless -e $path; 83 CORE::open($fh, $flags, $path) 84 or die "can't open file $path: $!"; 85 }; 86 if ($@ =~ qr/file doesn't exist/) { 87 sleep 1; 88 next; 89 } 90 if ($@) { 91 die $@; 92 } 93 94 last; 95 } 96 77 97 return $fh; 78 98 }
Note:
See TracChangeset
for help on using the changeset viewer.
