[00/19] cifs: remove rfc1002 header from all smb2 requests
mbox series

Message ID 20171102070312.18903-1-lsahlber@redhat.com
Headers show
Series
  • cifs: remove rfc1002 header from all smb2 requests
Related show

Message

Ronnie Sahlberg Nov. 2, 2017, 7:02 a.m. UTC
Steve, all

I split the !1002 patch into a small serie for easier review.

This patch series removes the NBSS 4 byte header from all the
smb2 request structures.
Instead of computing and tweaking the header as part of composing
the SMB2 request, we now compute it in the new SendReceive3() function
that is used by all of SMB2.

This eliminates a huge amount of magic +4 / -4 in the code
and all the ugly inc_rfc1002.... stuff where the old code would
constantly tweak the length field as it was building the PDU.

So overall it also simplifies the code in some places I think.


This series is to prepare for and make it easier to add smb2 compounding
in the future as then we will need to construct multiple SMB2 pdus
and wrap them all insode one single rfc1002 header.


As a later series, before we get to the actual compounding, I plan to
do a similar change to all the reply structures and remove the rfc1002
header from them all too.


Please review, and test.

--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Aurelien Aptel Nov. 8, 2017, 2:38 p.m. UTC | #1
Hi Ronnie,

The patch looks good I think but I ran the xfstests test suite and after
applying your patches on top of Steve's for-next the generic/089 test
runs forever (10+ hours at full CPU usage after which I just hit ^C and
the program stopped) vs couple of seconds before. I'm not sure what's
going on here but since sending SIGINT stops the program its probably
not a kernel deadlock.
Aurelien Aptel Nov. 8, 2017, 3:46 p.m. UTC | #2
I've looked at a network trace: after the patches when doing a setinfo
on the same file, the netbios length is 1 byte bigger and thus probably
wrong (server replies with a OBJECT_NAME_COLLISION error).
ronnie sahlberg Nov. 9, 2017, 12:48 a.m. UTC | #3
Thanks.

It is the __u8 Buffer[1] in the structure that is causing it.
I will resend after I fix it and audit all other Buffer[1] in the
request structures.

Any particular reason we don't use  __u8 Buffer[0] instead?



On Thu, Nov 9, 2017 at 1:46 AM, Aurélien Aptel <aaptel@suse.com> wrote:
> I've looked at a network trace: after the patches when doing a setinfo
> on the same file, the netbios length is 1 byte bigger and thus probably
> wrong (server replies with a OBJECT_NAME_COLLISION error).
>
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
> SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
> GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Pavel Shilovsky Nov. 17, 2017, 1:16 a.m. UTC | #4
2017-11-08 16:48 GMT-08:00 ronnie sahlberg <ronniesahlberg@gmail.com>:
> Thanks.
>
> It is the __u8 Buffer[1] in the structure that is causing it.
> I will resend after I fix it and audit all other Buffer[1] in the
> request structures.
>
> Any particular reason we don't use  __u8 Buffer[0] instead?
>
>
>
> On Thu, Nov 9, 2017 at 1:46 AM, Aurélien Aptel <aaptel@suse.com> wrote:
>> I've looked at a network trace: after the patches when doing a setinfo
>> on the same file, the netbios length is 1 byte bigger and thus probably
>> wrong (server replies with a OBJECT_NAME_COLLISION error).
>>
>> --
>> Aurélien Aptel / SUSE Labs Samba Team
>> GPG: 1839 CB5F 9F5B FB9B AA97  8C99 03C8 A49B 521B D5D3
>> SUSE Linux GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
>> GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

It is because a buffer of size 1 is included in StructureSize field of
PDUs, so we need to send at least 1 byte. Having it in the structure
preventing us to allocate extra unused 1 byte e.g. for a READ request.
We can probably clean it as well.

--
Best regards,
Pavel Shilovsky
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html