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.c58
1 files changed, 4 insertions, 54 deletions
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index b6c303f6373f..5ecda554f913 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -1183,16 +1183,11 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1183 char *smb_read_data; 1183 char *smb_read_data;
1184 char __user *current_offset; 1184 char __user *current_offset;
1185 struct smb_com_read_rsp *pSMBr; 1185 struct smb_com_read_rsp *pSMBr;
1186 int use_old_read = FALSE;
1187 1186
1188 xid = GetXid(); 1187 xid = GetXid();
1189 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1188 cifs_sb = CIFS_SB(file->f_dentry->d_sb);
1190 pTcon = cifs_sb->tcon; 1189 pTcon = cifs_sb->tcon;
1191 1190
1192 if(pTcon->ses)
1193 if((pTcon->ses->capabilities & CAP_LARGE_FILES) == 0)
1194 use_old_read = TRUE;
1195
1196 if (file->private_data == NULL) { 1191 if (file->private_data == NULL) {
1197 FreeXid(xid); 1192 FreeXid(xid);
1198 return -EBADF; 1193 return -EBADF;
@@ -1217,22 +1212,10 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data,
1217 if (rc != 0) 1212 if (rc != 0)
1218 break; 1213 break;
1219 } 1214 }
1220 if(use_old_read) 1215 rc = CIFSSMBRead(xid, pTcon,
1221 rc = SMBLegacyRead(xid, pTcon,
1222 open_file->netfid,
1223 current_read_size, *poffset,
1224 &bytes_read, &smb_read_data);
1225 else {
1226 rc = CIFSSMBRead(xid, pTcon,
1227 open_file->netfid, 1216 open_file->netfid,
1228 current_read_size, *poffset, 1217 current_read_size, *poffset,
1229 &bytes_read, &smb_read_data); 1218 &bytes_read, &smb_read_data);
1230 if(rc == -EINVAL) {
1231 use_old_read = TRUE;
1232 rc = -EAGAIN;
1233 continue;
1234 }
1235 }
1236 pSMBr = (struct smb_com_read_rsp *)smb_read_data; 1219 pSMBr = (struct smb_com_read_rsp *)smb_read_data;
1237 if (copy_to_user(current_offset, 1220 if (copy_to_user(current_offset,
1238 smb_read_data + 4 /* RFC1001 hdr */ 1221 smb_read_data + 4 /* RFC1001 hdr */
@@ -1276,7 +1259,6 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1276 int xid; 1259 int xid;
1277 char *current_offset; 1260 char *current_offset;
1278 struct cifsFileInfo *open_file; 1261 struct cifsFileInfo *open_file;
1279 int use_old_read = FALSE;
1280 1262
1281 xid = GetXid(); 1263 xid = GetXid();
1282 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1264 cifs_sb = CIFS_SB(file->f_dentry->d_sb);
@@ -1287,9 +1269,6 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1287 return -EBADF; 1269 return -EBADF;
1288 } 1270 }
1289 open_file = (struct cifsFileInfo *)file->private_data; 1271 open_file = (struct cifsFileInfo *)file->private_data;
1290 if(pTcon->ses)
1291 if((pTcon->ses->capabilities & CAP_LARGE_FILES) == 0)
1292 use_old_read = TRUE;
1293 1272
1294 if ((file->f_flags & O_ACCMODE) == O_WRONLY) 1273 if ((file->f_flags & O_ACCMODE) == O_WRONLY)
1295 cFYI(1, ("attempting read on write only file instance")); 1274 cFYI(1, ("attempting read on write only file instance"));
@@ -1308,24 +1287,10 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
1308 if (rc != 0) 1287 if (rc != 0)
1309 break; 1288 break;
1310 } 1289 }
1311 if(use_old_read) 1290 rc = CIFSSMBRead(xid, pTcon,
1312 rc = SMBLegacyRead(xid, pTcon,
1313 open_file->netfid,
1314 current_read_size, *poffset,
1315 &bytes_read, &current_offset);
1316 else {
1317 rc = CIFSSMBRead(xid, pTcon,
1318 open_file->netfid, 1291 open_file->netfid,
1319 current_read_size, *poffset, 1292 current_read_size, *poffset,
1320 &bytes_read, &current_offset); 1293 &bytes_read, &current_offset);
1321 /* check if server disavows support for
1322 64 bit offsets */
1323 if(rc == -EINVAL) {
1324 rc = -EAGAIN;
1325 use_old_read = TRUE;
1326 continue;
1327 }
1328 }
1329 } 1294 }
1330 if (rc || (bytes_read == 0)) { 1295 if (rc || (bytes_read == 0)) {
1331 if (total_read) { 1296 if (total_read) {
@@ -1423,7 +1388,6 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1423 struct smb_com_read_rsp *pSMBr; 1388 struct smb_com_read_rsp *pSMBr;
1424 struct pagevec lru_pvec; 1389 struct pagevec lru_pvec;
1425 struct cifsFileInfo *open_file; 1390 struct cifsFileInfo *open_file;
1426 int use_old_read = FALSE;
1427 1391
1428 xid = GetXid(); 1392 xid = GetXid();
1429 if (file->private_data == NULL) { 1393 if (file->private_data == NULL) {
@@ -1433,9 +1397,7 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1433 open_file = (struct cifsFileInfo *)file->private_data; 1397 open_file = (struct cifsFileInfo *)file->private_data;
1434 cifs_sb = CIFS_SB(file->f_dentry->d_sb); 1398 cifs_sb = CIFS_SB(file->f_dentry->d_sb);
1435 pTcon = cifs_sb->tcon; 1399 pTcon = cifs_sb->tcon;
1436 if(pTcon->ses) 1400
1437 if((pTcon->ses->capabilities & CAP_LARGE_FILES) == 0)
1438 use_old_read = TRUE;
1439 pagevec_init(&lru_pvec, 0); 1401 pagevec_init(&lru_pvec, 0);
1440 1402
1441 for (i = 0; i < num_pages; ) { 1403 for (i = 0; i < num_pages; ) {
@@ -1481,22 +1443,10 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
1481 break; 1443 break;
1482 } 1444 }
1483 1445
1484 if(use_old_read) 1446 rc = CIFSSMBRead(xid, pTcon,
1485 rc = SMBLegacyRead(xid, pTcon,
1486 open_file->netfid,
1487 read_size, offset,
1488 &bytes_read, &smb_read_data);
1489 else {
1490 rc = CIFSSMBRead(xid, pTcon,
1491 open_file->netfid, 1447 open_file->netfid,
1492 read_size, offset, 1448 read_size, offset,
1493 &bytes_read, &smb_read_data); 1449 &bytes_read, &smb_read_data);
1494 if(rc == -EINVAL) {
1495 use_old_read = TRUE;
1496 rc = -EAGAIN;
1497 continue;
1498 }
1499 }
1500 1450
1501 /* BB more RC checks ? */ 1451 /* BB more RC checks ? */
1502 if (rc== -EAGAIN) { 1452 if (rc== -EAGAIN) {