@@ -678,28 +678,44 @@ int smb2_query_path_info(const unsigned int xid,
678
678
struct smb2_hdr * hdr ;
679
679
struct kvec in_iov [2 ], out_iov [3 ] = {};
680
680
int out_buftype [3 ] = {};
681
- int cmds [2 ] = { SMB2_OP_QUERY_INFO , } ;
681
+ int cmds [2 ];
682
682
bool islink ;
683
683
int i , num_cmds ;
684
684
int rc , rc2 ;
685
685
686
686
data -> adjust_tz = false;
687
687
data -> reparse_point = false;
688
688
689
- if (strcmp (full_path , "" ))
690
- rc = - ENOENT ;
691
- else
692
- rc = open_cached_dir (xid , tcon , full_path , cifs_sb , false, & cfid );
693
- /* If it is a root and its handle is cached then use it */
694
- if (!rc ) {
695
- if (cfid -> file_all_info_is_valid ) {
696
- memcpy (& data -> fi , & cfid -> file_all_info , sizeof (data -> fi ));
689
+ /*
690
+ * BB TODO: Add support for using cached root handle in SMB3.1.1 POSIX.
691
+ * Create SMB2_query_posix_info worker function to do non-compounded
692
+ * query when we already have an open file handle for this. For now this
693
+ * is fast enough (always using the compounded version).
694
+ */
695
+ if (!tcon -> posix_extensions ) {
696
+ if (* full_path ) {
697
+ rc = - ENOENT ;
697
698
} else {
698
- rc = SMB2_query_info (xid , tcon , cfid -> fid . persistent_fid ,
699
- cfid -> fid . volatile_fid , & data -> fi );
699
+ rc = open_cached_dir (xid , tcon , full_path ,
700
+ cifs_sb , false, & cfid );
700
701
}
701
- close_cached_dir (cfid );
702
- return rc ;
702
+ /* If it is a root and its handle is cached then use it */
703
+ if (!rc ) {
704
+ if (cfid -> file_all_info_is_valid ) {
705
+ memcpy (& data -> fi , & cfid -> file_all_info ,
706
+ sizeof (data -> fi ));
707
+ } else {
708
+ rc = SMB2_query_info (xid , tcon ,
709
+ cfid -> fid .persistent_fid ,
710
+ cfid -> fid .volatile_fid ,
711
+ & data -> fi );
712
+ }
713
+ close_cached_dir (cfid );
714
+ return rc ;
715
+ }
716
+ cmds [0 ] = SMB2_OP_QUERY_INFO ;
717
+ } else {
718
+ cmds [0 ] = SMB2_OP_POSIX_QUERY_INFO ;
703
719
}
704
720
705
721
in_iov [0 ].iov_base = data ;
@@ -722,6 +738,10 @@ int smb2_query_path_info(const unsigned int xid,
722
738
switch (rc ) {
723
739
case 0 :
724
740
case - EOPNOTSUPP :
741
+ /*
742
+ * BB TODO: When support for special files added to Samba
743
+ * re-verify this path.
744
+ */
725
745
rc = parse_create_response (data , cifs_sb , & out_iov [0 ]);
726
746
if (rc || !data -> reparse_point )
727
747
goto out ;
@@ -761,75 +781,6 @@ int smb2_query_path_info(const unsigned int xid,
761
781
return rc ;
762
782
}
763
783
764
- int smb311_posix_query_path_info (const unsigned int xid ,
765
- struct cifs_tcon * tcon ,
766
- struct cifs_sb_info * cifs_sb ,
767
- const char * full_path ,
768
- struct cifs_open_info_data * data )
769
- {
770
- int rc ;
771
- __u32 create_options = 0 ;
772
- struct cifsFileInfo * cfile ;
773
- struct kvec in_iov [2 ], out_iov [3 ] = {};
774
- int out_buftype [3 ] = {};
775
- int cmds [2 ] = { SMB2_OP_POSIX_QUERY_INFO , };
776
- int i , num_cmds ;
777
-
778
- data -> adjust_tz = false;
779
- data -> reparse_point = false;
780
-
781
- /*
782
- * BB TODO: Add support for using the cached root handle.
783
- * Create SMB2_query_posix_info worker function to do non-compounded query
784
- * when we already have an open file handle for this. For now this is fast enough
785
- * (always using the compounded version).
786
- */
787
- in_iov [0 ].iov_base = data ;
788
- in_iov [0 ].iov_len = sizeof (* data );
789
- in_iov [1 ] = in_iov [0 ];
790
-
791
- cifs_get_readable_path (tcon , full_path , & cfile );
792
- rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
793
- FILE_READ_ATTRIBUTES , FILE_OPEN ,
794
- create_options , ACL_NO_MODE , in_iov ,
795
- cmds , 1 , cfile , out_iov , out_buftype );
796
- /*
797
- * If first iov is unset, then SMB session was dropped or we've got a
798
- * cached open file (@cfile).
799
- */
800
- if (!out_iov [0 ].iov_base || out_buftype [0 ] == CIFS_NO_BUFFER )
801
- goto out ;
802
-
803
- switch (rc ) {
804
- case 0 :
805
- case - EOPNOTSUPP :
806
- /* BB TODO: When support for special files added to Samba re-verify this path */
807
- rc = parse_create_response (data , cifs_sb , & out_iov [0 ]);
808
- if (rc || !data -> reparse_point )
809
- goto out ;
810
-
811
- if (data -> reparse .tag == IO_REPARSE_TAG_SYMLINK ) {
812
- /* symlink already parsed in create response */
813
- num_cmds = 1 ;
814
- } else {
815
- cmds [1 ] = SMB2_OP_GET_REPARSE ;
816
- num_cmds = 2 ;
817
- }
818
- create_options |= OPEN_REPARSE_POINT ;
819
- cifs_get_readable_path (tcon , full_path , & cfile );
820
- rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
821
- FILE_READ_ATTRIBUTES , FILE_OPEN ,
822
- create_options , ACL_NO_MODE , in_iov ,
823
- cmds , num_cmds , cfile , NULL , NULL );
824
- break ;
825
- }
826
-
827
- out :
828
- for (i = 0 ; i < ARRAY_SIZE (out_buftype ); i ++ )
829
- free_rsp_buf (out_buftype [i ], out_iov [i ].iov_base );
830
- return rc ;
831
- }
832
-
833
784
int
834
785
smb2_mkdir (const unsigned int xid , struct inode * parent_inode , umode_t mode ,
835
786
struct cifs_tcon * tcon , const char * name ,
0 commit comments