aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/file.c')
-rw-r--r--fs/cifs/file.c142
1 files changed, 82 insertions, 60 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 2436ed8fc840..8a49b2e77d37 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -29,6 +29,7 @@
29#include <linux/pagevec.h> 29#include <linux/pagevec.h>
30#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
31#include <linux/writeback.h> 31#include <linux/writeback.h>
32#include <linux/task_io_accounting_ops.h>
32#include <linux/delay.h> 33#include <linux/delay.h>
33#include <asm/div64.h> 34#include <asm/div64.h>
34#include "cifsfs.h" 35#include "cifsfs.h"
@@ -122,34 +123,34 @@ static inline int cifs_open_inode_helper(struct inode *inode, struct file *file,
122 /* if not oplocked, invalidate inode pages if mtime or file 123 /* if not oplocked, invalidate inode pages if mtime or file
123 size changed */ 124 size changed */
124 temp = cifs_NTtimeToUnix(le64_to_cpu(buf->LastWriteTime)); 125 temp = cifs_NTtimeToUnix(le64_to_cpu(buf->LastWriteTime));
125 if (timespec_equal(&file->f_dentry->d_inode->i_mtime, &temp) && 126 if (timespec_equal(&file->f_path.dentry->d_inode->i_mtime, &temp) &&
126 (file->f_dentry->d_inode->i_size == 127 (file->f_path.dentry->d_inode->i_size ==
127 (loff_t)le64_to_cpu(buf->EndOfFile))) { 128 (loff_t)le64_to_cpu(buf->EndOfFile))) {
128 cFYI(1, ("inode unchanged on server")); 129 cFYI(1, ("inode unchanged on server"));
129 } else { 130 } else {
130 if (file->f_dentry->d_inode->i_mapping) { 131 if (file->f_path.dentry->d_inode->i_mapping) {
131 /* BB no need to lock inode until after invalidate 132 /* BB no need to lock inode until after invalidate
132 since namei code should already have it locked? */ 133 since namei code should already have it locked? */
133 filemap_write_and_wait(file->f_dentry->d_inode->i_mapping); 134 filemap_write_and_wait(file->f_path.dentry->d_inode->i_mapping);
134 } 135 }
135 cFYI(1, ("invalidating remote inode since open detected it " 136 cFYI(1, ("invalidating remote inode since open detected it "
136 "changed")); 137 "changed"));
137 invalidate_remote_inode(file->f_dentry->d_inode); 138 invalidate_remote_inode(file->f_path.dentry->d_inode);
138 } 139 }
139 140
140client_can_cache: 141client_can_cache:
141 if (pTcon->ses->capabilities & CAP_UNIX) 142 if (pTcon->ses->capabilities & CAP_UNIX)
142 rc = cifs_get_inode_info_unix(&file->f_dentry->d_inode, 143 rc = cifs_get_inode_info_unix(&file->f_path.dentry->d_inode,
143 full_path, inode->i_sb, xid); 144 full_path, inode->i_sb, xid);
144 else 145 else
145 rc = cifs_get_inode_info(&file->f_dentry->d_inode, 146 rc = cifs_get_inode_info(&file->f_path.dentry->d_inode,
146 full_path, buf, inode->i_sb, xid); 147 full_path, buf, inode->i_sb, xid);
147 148
148 if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) { 149 if ((*oplock & 0xF) == OPLOCK_EXCLUSIVE) {
149 pCifsInode->clientCanCacheAll = TRUE; 150 pCifsInode->clientCanCacheAll = TRUE;
150 pCifsInode->clientCanCacheRead = TRUE; 151 pCifsInode->clientCanCacheRead = TRUE;
151 cFYI(1, ("Exclusive Oplock granted on inode %p", 152 cFYI(1, ("Exclusive Oplock granted on inode %p",
152 file->f_dentry->d_inode)); 153 file->f_path.dentry->d_inode));
153 } else if ((*oplock & 0xF) == OPLOCK_READ) 154 } else if ((*oplock & 0xF) == OPLOCK_READ)
154 pCifsInode->clientCanCacheRead = TRUE; 155 pCifsInode->clientCanCacheRead = TRUE;
155 156
@@ -178,7 +179,7 @@ int cifs_open(struct inode *inode, struct file *file)
178 179
179 if (file->f_flags & O_CREAT) { 180 if (file->f_flags & O_CREAT) {
180 /* search inode for this file and fill in file->private_data */ 181 /* search inode for this file and fill in file->private_data */
181 pCifsInode = CIFS_I(file->f_dentry->d_inode); 182 pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
182 read_lock(&GlobalSMBSeslock); 183 read_lock(&GlobalSMBSeslock);
183 list_for_each(tmp, &pCifsInode->openFileList) { 184 list_for_each(tmp, &pCifsInode->openFileList) {
184 pCifsFile = list_entry(tmp, struct cifsFileInfo, 185 pCifsFile = list_entry(tmp, struct cifsFileInfo,
@@ -206,7 +207,7 @@ int cifs_open(struct inode *inode, struct file *file)
206 } 207 }
207 } 208 }
208 209
209 full_path = build_path_from_dentry(file->f_dentry); 210 full_path = build_path_from_dentry(file->f_path.dentry);
210 if (full_path == NULL) { 211 if (full_path == NULL) {
211 FreeXid(xid); 212 FreeXid(xid);
212 return -ENOMEM; 213 return -ENOMEM;
@@ -291,7 +292,7 @@ int cifs_open(struct inode *inode, struct file *file)
291 write_lock(&GlobalSMBSeslock); 292 write_lock(&GlobalSMBSeslock);
292 list_add(&pCifsFile->tlist, &pTcon->openFileList); 293 list_add(&pCifsFile->tlist, &pTcon->openFileList);
293 294
294 pCifsInode = CIFS_I(file->f_dentry->d_inode); 295 pCifsInode = CIFS_I(file->f_path.dentry->d_inode);
295 if (pCifsInode) { 296 if (pCifsInode) {
296 rc = cifs_open_inode_helper(inode, file, pCifsInode, 297 rc = cifs_open_inode_helper(inode, file, pCifsInode,
297 pCifsFile, pTcon, 298 pCifsFile, pTcon,
@@ -366,7 +367,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
366 return 0; 367 return 0;
367 } 368 }
368 369
369 if (file->f_dentry == NULL) { 370 if (file->f_path.dentry == NULL) {
370 up(&pCifsFile->fh_sem); 371 up(&pCifsFile->fh_sem);
371 cFYI(1, ("failed file reopen, no valid name if dentry freed")); 372 cFYI(1, ("failed file reopen, no valid name if dentry freed"));
372 FreeXid(xid); 373 FreeXid(xid);
@@ -378,7 +379,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
378 those that already have the rename sem can end up causing writepage 379 those that already have the rename sem can end up causing writepage
379 to get called and if the server was down that means we end up here, 380 to get called and if the server was down that means we end up here,
380 and we can never tell if the caller already has the rename_sem */ 381 and we can never tell if the caller already has the rename_sem */
381 full_path = build_path_from_dentry(file->f_dentry); 382 full_path = build_path_from_dentry(file->f_path.dentry);
382 if (full_path == NULL) { 383 if (full_path == NULL) {
383 up(&pCifsFile->fh_sem); 384 up(&pCifsFile->fh_sem);
384 FreeXid(xid); 385 FreeXid(xid);
@@ -444,7 +445,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
444 pCifsInode->clientCanCacheAll = TRUE; 445 pCifsInode->clientCanCacheAll = TRUE;
445 pCifsInode->clientCanCacheRead = TRUE; 446 pCifsInode->clientCanCacheRead = TRUE;
446 cFYI(1, ("Exclusive Oplock granted on inode %p", 447 cFYI(1, ("Exclusive Oplock granted on inode %p",
447 file->f_dentry->d_inode)); 448 file->f_path.dentry->d_inode));
448 } else if ((oplock & 0xF) == OPLOCK_READ) { 449 } else if ((oplock & 0xF) == OPLOCK_READ) {
449 pCifsInode->clientCanCacheRead = TRUE; 450 pCifsInode->clientCanCacheRead = TRUE;
450 pCifsInode->clientCanCacheAll = FALSE; 451 pCifsInode->clientCanCacheAll = FALSE;
@@ -551,7 +552,7 @@ int cifs_closedir(struct inode *inode, struct file *file)
551 552
552 if (pCFileStruct) { 553 if (pCFileStruct) {
553 struct cifsTconInfo *pTcon; 554 struct cifsTconInfo *pTcon;
554 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_dentry->d_sb); 555 struct cifs_sb_info *cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
555 556
556 pTcon = cifs_sb->tcon; 557 pTcon = cifs_sb->tcon;
557 558
@@ -664,7 +665,7 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock)
664 } else 665 } else
665 cFYI(1, ("Unknown type of lock")); 666 cFYI(1, ("Unknown type of lock"));
666 667
667 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 668 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
668 pTcon = cifs_sb->tcon; 669 pTcon = cifs_sb->tcon;
669 670
670 if (file->private_data == NULL) { 671 if (file->private_data == NULL) {
@@ -791,10 +792,10 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
791 int xid, long_op; 792 int xid, long_op;
792 struct cifsFileInfo *open_file; 793 struct cifsFileInfo *open_file;
793 794
794 if (file->f_dentry == NULL) 795 if (file->f_path.dentry == NULL)
795 return -EBADF; 796 return -EBADF;
796 797
797 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 798 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
798 if (cifs_sb == NULL) 799 if (cifs_sb == NULL)
799 return -EBADF; 800 return -EBADF;
800 801
@@ -802,7 +803,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
802 803
803 /* cFYI(1, 804 /* cFYI(1,
804 (" write %d bytes to offset %lld of %s", write_size, 805 (" write %d bytes to offset %lld of %s", write_size,
805 *poffset, file->f_dentry->d_name.name)); */ 806 *poffset, file->f_path.dentry->d_name.name)); */
806 807
807 if (file->private_data == NULL) 808 if (file->private_data == NULL)
808 return -EBADF; 809 return -EBADF;
@@ -810,12 +811,12 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
810 open_file = (struct cifsFileInfo *) file->private_data; 811 open_file = (struct cifsFileInfo *) file->private_data;
811 812
812 xid = GetXid(); 813 xid = GetXid();
813 if (file->f_dentry->d_inode == NULL) { 814 if (file->f_path.dentry->d_inode == NULL) {
814 FreeXid(xid); 815 FreeXid(xid);
815 return -EBADF; 816 return -EBADF;
816 } 817 }
817 818
818 if (*poffset > file->f_dentry->d_inode->i_size) 819 if (*poffset > file->f_path.dentry->d_inode->i_size)
819 long_op = 2; /* writes past end of file can take a long time */ 820 long_op = 2; /* writes past end of file can take a long time */
820 else 821 else
821 long_op = 1; 822 long_op = 1;
@@ -840,8 +841,8 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
840 return -EBADF; 841 return -EBADF;
841 } 842 }
842 if (open_file->invalidHandle) { 843 if (open_file->invalidHandle) {
843 if ((file->f_dentry == NULL) || 844 if ((file->f_path.dentry == NULL) ||
844 (file->f_dentry->d_inode == NULL)) { 845 (file->f_path.dentry->d_inode == NULL)) {
845 FreeXid(xid); 846 FreeXid(xid);
846 return total_written; 847 return total_written;
847 } 848 }
@@ -849,7 +850,7 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
849 filemap_fdatawait from here so tell 850 filemap_fdatawait from here so tell
850 reopen_file not to flush data to server 851 reopen_file not to flush data to server
851 now */ 852 now */
852 rc = cifs_reopen_file(file->f_dentry->d_inode, 853 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
853 file, FALSE); 854 file, FALSE);
854 if (rc != 0) 855 if (rc != 0)
855 break; 856 break;
@@ -878,17 +879,17 @@ ssize_t cifs_user_write(struct file *file, const char __user *write_data,
878 cifs_stats_bytes_written(pTcon, total_written); 879 cifs_stats_bytes_written(pTcon, total_written);
879 880
880 /* since the write may have blocked check these pointers again */ 881 /* since the write may have blocked check these pointers again */
881 if (file->f_dentry) { 882 if (file->f_path.dentry) {
882 if (file->f_dentry->d_inode) { 883 if (file->f_path.dentry->d_inode) {
883 struct inode *inode = file->f_dentry->d_inode; 884 struct inode *inode = file->f_path.dentry->d_inode;
884 inode->i_ctime = inode->i_mtime = 885 inode->i_ctime = inode->i_mtime =
885 current_fs_time(inode->i_sb); 886 current_fs_time(inode->i_sb);
886 if (total_written > 0) { 887 if (total_written > 0) {
887 if (*poffset > file->f_dentry->d_inode->i_size) 888 if (*poffset > file->f_path.dentry->d_inode->i_size)
888 i_size_write(file->f_dentry->d_inode, 889 i_size_write(file->f_path.dentry->d_inode,
889 *poffset); 890 *poffset);
890 } 891 }
891 mark_inode_dirty_sync(file->f_dentry->d_inode); 892 mark_inode_dirty_sync(file->f_path.dentry->d_inode);
892 } 893 }
893 } 894 }
894 FreeXid(xid); 895 FreeXid(xid);
@@ -906,17 +907,17 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
906 int xid, long_op; 907 int xid, long_op;
907 struct cifsFileInfo *open_file; 908 struct cifsFileInfo *open_file;
908 909
909 if (file->f_dentry == NULL) 910 if (file->f_path.dentry == NULL)
910 return -EBADF; 911 return -EBADF;
911 912
912 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 913 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
913 if (cifs_sb == NULL) 914 if (cifs_sb == NULL)
914 return -EBADF; 915 return -EBADF;
915 916
916 pTcon = cifs_sb->tcon; 917 pTcon = cifs_sb->tcon;
917 918
918 cFYI(1,("write %zd bytes to offset %lld of %s", write_size, 919 cFYI(1,("write %zd bytes to offset %lld of %s", write_size,
919 *poffset, file->f_dentry->d_name.name)); 920 *poffset, file->f_path.dentry->d_name.name));
920 921
921 if (file->private_data == NULL) 922 if (file->private_data == NULL)
922 return -EBADF; 923 return -EBADF;
@@ -924,12 +925,12 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
924 open_file = (struct cifsFileInfo *)file->private_data; 925 open_file = (struct cifsFileInfo *)file->private_data;
925 926
926 xid = GetXid(); 927 xid = GetXid();
927 if (file->f_dentry->d_inode == NULL) { 928 if (file->f_path.dentry->d_inode == NULL) {
928 FreeXid(xid); 929 FreeXid(xid);
929 return -EBADF; 930 return -EBADF;
930 } 931 }
931 932
932 if (*poffset > file->f_dentry->d_inode->i_size) 933 if (*poffset > file->f_path.dentry->d_inode->i_size)
933 long_op = 2; /* writes past end of file can take a long time */ 934 long_op = 2; /* writes past end of file can take a long time */
934 else 935 else
935 long_op = 1; 936 long_op = 1;
@@ -955,8 +956,8 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
955 return -EBADF; 956 return -EBADF;
956 } 957 }
957 if (open_file->invalidHandle) { 958 if (open_file->invalidHandle) {
958 if ((file->f_dentry == NULL) || 959 if ((file->f_path.dentry == NULL) ||
959 (file->f_dentry->d_inode == NULL)) { 960 (file->f_path.dentry->d_inode == NULL)) {
960 FreeXid(xid); 961 FreeXid(xid);
961 return total_written; 962 return total_written;
962 } 963 }
@@ -964,7 +965,7 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
964 filemap_fdatawait from here so tell 965 filemap_fdatawait from here so tell
965 reopen_file not to flush data to 966 reopen_file not to flush data to
966 server now */ 967 server now */
967 rc = cifs_reopen_file(file->f_dentry->d_inode, 968 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
968 file, FALSE); 969 file, FALSE);
969 if (rc != 0) 970 if (rc != 0)
970 break; 971 break;
@@ -1011,16 +1012,16 @@ static ssize_t cifs_write(struct file *file, const char *write_data,
1011 cifs_stats_bytes_written(pTcon, total_written); 1012 cifs_stats_bytes_written(pTcon, total_written);
1012 1013
1013 /* since the write may have blocked check these pointers again */ 1014 /* since the write may have blocked check these pointers again */
1014 if (file->f_dentry) { 1015 if (file->f_path.dentry) {
1015 if (file->f_dentry->d_inode) { 1016 if (file->f_path.dentry->d_inode) {
1016 file->f_dentry->d_inode->i_ctime = 1017 file->f_path.dentry->d_inode->i_ctime =
1017 file->f_dentry->d_inode->i_mtime = CURRENT_TIME; 1018 file->f_path.dentry->d_inode->i_mtime = CURRENT_TIME;
1018 if (total_written > 0) { 1019 if (total_written > 0) {
1019 if (*poffset > file->f_dentry->d_inode->i_size) 1020 if (*poffset > file->f_path.dentry->d_inode->i_size)
1020 i_size_write(file->f_dentry->d_inode, 1021 i_size_write(file->f_path.dentry->d_inode,
1021 *poffset); 1022 *poffset);
1022 } 1023 }
1023 mark_inode_dirty_sync(file->f_dentry->d_inode); 1024 mark_inode_dirty_sync(file->f_path.dentry->d_inode);
1024 } 1025 }
1025 } 1026 }
1026 FreeXid(xid); 1027 FreeXid(xid);
@@ -1244,14 +1245,21 @@ retry:
1244 wait_on_page_writeback(page); 1245 wait_on_page_writeback(page);
1245 1246
1246 if (PageWriteback(page) || 1247 if (PageWriteback(page) ||
1247 !test_clear_page_dirty(page)) { 1248 !clear_page_dirty_for_io(page)) {
1248 unlock_page(page); 1249 unlock_page(page);
1249 break; 1250 break;
1250 } 1251 }
1251 1252
1253 /*
1254 * This actually clears the dirty bit in the radix tree.
1255 * See cifs_writepage() for more commentary.
1256 */
1257 set_page_writeback(page);
1258
1252 if (page_offset(page) >= mapping->host->i_size) { 1259 if (page_offset(page) >= mapping->host->i_size) {
1253 done = 1; 1260 done = 1;
1254 unlock_page(page); 1261 unlock_page(page);
1262 end_page_writeback(page);
1255 break; 1263 break;
1256 } 1264 }
1257 1265
@@ -1315,6 +1323,7 @@ retry:
1315 SetPageError(page); 1323 SetPageError(page);
1316 kunmap(page); 1324 kunmap(page);
1317 unlock_page(page); 1325 unlock_page(page);
1326 end_page_writeback(page);
1318 page_cache_release(page); 1327 page_cache_release(page);
1319 } 1328 }
1320 if ((wbc->nr_to_write -= n_iov) <= 0) 1329 if ((wbc->nr_to_write -= n_iov) <= 0)
@@ -1351,11 +1360,23 @@ static int cifs_writepage(struct page* page, struct writeback_control *wbc)
1351 if (!PageUptodate(page)) { 1360 if (!PageUptodate(page)) {
1352 cFYI(1, ("ppw - page not up to date")); 1361 cFYI(1, ("ppw - page not up to date"));
1353 } 1362 }
1354 1363
1364 /*
1365 * Set the "writeback" flag, and clear "dirty" in the radix tree.
1366 *
1367 * A writepage() implementation always needs to do either this,
1368 * or re-dirty the page with "redirty_page_for_writepage()" in
1369 * the case of a failure.
1370 *
1371 * Just unlocking the page will cause the radix tree tag-bits
1372 * to fail to update with the state of the page correctly.
1373 */
1374 set_page_writeback(page);
1355 rc = cifs_partialpagewrite(page, 0, PAGE_CACHE_SIZE); 1375 rc = cifs_partialpagewrite(page, 0, PAGE_CACHE_SIZE);
1356 SetPageUptodate(page); /* BB add check for error and Clearuptodate? */ 1376 SetPageUptodate(page); /* BB add check for error and Clearuptodate? */
1357 unlock_page(page); 1377 unlock_page(page);
1358 page_cache_release(page); 1378 end_page_writeback(page);
1379 page_cache_release(page);
1359 FreeXid(xid); 1380 FreeXid(xid);
1360 return rc; 1381 return rc;
1361} 1382}
@@ -1384,7 +1405,7 @@ static int cifs_commit_write(struct file *file, struct page *page,
1384 if ((open_file->invalidHandle) && 1405 if ((open_file->invalidHandle) &&
1385 (!open_file->closePend)) { 1406 (!open_file->closePend)) {
1386 rc = cifs_reopen_file( 1407 rc = cifs_reopen_file(
1387 file->f_dentry->d_inode, file); 1408 file->f_path.dentry->d_inode, file);
1388 if (rc != 0) 1409 if (rc != 0)
1389 break; 1410 break;
1390 } 1411 }
@@ -1434,7 +1455,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1434{ 1455{
1435 int xid; 1456 int xid;
1436 int rc = 0; 1457 int rc = 0;
1437 struct inode *inode = file->f_dentry->d_inode; 1458 struct inode *inode = file->f_path.dentry->d_inode;
1438 1459
1439 xid = GetXid(); 1460 xid = GetXid();
1440 1461
@@ -1482,7 +1503,7 @@ int cifs_fsync(struct file *file, struct dentry *dentry, int datasync)
1482 */ 1503 */
1483int cifs_flush(struct file *file, fl_owner_t id) 1504int cifs_flush(struct file *file, fl_owner_t id)
1484{ 1505{
1485 struct inode * inode = file->f_dentry->d_inode; 1506 struct inode * inode = file->f_path.dentry->d_inode;
1486 int rc = 0; 1507 int rc = 0;
1487 1508
1488 /* Rather than do the steps manually: 1509 /* Rather than do the steps manually:
@@ -1519,7 +1540,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1519 struct smb_com_read_rsp *pSMBr; 1540 struct smb_com_read_rsp *pSMBr;
1520 1541
1521 xid = GetXid(); 1542 xid = GetXid();
1522 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1543 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1523 pTcon = cifs_sb->tcon; 1544 pTcon = cifs_sb->tcon;
1524 1545
1525 if (file->private_data == NULL) { 1546 if (file->private_data == NULL) {
@@ -1542,7 +1563,7 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1542 int buf_type = CIFS_NO_BUFFER; 1563 int buf_type = CIFS_NO_BUFFER;
1543 if ((open_file->invalidHandle) && 1564 if ((open_file->invalidHandle) &&
1544 (!open_file->closePend)) { 1565 (!open_file->closePend)) {
1545 rc = cifs_reopen_file(file->f_dentry->d_inode, 1566 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
1546 file, TRUE); 1567 file, TRUE);
1547 if (rc != 0) 1568 if (rc != 0)
1548 break; 1569 break;
@@ -1601,7 +1622,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1601 int buf_type = CIFS_NO_BUFFER; 1622 int buf_type = CIFS_NO_BUFFER;
1602 1623
1603 xid = GetXid(); 1624 xid = GetXid();
1604 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1625 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1605 pTcon = cifs_sb->tcon; 1626 pTcon = cifs_sb->tcon;
1606 1627
1607 if (file->private_data == NULL) { 1628 if (file->private_data == NULL) {
@@ -1629,7 +1650,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1629 while (rc == -EAGAIN) { 1650 while (rc == -EAGAIN) {
1630 if ((open_file->invalidHandle) && 1651 if ((open_file->invalidHandle) &&
1631 (!open_file->closePend)) { 1652 (!open_file->closePend)) {
1632 rc = cifs_reopen_file(file->f_dentry->d_inode, 1653 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
1633 file, TRUE); 1654 file, TRUE);
1634 if (rc != 0) 1655 if (rc != 0)
1635 break; 1656 break;
@@ -1658,7 +1679,7 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1658 1679
1659int cifs_file_mmap(struct file *file, struct vm_area_struct *vma) 1680int cifs_file_mmap(struct file *file, struct vm_area_struct *vma)
1660{ 1681{
1661 struct dentry *dentry = file->f_dentry; 1682 struct dentry *dentry = file->f_path.dentry;
1662 int rc, xid; 1683 int rc, xid;
1663 1684
1664 xid = GetXid(); 1685 xid = GetXid();
@@ -1744,7 +1765,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1744 return -EBADF; 1765 return -EBADF;
1745 } 1766 }
1746 open_file = (struct cifsFileInfo *)file->private_data; 1767 open_file = (struct cifsFileInfo *)file->private_data;
1747 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1768 cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
1748 pTcon = cifs_sb->tcon; 1769 pTcon = cifs_sb->tcon;
1749 1770
1750 pagevec_init(&lru_pvec, 0); 1771 pagevec_init(&lru_pvec, 0);
@@ -1786,7 +1807,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1786 while (rc == -EAGAIN) { 1807 while (rc == -EAGAIN) {
1787 if ((open_file->invalidHandle) && 1808 if ((open_file->invalidHandle) &&
1788 (!open_file->closePend)) { 1809 (!open_file->closePend)) {
1789 rc = cifs_reopen_file(file->f_dentry->d_inode, 1810 rc = cifs_reopen_file(file->f_path.dentry->d_inode,
1790 file, TRUE); 1811 file, TRUE);
1791 if (rc != 0) 1812 if (rc != 0)
1792 break; 1813 break;
@@ -1812,6 +1833,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1812 cFYI(1, ("Read error in readpages: %d", rc)); 1833 cFYI(1, ("Read error in readpages: %d", rc));
1813 break; 1834 break;
1814 } else if (bytes_read > 0) { 1835 } else if (bytes_read > 0) {
1836 task_io_account_read(bytes_read);
1815 pSMBr = (struct smb_com_read_rsp *)smb_read_data; 1837 pSMBr = (struct smb_com_read_rsp *)smb_read_data;
1816 cifs_copy_cache_pages(mapping, page_list, bytes_read, 1838 cifs_copy_cache_pages(mapping, page_list, bytes_read,
1817 smb_read_data + 4 /* RFC1001 hdr */ + 1839 smb_read_data + 4 /* RFC1001 hdr */ +
@@ -1880,8 +1902,8 @@ static int cifs_readpage_worker(struct file *file, struct page *page,
1880 else 1902 else
1881 cFYI(1, ("Bytes read %d",rc)); 1903 cFYI(1, ("Bytes read %d",rc));
1882 1904
1883 file->f_dentry->d_inode->i_atime = 1905 file->f_path.dentry->d_inode->i_atime =
1884 current_fs_time(file->f_dentry->d_inode->i_sb); 1906 current_fs_time(file->f_path.dentry->d_inode->i_sb);
1885 1907
1886 if (PAGE_CACHE_SIZE > rc) 1908 if (PAGE_CACHE_SIZE > rc)
1887 memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc); 1909 memset(read_data + rc, 0, PAGE_CACHE_SIZE - rc);