0

I have samba (3.6.3-0.30.1-2920-SUSE-CODE11-x86_64) running on a SLES11 server which receives files from a Windows machine. The samba share is actually a NFS mount from an other server, and I need to use strict locking = no in smb.conf.

For reasons I cannot control, those files are pushed with a very shallow directory structure. I then need to move those files from the source to a destination somewhere else on the share with a deeper directory structure (basically splitting, matching and adding dates). I created a perl script (v5.10.0) that detects those source files, determines the target and then moves the file to their destination with the move function from File::Copy.

Can my files get corrupted? The files are rather small, but there are a lot of them so it so this event is not totally unlikely. Would the file be corrupted, or would samba continue to write to the new location without even seeing that the file is being moved? Or does File::Copy knows that the file is in use and will abort the script? (I use move($src, $dst) or die "Cannot move file $src to $dst: $!")

More generally, is this way of handling the situation safe or is there a better way to do it?

Calimo
  • 400
  • 1
  • 4
  • 15

1 Answers1

0

I performed some tests with very large files, and they did end up right even though move was called before the file was written. I guess that stands for a yes.

Calimo
  • 400
  • 1
  • 4
  • 15