https://bugzilla.novell.com/show_bug.cgi?id=760926
https://bugzilla.novell.com/show_bug.cgi?id=760926#c1
Philipp Thomas changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P5 - None |P2 - High
Status|NEW |ASSIGNED
Target Milestone|--- |Factory
--- Comment #1 from Philipp Thomas 2012-05-07 13:53:45 CEST ---
Neil Brown analyzed this:
This is subtle....
The problem is that 'cp' is being clever - too clever.
When you run
cp submit.sh $submit_sh
cp first checks if $submit_sh exists. If it does, it just opens with
O_WRONLY | O_TRUNC
in particular it doesn't include O_CREAT - after all it doesn't need to.
Maybe this is a bug in 'cp', but maybe this is intended behaviour.
In any case, when cp check if the file exists, NFS thinks it does. It
certainly did recently and as it is caching attributes it assumes that it still
does until proven otherwise.
Then when cp tries to open, it finds out that the file does exist, and reports
either "Stale NFS file handle" or "No such file or directory" - I've seen both
errors.
There is nothing that can be done in the NFS code to "fix" this except to turn
off attribute cache.
What is effectively happening is the file is disappearing between the 'lstat'
and the 'open' and cp doesn't cope.
Options:
- file a bug report against 'cp' suggesting that if the open fails, then it
should retry using O_CREAT.
- don't use cp, just "cat submit.sh > $submit_sh" or similar.
- use the "--remove-destination" argument to "cp". This will cause it to
remove the file (which might fail but that is ignored) before it tries to
create it.
Cc:ing Philipp Thomas - core-utils maintainer - in case he is interested in
following this up upstream.
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.