Existing file deleted on disk full errors

Manoj Naik manoj at almaden.ibm.com
Sun Oct 7 23:11:03 GMT 2001


Hi,

I've noticed that applications like Notepad delete an existing file on a
Samba server (as of CVS friday) when a disk full error is returned from
the filesystem. An NT server, on the other hand, leaves the file intact.

For example, if the filesystem is nearly full (or quotas are about to be
exceeded) and a file is modified and saved (through File->Save
As->Existing File->Replace) under Notepad, an error is returned ("Disk
is full" or "Access Denied"). On clicking OK on the error, the file gets
deleted. There is an explicit SMBunlink message coming from the client
(I haven't figured out why), but this does not happen with NT. "Strict
Allocate" parameter doesn't affect the behavior. Does anybody have an
idea what may be happening?

Moreover, there are a couple of places in reply_write and
reply_write_and_X that return ERRnoaccess when write_file returns 0
although this may have been due to disk full errors (as indicated by
errno). I think we should check for EDQUOT and ENOSPC error cases and
return ERRdiskfull for these.

For example,

diff -u -r1.345 reply.c
--- reply.c     2 Oct 2001 04:29:46 -0000       1.345
+++ reply.c     8 Oct 2001 06:03:37 -0000
@@ -2376,7 +2376,10 @@

   if(((nwritten == 0) && (numtowrite != 0))||(nwritten < 0)) {
     END_PROFILE(SMBwriteX);
-    return(UNIXERROR(ERRDOS,ERRnoaccess));
+       if (nwritten == 0 && (errno == ENOSPC || errno == EDQUOT))
+         return (UNIXERROR(ERRDOS,ERRdiskfull));
+       else
+         return(UNIXERROR(ERRDOS,ERRnoaccess));
   }

   set_message(outbuf,6,0,True);

Manoj.




More information about the samba-technical mailing list