@@ -2659,6 +2659,7 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
26592659 struct cifs_fid fid ;
26602660 int rc ;
26612661 __le16 * utf16_path ;
2662+ struct cached_fid * cfid = NULL ;
26622663
26632664 if (!path )
26642665 path = "" ;
@@ -2673,6 +2674,8 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
26732674 resp_buftype [0 ] = resp_buftype [1 ] = resp_buftype [2 ] = CIFS_NO_BUFFER ;
26742675 memset (rsp_iov , 0 , sizeof (rsp_iov ));
26752676
2677+ rc = open_cached_dir (xid , tcon , path , cifs_sb , & cfid );
2678+
26762679 memset (& open_iov , 0 , sizeof (open_iov ));
26772680 rqst [0 ].rq_iov = open_iov ;
26782681 rqst [0 ].rq_nvec = SMB2_CREATE_IOV_SIZE ;
@@ -2694,15 +2697,29 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
26942697 rqst [1 ].rq_iov = qi_iov ;
26952698 rqst [1 ].rq_nvec = 1 ;
26962699
2697- rc = SMB2_query_info_init (tcon , server ,
2698- & rqst [1 ], COMPOUND_FID , COMPOUND_FID ,
2699- class , type , 0 ,
2700- output_len , 0 ,
2701- NULL );
2700+ if (cfid ) {
2701+ rc = SMB2_query_info_init (tcon , server ,
2702+ & rqst [1 ],
2703+ cfid -> fid -> persistent_fid ,
2704+ cfid -> fid -> volatile_fid ,
2705+ class , type , 0 ,
2706+ output_len , 0 ,
2707+ NULL );
2708+ } else {
2709+ rc = SMB2_query_info_init (tcon , server ,
2710+ & rqst [1 ],
2711+ COMPOUND_FID ,
2712+ COMPOUND_FID ,
2713+ class , type , 0 ,
2714+ output_len , 0 ,
2715+ NULL );
2716+ }
27022717 if (rc )
27032718 goto qic_exit ;
2704- smb2_set_next_command (tcon , & rqst [1 ]);
2705- smb2_set_related (& rqst [1 ]);
2719+ if (!cfid ) {
2720+ smb2_set_next_command (tcon , & rqst [1 ]);
2721+ smb2_set_related (& rqst [1 ]);
2722+ }
27062723
27072724 memset (& close_iov , 0 , sizeof (close_iov ));
27082725 rqst [2 ].rq_iov = close_iov ;
@@ -2714,9 +2731,15 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
27142731 goto qic_exit ;
27152732 smb2_set_related (& rqst [2 ]);
27162733
2717- rc = compound_send_recv (xid , ses , server ,
2718- flags , 3 , rqst ,
2719- resp_buftype , rsp_iov );
2734+ if (cfid ) {
2735+ rc = compound_send_recv (xid , ses , server ,
2736+ flags , 1 , & rqst [1 ],
2737+ & resp_buftype [1 ], & rsp_iov [1 ]);
2738+ } else {
2739+ rc = compound_send_recv (xid , ses , server ,
2740+ flags , 3 , rqst ,
2741+ resp_buftype , rsp_iov );
2742+ }
27202743 if (rc ) {
27212744 free_rsp_buf (resp_buftype [1 ], rsp_iov [1 ].iov_base );
27222745 if (rc == - EREMCHG ) {
@@ -2736,6 +2759,8 @@ smb2_query_info_compound(const unsigned int xid, struct cifs_tcon *tcon,
27362759 SMB2_close_free (& rqst [2 ]);
27372760 free_rsp_buf (resp_buftype [0 ], rsp_iov [0 ].iov_base );
27382761 free_rsp_buf (resp_buftype [2 ], rsp_iov [2 ].iov_base );
2762+ if (cfid )
2763+ close_cached_dir (cfid );
27392764 return rc ;
27402765}
27412766
0 commit comments