"text file busy" on cifs-mounted dir *doesn't* cause rsync error!

Jason Haar Jason.Haar at trimble.co.nz
Thu Oct 19 02:37:22 GMT 2006

Hi there

I just reported a problem to the rsync list, and a minute later realised
a further test I should have tried first.

Basically it appears that "mount -t cifs" SMB shares under Linux don't
properly report low-level rename failures.

i.e. if I use rsync to overwrite a locked file  rsync think it succeeds
as it:

a: copies file to new temp file
b: renames temp file over existing file.

As the file is locked, b: should fail - but mount.cifs reports it as
working! A further "ls -l" shows the file hasn't been overwritten.

Is this a Samba bug - or a Windows one? If the latter, how are other
rsync users working around this problem of trying to replicate data onto
remote CIFS shares?

This is Samba-2.0.23c under FC5


---- original message to rsync list -------------

I am running rsync-2.6.9rc2 and am having difficulty getting rsync to
report an error when I think it should

I mounted (via "mount -t cifs") a remote Win2K3 server and on a XP
client opened a Word document. Then from Linux (FC5) I attempted a

bash$ cp /tmp/other.txt file.doc
cp: cannot create regular file `file.doc': Text file busy

That makes sense - CIFS has the file locked.

Then I tried copying the same file via rsync

bash$ rsync /tmp/other.txt file.doc
bash$ echo $?

i.e. rsync says it worked! However it didn't. I ended up with a full
copy of other.txt as .file.doc.3s1d3w - but the final rename on top of
the original file failed.

Rsync didn't return an error. It should?

Help? Is this a bug with rsync, or with Samba (perhaps it returned OK on
the rename when it shouldn't have?)


Jason Haar
Information Security Manager, Trimble Navigation Ltd.
Phone: +64 3 9635 377 Fax: +64 3 9635 417
PGP Fingerprint: 7A2E 0407 C9A6 CAF6 2B9F 8422 C063 5EBB FE1D 66D1

More information about the rsync mailing list