More recvfile optimizations

Jeremy Allison jra at
Thu Apr 10 15:24:42 MDT 2014

On Thu, Apr 10, 2014 at 11:05:14PM +0200, Stefan (metze) Metzmacher wrote:
> I don't have a fix.
> But we would need such check in is_smb2_recvfile_write(), correct?

Well, there are two ways of doing it.

First one is to add the :


calls into is_smb2_recvfile_write(), which is
the same way the SMB1 code does it.

The second possibility is to add:

                if (req->smb1req != NULL && req->smb1req->unread_bytes > 0) {
                        /* We can't do recvfile on print and ipc shares. */
                        if (IS_IPC(req->tcon->compat) || IS_PRINT(req->tcon->compat)) {
                                // DO A BLOCKING READ OF 
                                // req->smb1req->unread_bytes
                                // AND ADJUST the req->iovecs...

into the:

 if (call->need_tcon) {
	.. stuff..


stanza in smbd_smb2_request_dispatch(). Which would
be more efficient as we've already looked up the
session and tcon and won't be doing so twice on
every write call.

Which do you think is best ?

Oh yeah, we also need to add:

        if (state->hdr.nbt[0] != 0x00) {
                /* Not a standard NBT packet. Ignore. */
                return false;

at the top of is_smb2_recvfile_write() to make
sure we correctly ignore non-NBT packets (not
that we should get many of those, but it's
better to be correct...).

> So we decided to drop support for compilers without support dynamic arrays?

Yep. Some new Volker code already uses it :-).


More information about the samba-technical mailing list