All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] Make IPC a regular tcon and fix SMB2 domain-based DFS
@ 2018-01-17 17:21 Aurelien Aptel
       [not found] ` <20180117172200.3221-1-aaptel-IBi9RG/b67k@public.gmane.org>
  0 siblings, 1 reply; 21+ messages in thread
From: Aurelien Aptel @ 2018-01-17 17:21 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA
  Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w, Aurelien Aptel

Hi,

The DFS code for smb2 doesn't work [1] when cifs.ko connects to a
domain-based DFS where you have an extra level on indirection (so 3
machines: AD, nameserver and the final storage).

* In SMB1 code, the DFS request is made without the tcon object. It works
  directly on the session.
* In SMB2 code, we use SMB2_ioctl() which works on a tcon.

For domain-based DFS UNC \\DOMAIN\namespace\link, cifs.ko first tries to
connect to \\DOMAIN\namespace. DOMAIN doesn't have a "namespace" share
so no valid tcon object is created.

* SMB1 doesn't care as it's working on the session object and just use
  the ses->ipc_tid number to make the DFS request.
* SMB2 code on the other hand fails as SMB2_ioctl() needs a tcon
  object (even if you pass use_ipc=true) because it uses the tcon you
  pass and simply overwrites the packet tid with ipc_tid. There is no
  valid tcon object at that time since DOMAIN rejected the "namespace"
  tcon request.

So to solve this I thought I would get rid of ses->ipc_tid and make a
real IPC tcon, that would be added to the session tcon_list and be
managed like any other tcon (almost).

This patch series cleans some definitions and makes the IPC connection
a regular tcon owned by the session. It removes the use_ipc param from
SMB2_ioct() (you can pass ses->tcon_ipc as the tcon param).

I've made the choice of having the IPC tcon completely associated to
the session instead of any other tcon. Its refcount is not really used
as it's always created as soon as we have a valid session and always
destroy when the session is destroyed and no mount points directly
refer to it.

All patches compile when applied sequentially, no warnings with
checkpatch.pl, no warnings with make C=1.

I've tested this against Windows Server 2016 vms with smb1, 2, 3 (with
and without encryption) and it seems to be working properly.

I've also quickly tested the reconnection code path but it probably
needs some work still (making sure DFS works after a reconnection) as
there are multiple ways to trigger the reconnection (I've been using
qemu monitor "set_link xyz off" which is analogous to unplugging the
network cable IIUC).

Please take a look, review, test :)

1: https://bugzilla.samba.org/show_bug.cgi?id=12917

Aurelien Aptel (3):
  CIFS: set SERVER_NAME_LENGTH to serverName actual size
  CIFS: make IPC a regular tcon
  CIFS: use tcon_ipc instead of use_ipc parameter from SMB2_ioctl

 fs/cifs/cifsglob.h  |  14 ++---
 fs/cifs/cifssmb.c   |   5 +-
 fs/cifs/connect.c   | 159 ++++++++++++++++++++++++++++++++++++++++------------
 fs/cifs/inode.c     |   2 +-
 fs/cifs/smb2file.c  |   2 +-
 fs/cifs/smb2ops.c   |  50 +++++++----------
 fs/cifs/smb2pdu.c   |  36 ++----------
 fs/cifs/smb2proto.h |   3 +-
 8 files changed, 160 insertions(+), 111 deletions(-)

-- 
2.12.3

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2018-01-26 23:00 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-17 17:21 [PATCH v1 0/3] Make IPC a regular tcon and fix SMB2 domain-based DFS Aurelien Aptel
     [not found] ` <20180117172200.3221-1-aaptel-IBi9RG/b67k@public.gmane.org>
2018-01-17 17:21   ` [PATCH v1 1/3] CIFS: set SERVER_NAME_LENGTH to serverName actual size Aurelien Aptel
2018-01-17 17:21   ` [PATCH v1 2/3] CIFS: make IPC a regular tcon Aurelien Aptel
     [not found]     ` <20180117172200.3221-3-aaptel-IBi9RG/b67k@public.gmane.org>
2018-01-18  0:27       ` Pavel Shilovskiy
     [not found]         ` <DM5PR2101MB0936C7D8EE43D6E069870B10B6E80-uvswG4RmAWieOSyIubIsYpz2gl+EIwcenBOFsp37pqbUKgpGm//BTAC/G2K4zDHf@public.gmane.org>
2018-01-18 10:30           ` Aurélien Aptel
     [not found]             ` <87607z4fyr.fsf-IBi9RG/b67k@public.gmane.org>
2018-01-18 20:24               ` Pavel Shilovsky
     [not found]                 ` <CAKywueRdq2N=xaGuWrXiSMQkQ-TxcwTB7MirehtGbm7JexwMcQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-19 12:33                   ` Aurélien Aptel
2018-01-17 17:22   ` [PATCH v1 3/3] CIFS: use tcon_ipc instead of use_ipc parameter from SMB2_ioctl Aurelien Aptel
2018-01-17 23:08   ` [PATCH v1 0/3] Make IPC a regular tcon and fix SMB2 domain-based DFS Ronnie Sahlberg
2018-01-19 17:12   ` [PATCH v2 0/2] " Aurelien Aptel
     [not found]     ` <20180119171258.14244-1-aaptel-IBi9RG/b67k@public.gmane.org>
2018-01-19 17:12       ` [PATCH v2 1/2] CIFS: make IPC a regular tcon Aurelien Aptel
2018-01-19 17:12       ` [PATCH v2 2/2] CIFS: use tcon_ipc instead of use_ipc parameter of SMB2_ioctl Aurelien Aptel
     [not found]         ` <20180119171258.14244-3-aaptel-IBi9RG/b67k@public.gmane.org>
2018-01-20  0:36           ` Pavel Shilovsky
     [not found]             ` <CAKywueRY1G5GQznKtSiOuU8dtE6248h5+OfK7gC3154VwjSeaQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-22 16:27               ` Aurélien Aptel
2018-01-24 12:46   ` [PATCH v3 0/3] Make IPC a regular tcon and fix SMB2 domain-based DFS Aurelien Aptel
     [not found]     ` <20180124124612.21993-1-aaptel-IBi9RG/b67k@public.gmane.org>
2018-01-24 12:46       ` [PATCH v3 1/3] CIFS: make IPC a regular tcon Aurelien Aptel
     [not found]         ` <20180124124612.21993-2-aaptel-IBi9RG/b67k@public.gmane.org>
2018-01-26 22:57           ` Pavel Shilovskiy
2018-01-24 12:46       ` [PATCH v3 2/3] CIFS: use tcon_ipc instead of use_ipc parameter of SMB2_ioctl Aurelien Aptel
     [not found]         ` <20180124124612.21993-3-aaptel-IBi9RG/b67k@public.gmane.org>
2018-01-26 22:59           ` Pavel Shilovskiy
2018-01-24 12:46       ` [PATCH v3 3/3] CIFS: dump IPC tcon in debug proc file Aurelien Aptel
     [not found]         ` <20180124124612.21993-4-aaptel-IBi9RG/b67k@public.gmane.org>
2018-01-26 23:00           ` Pavel Shilovskiy

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.