quotas and small files

Jeremy Allison jeremy at valinux.com
Mon Aug 6 19:24:58 GMT 2001


"DICKENS,CARY (HP-Loveland,ex2)" wrote:

> So in vfs_allocate_file_space we error out if the write wasn't big enough.
> The way I read it, we need to call it till we get a return of 0 or -1 to
> work with the way errno is being set.

Ok - now I think I understand. Try the following patch
(which I just committed to CVS). It ignores short writes
and keeps going until 0 or -1 or total written.

Jeremy.

Index: smbd/vfs.c
===================================================================
RCS file: /data/cvs/samba/source/smbd/vfs.c,v
retrieving revision 1.16.2.19
diff -u -r1.16.2.19 vfs.c
--- smbd/vfs.c  4 Aug 2001 00:24:51 -0000       1.16.2.19
+++ smbd/vfs.c  6 Aug 2001 19:16:51 -0000
@@ -474,7 +474,7 @@
                        SMB_OFF_T current_len_to_write = MIN(sizeof(zero_space),len_to_write);
 
                        retlen = vfs_ops->write(fsp,fsp->fd,zero_space,current_len_to_write);
-                       if (retlen != current_len_to_write) {
+                       if (retlen <= 0) {
                                /* Write fail - return to original size. */
                                int save_errno = errno;
                                fsp->conn->vfs_ops.ftruncate(fsp, fsp->fd, st.st_size);
@@ -487,7 +487,7 @@
                        DEBUG(10,("vfs_allocate_file_space: file %s, grow. wrote %.0f\n",
                                        fsp->fsp_name, (double)current_len_to_write ));
 
-                       len_to_write -= current_len_to_write;
+                       len_to_write -= retlen;
                }
                set_filelen_write_cache(fsp, len);

-- 
--------------------------------------------------------
Buying an operating system without source is like buying
a self-assembly Space Shuttle with no instructions.
--------------------------------------------------------




More information about the samba-technical mailing list