@@ -46,6 +46,10 @@ struct cop_vars {
46
46
struct smb2_file_link_info link_info ;
47
47
};
48
48
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
+ */
49
53
static int
50
54
smb2_compound_op (const unsigned int xid , struct cifs_tcon * tcon ,
51
55
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,
536
540
create_options |= OPEN_REPARSE_POINT ;
537
541
538
542
/* Failed on a symbolic link - query a reparse point info */
543
+ cifs_get_readable_path (tcon , full_path , & cfile );
539
544
rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
540
545
FILE_READ_ATTRIBUTES , FILE_OPEN ,
541
546
create_options , ACL_NO_MODE ,
542
- smb2_data , SMB2_OP_QUERY_INFO , NULL );
547
+ smb2_data , SMB2_OP_QUERY_INFO , cfile );
543
548
}
544
549
if (rc )
545
550
goto out ;
@@ -587,10 +592,11 @@ smb311_posix_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
587
592
create_options |= OPEN_REPARSE_POINT ;
588
593
589
594
/* Failed on a symbolic link - query a reparse point info */
595
+ cifs_get_readable_path (tcon , full_path , & cfile );
590
596
rc = smb2_compound_op (xid , tcon , cifs_sb , full_path ,
591
597
FILE_READ_ATTRIBUTES , FILE_OPEN ,
592
598
create_options , ACL_NO_MODE ,
593
- smb2_data , SMB2_OP_POSIX_QUERY_INFO , NULL );
599
+ smb2_data , SMB2_OP_POSIX_QUERY_INFO , cfile );
594
600
}
595
601
if (rc )
596
602
goto out ;
@@ -707,10 +713,12 @@ smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
707
713
struct cifs_sb_info * cifs_sb , bool set_alloc )
708
714
{
709
715
__le64 eof = cpu_to_le64 (size );
716
+ struct cifsFileInfo * cfile ;
710
717
718
+ cifs_get_writable_path (tcon , full_path , FIND_WR_ANY , & cfile );
711
719
return smb2_compound_op (xid , tcon , cifs_sb , full_path ,
712
720
FILE_WRITE_DATA , FILE_OPEN , 0 , ACL_NO_MODE ,
713
- & eof , SMB2_OP_SET_EOF , NULL );
721
+ & eof , SMB2_OP_SET_EOF , cfile );
714
722
}
715
723
716
724
int
@@ -719,6 +727,8 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
719
727
{
720
728
struct cifs_sb_info * cifs_sb = CIFS_SB (inode -> i_sb );
721
729
struct tcon_link * tlink ;
730
+ struct cifs_tcon * tcon ;
731
+ struct cifsFileInfo * cfile ;
722
732
int rc ;
723
733
724
734
if ((buf -> CreationTime == 0 ) && (buf -> LastAccessTime == 0 ) &&
@@ -729,10 +739,12 @@ smb2_set_file_info(struct inode *inode, const char *full_path,
729
739
tlink = cifs_sb_tlink (cifs_sb );
730
740
if (IS_ERR (tlink ))
731
741
return PTR_ERR (tlink );
742
+ tcon = tlink_tcon (tlink );
732
743
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 ,
734
746
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 );
736
748
cifs_put_tlink (tlink );
737
749
return rc ;
738
750
}
0 commit comments