dcache
dcache copied to clipboard
NFS doesn't preserve attributes when instructed so
Hey.
When a file is copied on a nfs41 mountpoint with e.g. cp -a, then attributes (at least the dates) aren't preserved, even though this should be the case; instead the current time is used. No error message is given that the preservation request has failed (which would be AFAIC mandatory for most of the --preserve types.
Cheers, Chris
The problem is that cp command sends attributes before closing the file. On the close dCache itself update atime and mtime with information provided by mover and overwrites previously existing values.
On the other hand, rsync command sets atime and atime after closing the file and., as a result, file attributes get expected values.
$ cp --preserve ~/bin/dsip.py .
$ ls -l dsip.py
-rwxrwxr-x 1 tigran tigran 425 Nov 3 2015 dsip.py
$ rm dsip.py
$ rsync -a ~/bin/dsip.py .
$ ls -l dsip.py
-rwxrwxr-x 1 tigran tigran 425 Aug 28 2013 dsip.py
$
Is it an option for you to use rsync?
Well it's not really crucial for me - I've just noted it and thought it should be reported.
If cp sends attributes, then doesn't it make sense to take those and not whatever dCache thinks whet it closes the mover? In doubt, I'd say, cp is right - at least for the mtime (atime and ctime is another matter, where the server could be considered to be right per definition).
cp has it assumption on filesystem behavior, which is probably based on POSIX. Unless 'cp complaint' semantics is really required, we will keep it as-is for now.
Yes, it's probably POSIX based... and in the past, all places were dcache diverged for "historical" reasons from POSIX caused rather more pain until it was sooner or later resolved :-/