@@ -725,8 +725,8 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
725725 else
726726 posix_lock_type = CIFS_WRLCK ;
727727 rc = CIFSSMBPosixLock (xid , tcon , netfid , 1 /* get */ ,
728- length , pfLock ,
729- posix_lock_type , wait_flag );
728+ length , pfLock , posix_lock_type ,
729+ wait_flag );
730730 FreeXid (xid );
731731 return rc ;
732732 }
@@ -797,8 +797,8 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
797797 posix_lock_type = CIFS_UNLCK ;
798798
799799 rc = CIFSSMBPosixLock (xid , tcon , netfid , 0 /* set */ ,
800- length , pfLock ,
801- posix_lock_type , wait_flag );
800+ length , pfLock , posix_lock_type ,
801+ wait_flag );
802802 } else {
803803 struct cifsFileInfo * fid = file -> private_data ;
804804
@@ -1346,6 +1346,14 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
13461346{
13471347 int rc ;
13481348 struct inode * inode = mapping -> host ;
1349+ struct cifsFileInfo * cfile = file -> private_data ;
1350+ struct cifs_sb_info * cifs_sb = CIFS_SB (cfile -> dentry -> d_sb );
1351+ __u32 pid ;
1352+
1353+ if (cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD )
1354+ pid = cfile -> pid ;
1355+ else
1356+ pid = current -> tgid ;
13491357
13501358 cFYI (1 , "write_end for page %p from pos %lld with %d bytes" ,
13511359 page , pos , copied );
@@ -1369,8 +1377,7 @@ static int cifs_write_end(struct file *file, struct address_space *mapping,
13691377 /* BB check if anything else missing out of ppw
13701378 such as updating last write time */
13711379 page_data = kmap (page );
1372- rc = cifs_write (file -> private_data , current -> tgid ,
1373- page_data + offset , copied , & pos );
1380+ rc = cifs_write (cfile , pid , page_data + offset , copied , & pos );
13741381 /* if (rc < 0) should we set writebehind rc? */
13751382 kunmap (page );
13761383
@@ -1523,6 +1530,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
15231530 struct cifs_sb_info * cifs_sb ;
15241531 struct cifs_io_parms io_parms ;
15251532 int xid , rc ;
1533+ __u32 pid ;
15261534
15271535 len = iov_length (iov , nr_segs );
15281536 if (!len )
@@ -1554,6 +1562,12 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
15541562
15551563 xid = GetXid ();
15561564 open_file = file -> private_data ;
1565+
1566+ if (cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD )
1567+ pid = open_file -> pid ;
1568+ else
1569+ pid = current -> tgid ;
1570+
15571571 pTcon = tlink_tcon (open_file -> tlink );
15581572 inode = file -> f_path .dentry -> d_inode ;
15591573
@@ -1581,7 +1595,7 @@ cifs_iovec_write(struct file *file, const struct iovec *iov,
15811595 break ;
15821596 }
15831597 io_parms .netfid = open_file -> netfid ;
1584- io_parms .pid = current -> tgid ;
1598+ io_parms .pid = pid ;
15851599 io_parms .tcon = pTcon ;
15861600 io_parms .offset = * poffset ;
15871601 io_parms .length = cur_len ;
@@ -1682,7 +1696,9 @@ cifs_iovec_read(struct file *file, const struct iovec *iov,
16821696 struct cifsTconInfo * pTcon ;
16831697 struct cifsFileInfo * open_file ;
16841698 struct smb_com_read_rsp * pSMBr ;
1699+ struct cifs_io_parms io_parms ;
16851700 char * read_data ;
1701+ __u32 pid ;
16861702
16871703 if (!nr_segs )
16881704 return 0 ;
@@ -1697,6 +1713,11 @@ cifs_iovec_read(struct file *file, const struct iovec *iov,
16971713 open_file = file -> private_data ;
16981714 pTcon = tlink_tcon (open_file -> tlink );
16991715
1716+ if (cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD )
1717+ pid = open_file -> pid ;
1718+ else
1719+ pid = current -> tgid ;
1720+
17001721 if ((file -> f_flags & O_ACCMODE ) == O_WRONLY )
17011722 cFYI (1 , "attempting read on write only file instance" );
17021723
@@ -1712,8 +1733,12 @@ cifs_iovec_read(struct file *file, const struct iovec *iov,
17121733 if (rc != 0 )
17131734 break ;
17141735 }
1715- rc = CIFSSMBRead (xid , pTcon , open_file -> netfid ,
1716- cur_len , * poffset , & bytes_read ,
1736+ io_parms .netfid = open_file -> netfid ;
1737+ io_parms .pid = pid ;
1738+ io_parms .tcon = pTcon ;
1739+ io_parms .offset = * poffset ;
1740+ io_parms .length = len ;
1741+ rc = CIFSSMBRead (xid , & io_parms , & bytes_read ,
17171742 & read_data , & buf_type );
17181743 pSMBr = (struct smb_com_read_rsp * )read_data ;
17191744 if (read_data ) {
@@ -1794,7 +1819,9 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
17941819 int xid ;
17951820 char * current_offset ;
17961821 struct cifsFileInfo * open_file ;
1822+ struct cifs_io_parms io_parms ;
17971823 int buf_type = CIFS_NO_BUFFER ;
1824+ __u32 pid ;
17981825
17991826 xid = GetXid ();
18001827 cifs_sb = CIFS_SB (file -> f_path .dentry -> d_sb );
@@ -1807,6 +1834,11 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
18071834 open_file = file -> private_data ;
18081835 pTcon = tlink_tcon (open_file -> tlink );
18091836
1837+ if (cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD )
1838+ pid = open_file -> pid ;
1839+ else
1840+ pid = current -> tgid ;
1841+
18101842 if ((file -> f_flags & O_ACCMODE ) == O_WRONLY )
18111843 cFYI (1 , "attempting read on write only file instance" );
18121844
@@ -1829,11 +1861,13 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
18291861 if (rc != 0 )
18301862 break ;
18311863 }
1832- rc = CIFSSMBRead (xid , pTcon ,
1833- open_file -> netfid ,
1834- current_read_size , * poffset ,
1835- & bytes_read , & current_offset ,
1836- & buf_type );
1864+ io_parms .netfid = open_file -> netfid ;
1865+ io_parms .pid = pid ;
1866+ io_parms .tcon = pTcon ;
1867+ io_parms .offset = * poffset ;
1868+ io_parms .length = current_read_size ;
1869+ rc = CIFSSMBRead (xid , & io_parms , & bytes_read ,
1870+ & current_offset , & buf_type );
18371871 }
18381872 if (rc || (bytes_read == 0 )) {
18391873 if (total_read ) {
@@ -1970,7 +2004,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
19702004 char * smb_read_data = NULL ;
19712005 struct smb_com_read_rsp * pSMBr ;
19722006 struct cifsFileInfo * open_file ;
2007+ struct cifs_io_parms io_parms ;
19732008 int buf_type = CIFS_NO_BUFFER ;
2009+ __u32 pid ;
19742010
19752011 xid = GetXid ();
19762012 if (file -> private_data == NULL ) {
@@ -1992,6 +2028,11 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
19922028 goto read_complete ;
19932029
19942030 cFYI (DBG2 , "rpages: num pages %d" , num_pages );
2031+ if (cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD )
2032+ pid = open_file -> pid ;
2033+ else
2034+ pid = current -> tgid ;
2035+
19952036 for (i = 0 ; i < num_pages ; ) {
19962037 unsigned contig_pages ;
19972038 struct page * tmp_page ;
@@ -2033,12 +2074,13 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
20332074 if (rc != 0 )
20342075 break ;
20352076 }
2036-
2037- rc = CIFSSMBRead (xid , pTcon ,
2038- open_file -> netfid ,
2039- read_size , offset ,
2040- & bytes_read , & smb_read_data ,
2041- & buf_type );
2077+ io_parms .netfid = open_file -> netfid ;
2078+ io_parms .pid = pid ;
2079+ io_parms .tcon = pTcon ;
2080+ io_parms .offset = offset ;
2081+ io_parms .length = read_size ;
2082+ rc = CIFSSMBRead (xid , & io_parms , & bytes_read ,
2083+ & smb_read_data , & buf_type );
20422084 /* BB more RC checks ? */
20432085 if (rc == - EAGAIN ) {
20442086 if (smb_read_data ) {
0 commit comments