2017-02-24 7:25 GMT-08:00 Aurélien Aptel <aaptel@xxxxxxxx>: > Hi Pavel, > > Pavel Shilovsky <piastryyy@xxxxxxxxx> writes: >> Accessing the tcon_list should be protected by spin_locks and also a >> reference to the tcon should be acquired before using it safely. > > I've noticed we have the cifs_tcp_ses_lock but also a per-session > session_mutex. I'm guessing we want cifs_tcp_ses_lock here. > > By acquiring a reference you mean incrementing/decrementing tc_count. Do > we need to protect this inc/dec operation with cifs_tcp_ses_lock too? Yes. > >> Also you can extend SMB2_ioctl argument list to allow passing ipc_tid. >> In this case SMB2_ioctl() can choose what to use - ipc_tid or tcon; if >> tcon is passed -use it, otherwise - use ipc_tid. >> >> In this case you can fallback to ipc_tid if no tcon is found in the list. >> > > SMB2_ioctl() uses the tcon for many things. I don't see how we can just > use ipc_tid number if we don't pass a tcon. > > Or do you mean: add a use_ipc bool to SMB2_ioctl arg list and use the tcon as > usual except overwrite the Tid field with ses->ipc_tid before sending? We can pass both arguments: tcon and ipc_tid. If the 1st is specified SMB_ioctl uses it, otherwise - use ipc_tid. 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. > > Thanks, > > -- > 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) -- 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