Error during write operation when packets dropped in vfswrap_pwrite()

Jeremy Allison jra at samba.org
Fri Jul 24 21:27:31 UTC 2015


On Fri, Jul 24, 2015 at 02:15:54PM -0700, Richard Sharpe wrote:
> On Fri, Jul 24, 2015 at 10:48 AM, sandeep nag
> <sandeepnagamalli at gmail.com> wrote:
> > To check the performance of samba, I am trying to drop packets in samba vfs
> > write() entry function before writing to the disk.
> > I have tried updating write function in vfs_default.c
> >
> > ssize_t vfswrap_pwrite((vfs_handle_struct *handle, files_struct *fsp, const
> > void *data, size_t n)
> > {
> >   .
> >   .
> >  //result = SMB_VFS_WRITE(fsp, data, n);     <-- done this change
> >  result =n;
> >  return result;
> > }
> 
> Try it with a smaller file and check with Wireshark. Windows probably
> checks to see if the file size at the end is what it expects. Doing
> what you did will likely cause the file size to remain at 0.

Yep, what you might want to do is instead of just dropping
the data, check the file length and call ftruncate to
extend if the write is beyond current end-of-file.



More information about the samba-technical mailing list