2017-02-27 6:17 GMT-08:00 Aurélien Aptel <aaptel@xxxxxxxx>: > Pavel Shilovsky <piastryyy@xxxxxxxxx> writes: >> We can pass both arguments: tcon and ipc_tid. If the 1st is specified >> SMB_ioctl uses it, otherwise - use ipc_tid. > > I still don't get it. When tcon is not specified (I'm assuming that > means passing NULL) and we just have ipc_tid (an int) we cannot: > - access the struct cifs_ses* > - access the struct TCP_Server_Info* > - check if encryption is required > - call any of the functions that requires the session or the server > struct (i.e. all the functions that do the real work). Yes, we still need to pass "ses" argument which will create a whole mess. But we probably need to clean this anyway because the number of argument are getting too big. > >> Since we call get_dfs_refer() once we get ipc_tid, may be it is worth >> to try ipc_tid at first and then, if EAGAIN is returned (probably due >> to reconnection that makes ipc_tid equal 0), use the 1st tcon from >> list for the session. This will also workaround the bug in Samba. > > What I'm proposing is to add a bool flag use_ipc to SMB2_ioctl. And do > something like this: > > if use_ipc: > if tcon->ses->ipc_tid == 0: > return -ENOTCONN > else: > req->tid = tcon->ses->ipc_tid > > Now in smb2_get_dfs_referral can first try to call it with > use_ipc=true and if that fails with ENOTCONN try again with false. This also works although it doesn't allow to call SMB2_ioctl() without having at least one tcon. -- Best regards, Pavel Shilovsky -- To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html