Some problems on using GFS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear all,
 
We found some problems on using GFS. We are using RHEL 4U5 with CentOS 4U5 CSGFS RPMs.
 
Given the following PHP program (for testing):
 
<?php
 
  $input      = '/data08/test/src';
  $tmp_prefix = '/data08/test/tmp';
  $dest       = '/data08/test/dest';
  $hostname   = trim( shell_exec('hostname') );
  $pid        = posix_getpid();
 
  while ( true ) {
 
    $tmp = $tmp_prefix . '_' . microtime(true) . '_' . $hostname . '_' . $pid;
    copy( $input, $tmp );
 
    $is_success = rename( $tmp, $dest );
   
    if ( ! $is_success ) {
      echo 'error' . "\n\n";
    }
  }
 
?>
 

The above program only do a simple task:
 
  Copy the file "src" to a tmp file, and then rename the tmp file to "dest".
 
where "/data08/test/" is a directory mounted on GFS.
 
 
 
When two or more instances of this program running concurrently in different nodes, the rename operation was failed.
But there is no problem when two or more instance of this program running concurrently in the same node.
 

Example stderr when running the above program:
 
  PHP Warning:  rename(/data08/proga15_test/20090204/tmp_1233720656.1111_mp-bla03_18274,/data08/proga15_test/20090204/dest): No such file or directory in /data08.mount/proga15_test/20090204/t.php on line 14
  error
 
  PHP Warning:  rename(/data08/proga15_test/20090204/tmp_1233720656.9956_mp-bla03_18274,/data08/proga15_test/20090204/dest): No such file or directory in /data08.mount/proga15_test/20090204/t.php on line 14
  error
 
  PHP Warning:  rename(/data08/proga15_test/20090204/tmp_1233720659.7083_mp-bla03_18274,/data08/proga15_test/20090204/dest): No such file or directory in /data08.mount/proga15_test/20090204/t.php on line 14
  error
 
  PHP Warning:  rename(/data08/proga15_test/20090204/tmp_1233720661.1308_mp-bla03_18274,/data08/proga15_test/20090204/dest): No such file or directory in /data08.mount/proga15_test/20090204/t.php on line 14
  error
 
  PHP Warning:  rename(/data08/proga15_test/20090204/tmp_1233720662.5406_mp-bla03_18274,/data08/proga15_test/20090204/dest): No such file or directory in /data08.mount/proga15_test/20090204/t.php on line 14
  error
 
  PHP Warning:  rename(/data08/proga15_test/20090204/tmp_1233720663.9784_mp-bla03_18274,/data08/proga15_test/20090204/dest): No such file or directory in /data08.mount/proga15_test/20090204/t.php on line 14
  error
 
  PHP Warning:  rename(/data08/proga15_test/20090204/tmp_1233720665.5586_mp-bla03_18274,/data08/proga15_test/20090204/dest): No such file or directory in /data08.mount/proga15_test/20090204/t.php on line 14
  error
 
 

Then we've added a while loop before rename.
 
  while ( true ) {
 
    $tmp = $tmp_prefix . '_' . microtime(true) . '_' . $hostname . '_' . $pid;
    copy( $input, $tmp );

       while (!file_exists($tmp)) {}

    $is_success = rename( $tmp, $dest );
   
    if ( ! $is_success ) {
      echo 'error' . "\n\n";
    }
  }

The file really exists before rename. It does not generate an infinite loop and the same error occurred.

Any suggestion or idea?  Thanks a lot.

Regards,
PN

--
Linux-cluster mailing list
Linux-cluster@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/linux-cluster

[Index of Archives]     [Corosync Cluster Engine]     [GFS]     [Linux Virtualization]     [Centos Virtualization]     [Centos]     [Linux RAID]     [Fedora Users]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Camping]

  Powered by Linux