@@ -612,51 +612,52 @@ smb2_tcon_find_pending_open_lease(struct cifs_tcon *tcon,
612
612
}
613
613
614
614
static bool
615
- smb2_is_valid_lease_break (char * buffer )
615
+ smb2_is_valid_lease_break (char * buffer , struct TCP_Server_Info * server )
616
616
{
617
617
struct smb2_lease_break * rsp = (struct smb2_lease_break * )buffer ;
618
- struct TCP_Server_Info * server ;
618
+ struct TCP_Server_Info * pserver ;
619
619
struct cifs_ses * ses ;
620
620
struct cifs_tcon * tcon ;
621
621
struct cifs_pending_open * open ;
622
622
623
623
cifs_dbg (FYI , "Checking for lease break\n" );
624
624
625
+ /* If server is a channel, select the primary channel */
626
+ pserver = CIFS_SERVER_IS_CHAN (server ) ? server -> primary_server : server ;
627
+
625
628
/* look up tcon based on tid & uid */
626
629
spin_lock (& cifs_tcp_ses_lock );
627
- list_for_each_entry (server , & cifs_tcp_ses_list , tcp_ses_list ) {
628
- list_for_each_entry (ses , & server -> smb_ses_list , smb_ses_list ) {
629
- list_for_each_entry (tcon , & ses -> tcon_list , tcon_list ) {
630
- spin_lock (& tcon -> open_file_lock );
631
- cifs_stats_inc (
632
- & tcon -> stats .cifs_stats .num_oplock_brks );
633
- if (smb2_tcon_has_lease (tcon , rsp )) {
634
- spin_unlock (& tcon -> open_file_lock );
635
- spin_unlock (& cifs_tcp_ses_lock );
636
- return true;
637
- }
638
- open = smb2_tcon_find_pending_open_lease (tcon ,
639
- rsp );
640
- if (open ) {
641
- __u8 lease_key [SMB2_LEASE_KEY_SIZE ];
642
- struct tcon_link * tlink ;
643
-
644
- tlink = cifs_get_tlink (open -> tlink );
645
- memcpy (lease_key , open -> lease_key ,
646
- SMB2_LEASE_KEY_SIZE );
647
- spin_unlock (& tcon -> open_file_lock );
648
- spin_unlock (& cifs_tcp_ses_lock );
649
- smb2_queue_pending_open_break (tlink ,
650
- lease_key ,
651
- rsp -> NewLeaseState );
652
- return true;
653
- }
630
+ list_for_each_entry (ses , & pserver -> smb_ses_list , smb_ses_list ) {
631
+ list_for_each_entry (tcon , & ses -> tcon_list , tcon_list ) {
632
+ spin_lock (& tcon -> open_file_lock );
633
+ cifs_stats_inc (
634
+ & tcon -> stats .cifs_stats .num_oplock_brks );
635
+ if (smb2_tcon_has_lease (tcon , rsp )) {
654
636
spin_unlock (& tcon -> open_file_lock );
637
+ spin_unlock (& cifs_tcp_ses_lock );
638
+ return true;
639
+ }
640
+ open = smb2_tcon_find_pending_open_lease (tcon ,
641
+ rsp );
642
+ if (open ) {
643
+ __u8 lease_key [SMB2_LEASE_KEY_SIZE ];
644
+ struct tcon_link * tlink ;
645
+
646
+ tlink = cifs_get_tlink (open -> tlink );
647
+ memcpy (lease_key , open -> lease_key ,
648
+ SMB2_LEASE_KEY_SIZE );
649
+ spin_unlock (& tcon -> open_file_lock );
650
+ spin_unlock (& cifs_tcp_ses_lock );
651
+ smb2_queue_pending_open_break (tlink ,
652
+ lease_key ,
653
+ rsp -> NewLeaseState );
654
+ return true;
655
+ }
656
+ spin_unlock (& tcon -> open_file_lock );
655
657
656
- if (cached_dir_lease_break (tcon , rsp -> LeaseKey )) {
657
- spin_unlock (& cifs_tcp_ses_lock );
658
- return true;
659
- }
658
+ if (cached_dir_lease_break (tcon , rsp -> LeaseKey )) {
659
+ spin_unlock (& cifs_tcp_ses_lock );
660
+ return true;
660
661
}
661
662
}
662
663
}
@@ -689,7 +690,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
689
690
if (rsp -> StructureSize !=
690
691
smb2_rsp_struct_sizes [SMB2_OPLOCK_BREAK_HE ]) {
691
692
if (le16_to_cpu (rsp -> StructureSize ) == 44 )
692
- return smb2_is_valid_lease_break (buffer );
693
+ return smb2_is_valid_lease_break (buffer , server );
693
694
else
694
695
return false;
695
696
}
0 commit comments