@@ -46,6 +46,10 @@ struct cop_vars {
4646 struct smb2_file_link_info link_info ;
4747};
4848
49+ /*
50+ * note: If cfile is passed, the reference to it is dropped here.
51+ * So make sure that you do not reuse cfile after return from this func.
52+ */
4953static int
5054smb2_compound_op (const unsigned int xid , struct cifs_tcon * tcon ,
5155 struct cifs_sb_info * cifs_sb , const char * full_path ,
@@ -536,10 +540,11 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
536540 create_options |= OPEN_REPARSE_POINT ;
537541
538542 /* Failed on a symbolic link - query a reparse point info */
543+ cifs_get_readable_path (tcon , full_path , & cfile );
539544 rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
540545 FILE_READ_ATTRIBUTES , FILE_OPEN ,
541546 create_options , ACL_NO_MODE ,
542- smb2_data , SMB2_OP_QUERY_INFO , NULL );
547+ smb2_data , SMB2_OP_QUERY_INFO , cfile );
543548 }
544549 if (rc )
545550 goto out ;
@@ -587,10 +592,11 @@ smb311_posix_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
587592 create_options |= OPEN_REPARSE_POINT ;
588593
589594 /* Failed on a symbolic link - query a reparse point info */
595+ cifs_get_readable_path (tcon , full_path , & cfile );
590596 rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
591597 FILE_READ_ATTRIBUTES , FILE_OPEN ,
592598 create_options , ACL_NO_MODE ,
593- smb2_data , SMB2_OP_POSIX_QUERY_INFO , NULL );
599+ smb2_data , SMB2_OP_POSIX_QUERY_INFO , cfile );
594600 }
595601 if (rc )
596602 goto out ;
@@ -707,10 +713,12 @@ smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
707713 struct cifs_sb_info * cifs_sb , bool set_alloc )
708714{
709715 __le64 eof = cpu_to_le64 (size );
716+ struct cifsFileInfo * cfile ;
710717
718+ cifs_get_writable_path (tcon , full_path , FIND_WR_ANY , & cfile );
711719 return smb2_compound_op (xid , tcon , cifs_sb , full_path ,
712720 FILE_WRITE_DATA , FILE_OPEN , 0 , ACL_NO_MODE ,
713- & eof , SMB2_OP_SET_EOF , NULL );
721+ & eof , SMB2_OP_SET_EOF , cfile );
714722}
715723
716724int
@@ -719,6 +727,8 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
719727{
720728 struct cifs_sb_info * cifs_sb = CIFS_SB (inode -> i_sb );
721729 struct tcon_link * tlink ;
730+ struct cifs_tcon * tcon ;
731+ struct cifsFileInfo * cfile ;
722732 int rc ;
723733
724734 if ((buf -> CreationTime == 0 ) && (buf -> LastAccessTime == 0 ) &&
@@ -729,10 +739,12 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
729739 tlink = cifs_sb_tlink (cifs_sb );
730740 if (IS_ERR (tlink ))
731741 return PTR_ERR (tlink );
742+ tcon = tlink_tcon (tlink );
732743
733- rc = smb2_compound_op (xid , tlink_tcon (tlink ), cifs_sb , full_path ,
744+ cifs_get_writable_path (tcon , full_path , FIND_WR_ANY , & cfile );
745+ rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
734746 FILE_WRITE_ATTRIBUTES , FILE_OPEN ,
735- 0 , ACL_NO_MODE , buf , SMB2_OP_SET_INFO , NULL );
747+ 0 , ACL_NO_MODE , buf , SMB2_OP_SET_INFO , cfile );
736748 cifs_put_tlink (tlink );
737749 return rc ;
738750}
0 commit comments