Write failures and proper error code return to clients

Jeremy Allison jra at samba.org
Tue Jul 25 16:26:49 GMT 2006

On Tue, Jul 25, 2006 at 09:06:57AM +0300, Shlomi Yaakobovich wrote:
> This actually should be:
>         if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) {
>                 END_PROFILE(SMBwriteX);
>                 if (errno == EDQUOT) {
>                     return ERROR_NT(NT_STATUS_QUOTA_EXCEEDED);
>                 }
>                 return(UNIXERROR(ERRHRD,ERRdiskfull));
>         }

Good catch !

> The reason is that a windows client 2003 and down, for both errors (disk full and quota exceeded) the error message will be "There is not enough space on the disk". Only for XP client a user will get different error message: "Not enough quota is available to process this command", which is the right one in case of a quota error. Dina Fine found this out and added the above fix. BTW, I think this is relevant to all types of writes, not just the specific case we've mentioned here. E.g I saw your latest checkin (17220) in reply.c, I believe this is the same there as well.
> Regarding the quota change, perhaps it will be better to change it in error.c, e.g. like this (in errormap.c):
> #ifdef EDQUOT
> #endif

Indeed - fixing it in the error mapping is the correct
solution. I'll do that asap.

> It also returns ERRdiskfull  if it does not find the exact errno in the unix_dos_nt_errmap array. This was the case here, the errno was 105 (ENOBUFS - No buffer space available). This might be related to the kernel/NFS client, but samba currently is unaware of this error code. I'm not sure it should be though, it clearly indicates a problem. In our case the problem was transient, a second retry (when encountering this error) was successful.
> Anyways, I'm still not sure what caused the ENOBUFS error, maybe it is indeed only when writing to NFS mounts. In the meantime, since we needed to apply a quick fix, we just added 2 more retries, which apparently made our problem disappear (not get solved...).

Ah - ENOBUFS is a new errno return for write only covered
in the Single UNIX specification version 3. I'll update
the error map to cover the possible errno vals.


More information about the samba-technical mailing list