I posted the above to stackoverflow – I am running a test does repeated file renames to a target file in one thread, and repeatedly reads that target file in another thread. This works fine except when there is a hard-link to the file being renamed to the target file. In this case the reading thread hits file not found errors (not always but often). This seems to break the sped for ‘rename’.
The test is:
for ((i=0; i < 1000; i=i+1)); do
echo "snafu$i" > $1/file$i;
ln $1/file$i $1/link$i
mv -f $1/file$i $1/target;
and the reading side:
if the linking step is removed from the writing thread, then no errors are seen as expected.
Does anyone know why the presence of the link causes read errors during the rename? I tried creating all the temporary files and links first, then pausing and then doing the rename loop – same erros are seen on the reading side.
This email has been sent by a member of the Man group (“Man”). Man’s parent company, Man Group plc, is registered in England and Wales (company number 2921462) at Riverbank House, 2 Swan Lane, London, EC4R 3AD.
The contents of this email are for the named addressee(s) only. It contains information which may be confidential and privileged. If you are not the intended recipient, please notify the sender immediately, destroy this email and any attachments and do not otherwise disclose or use them. Email transmission is not a secure method of communication and Man cannot accept responsibility for the completeness or accuracy of this email or any attachments. Whilst Man makes every effort to keep its network free from viruses, it does not accept responsibility for any computer virus which might be transferred by way of this email or any attachments. This email does not constitute a request, offer, recommendation or solicitation of any kind to buy, subscribe, sell or redeem any investment instruments or to perform other such transactions of any kind. Man reserves the right to monitor, record and retain all electronic and telephone communications through its network in accordance with applicable laws and regulations. --UwQe9f5k7pI3vplngP