Write failures and proper error code return to clients

Jeremy Allison jra at samba.org
Sat Jul 22 15:47:57 GMT 2006


On Sat, Jul 22, 2006 at 09:21:43AM +0300, Shlomi Yaakobovich wrote:
> Hi,
>  
> We've recently ran into situations when the pwrite system call fails. I've noticed that on -1 return code, a "disk full" error is returned to the user. For example, in reply_write_and_X:

Why does the pwrite system call fail ?

>  if (nwritten < (ssize_t)numtowrite) {
> SCVAL(outbuf,smb_rcls,ERRHRD);
> SSVAL(outbuf,smb_err,ERRdiskfull);      

We should be more intelligent here, I'll look at it for
3.0.24.

> I saw no attempt to look at the exact errno, and attempt to return a more valid error code. Furthermore, perhaps it is worth while thinking of retrying the call (e.g. if errno is EINTR) instead of returning an error to the client ?  We've noted that some applications don't behave well to "disk full" error, and abort their operations.

You can't get EINTR on a write call on a disk system. Well you
can but only if you're writing to NFS on a soft mount, and that
breaks so many things it's not a good idea.

> Another thing worth mentioning is that we are writing to an NFS mount. 

Ah - I see. Soft mounts ?

Jeremy


More information about the samba-technical mailing list