[linux-cifs-client] File transactions in wrong order?

Bjoern Tore Sund bjorn.sund at it.uib.no
Tue Feb 20 09:21:05 GMT 2007


I've got about 400 linux workstations where all the users' home 
directories are exported via cifs.  Samba 3.0.22 on SLES 10 (rpm), with 
clients running Fedora Core 5 and 6.  Mostly working fine, a few 
glitches, a few frustrations, but mostly fine.  But then there's this 
guy using mutt to read email...

When he tries to save email attachments to file he gets "fopen: No such 
file or directory (errno = 2)", the attachment file is empty and there's 
  an empty .mutt{garble} directory.  Doing the save again and choosing 
"overwrite", it works.

This could have been a mutt bug (or maybe not), but running strace on 
the file save procedure is really interresting:
12735 access("Posisjoneringsmidler.pdf", F_OK) = -1 ENOENT (No such file 
or directory)

Ok, the file isn't there.

12735 lstat64("./.muttOXlyil", 0xbfacdbac) = -1 ENOENT (No such file or 
directory)

Nor is the temporary directory mutt likes to have.

12735 mkdir("./.muttOXlyil", 0700)      = 0
12735 open("./.muttOXlyil/Posisjoneringsmidler.pdf", 
O_WRONLY|O_CREAT|O_EXCL, 0600) = 8

So we create the directory and the file _inside_ the directory.

12735 link("./.muttOXlyil/Posisjoneringsmidler.pdf", 
"Posisjoneringsmidler.pdf") = 0

Do a hard link to the place where we actually want the file to live.

12735 stat64("./.muttOXlyil/Posisjoneringsmidler.pdf", 
{st_mode=S_IFREG|0600, st_size=0, ...}) = 0
12735 stat64("Posisjoneringsmidler.pdf", {st_mode=S_IFREG|0600, 
st_size=0, ...}) = 0

We make sure the files are there.

12735 unlink("./.muttOXlyil/Posisjoneringsmidler.pdf") = 0

Remove the file in the subdirectory.

12735 unlink("./.muttOXlyil/Posisjoneringsmidler.pdf") = -1 ENOENT (No 
such file or directory)

And again, just to be sure.

12735 rmdir("./.muttOXlyil")            = -1 ENOTEMPTY (Directory not empty)

Say what?  There's nothing else there!

12735 lstat64("Posisjoneringsmidler.pdf", 0xbfacdd20) = -1 ENOENT (No 
such file or directory)

But we just made it!  It was there!  Where's it gone?  The consequent 
attempt to dump data into the file fails because of this.

I have tested with Samba 3.0.24.  I have tried setting "strict sync" and 
"sync always" on the server, to no effect.  Anyone know anything else I 
can try?

Bjørn
-- 
Bjørn Tore Sund       Phone: 555-84894   Email:   bjorn.sund at it.uib.no
IT department         VIP:   81724       Support: http://bs.uib.no
Univ. of Bergen

When in fear and when in doubt, run in circles, scream and shout.


More information about the linux-cifs-client mailing list