diff options
author | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-03-14 18:05:45 -0500 |
---|---|---|
committer | Dave Kleikamp <shaggy@austin.ibm.com> | 2006-03-14 18:05:45 -0500 |
commit | c5111f504d2a9b0d258d7c4752b4093523315989 (patch) | |
tree | 6a52864aff79691689aea21cb0cb928327d5de5b /fs/cifs | |
parent | 69eb66d7da7dba2696281981347698e1693c2340 (diff) | |
parent | a488edc914aa1d766a4e2c982b5ae03d5657ec1b (diff) |
Merge with /home/shaggy/git/linus-clean/
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/cifsproto.h | 2 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 7 | ||||
-rw-r--r-- | fs/cifs/connect.c | 21 | ||||
-rw-r--r-- | fs/cifs/file.c | 22 | ||||
-rw-r--r-- | fs/cifs/misc.c | 4 | ||||
-rw-r--r-- | fs/cifs/transport.c | 1 |
6 files changed, 37 insertions, 20 deletions
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 3c03aadaff..7b25463d3c 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -52,7 +52,7 @@ extern int SendReceive2(const unsigned int /* xid */ , struct cifsSesInfo *, | |||
52 | int * /* type of buf returned */ , const int long_op); | 52 | int * /* type of buf returned */ , const int long_op); |
53 | extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid); | 53 | extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid); |
54 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length); | 54 | extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length); |
55 | extern int is_valid_oplock_break(struct smb_hdr *smb); | 55 | extern int is_valid_oplock_break(struct smb_hdr *smb, struct TCP_Server_Info *); |
56 | extern int is_size_safe_to_change(struct cifsInodeInfo *); | 56 | extern int is_size_safe_to_change(struct cifsInodeInfo *); |
57 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); | 57 | extern struct cifsFileInfo *find_writable_file(struct cifsInodeInfo *); |
58 | extern unsigned int smbCalcSize(struct smb_hdr *ptr); | 58 | extern unsigned int smbCalcSize(struct smb_hdr *ptr); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 217323b0c8..b41e8b3796 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -1048,13 +1048,14 @@ CIFSSMBRead(const int xid, struct cifsTconInfo *tcon, | |||
1048 | cifs_small_buf_release(iov[0].iov_base); | 1048 | cifs_small_buf_release(iov[0].iov_base); |
1049 | else if(resp_buf_type == CIFS_LARGE_BUFFER) | 1049 | else if(resp_buf_type == CIFS_LARGE_BUFFER) |
1050 | cifs_buf_release(iov[0].iov_base); | 1050 | cifs_buf_release(iov[0].iov_base); |
1051 | } else /* return buffer to caller to free */ /* BB FIXME how do we tell caller if it is not a large buffer */ { | 1051 | } else if(resp_buf_type != CIFS_NO_BUFFER) { |
1052 | *buf = iov[0].iov_base; | 1052 | /* return buffer to caller to free */ |
1053 | *buf = iov[0].iov_base; | ||
1053 | if(resp_buf_type == CIFS_SMALL_BUFFER) | 1054 | if(resp_buf_type == CIFS_SMALL_BUFFER) |
1054 | *pbuf_type = CIFS_SMALL_BUFFER; | 1055 | *pbuf_type = CIFS_SMALL_BUFFER; |
1055 | else if(resp_buf_type == CIFS_LARGE_BUFFER) | 1056 | else if(resp_buf_type == CIFS_LARGE_BUFFER) |
1056 | *pbuf_type = CIFS_LARGE_BUFFER; | 1057 | *pbuf_type = CIFS_LARGE_BUFFER; |
1057 | } | 1058 | } /* else no valid buffer on return - leave as null */ |
1058 | 1059 | ||
1059 | /* Note: On -EAGAIN error only caller can retry on handle based calls | 1060 | /* Note: On -EAGAIN error only caller can retry on handle based calls |
1060 | since file handle passed in no longer valid */ | 1061 | since file handle passed in no longer valid */ |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 88f60aa520..2a0c1f4ca0 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -630,7 +630,7 @@ multi_t2_fnd: | |||
630 | smallbuf = NULL; | 630 | smallbuf = NULL; |
631 | } | 631 | } |
632 | wake_up_process(task_to_wake); | 632 | wake_up_process(task_to_wake); |
633 | } else if ((is_valid_oplock_break(smb_buffer) == FALSE) | 633 | } else if ((is_valid_oplock_break(smb_buffer, server) == FALSE) |
634 | && (isMultiRsp == FALSE)) { | 634 | && (isMultiRsp == FALSE)) { |
635 | cERROR(1, ("No task to wake, unknown frame rcvd!")); | 635 | cERROR(1, ("No task to wake, unknown frame rcvd!")); |
636 | cifs_dump_mem("Received Data is: ",(char *)smb_buffer, | 636 | cifs_dump_mem("Received Data is: ",(char *)smb_buffer, |
@@ -1785,11 +1785,20 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1785 | } else if(volume_info.wsize) | 1785 | } else if(volume_info.wsize) |
1786 | cifs_sb->wsize = volume_info.wsize; | 1786 | cifs_sb->wsize = volume_info.wsize; |
1787 | else | 1787 | else |
1788 | cifs_sb->wsize = CIFSMaxBufSize; /* default */ | 1788 | cifs_sb->wsize = |
1789 | if(cifs_sb->rsize < PAGE_CACHE_SIZE) { | 1789 | min_t(const int, PAGEVEC_SIZE * PAGE_CACHE_SIZE, |
1790 | cifs_sb->rsize = PAGE_CACHE_SIZE; | 1790 | 127*1024); |
1791 | /* Windows ME does this */ | 1791 | /* old default of CIFSMaxBufSize was too small now |
1792 | cFYI(1,("Attempt to set readsize for mount to less than one page (4096)")); | 1792 | that SMB Write2 can send multiple pages in kvec. |
1793 | RFC1001 does not describe what happens when frame | ||
1794 | bigger than 128K is sent so use that as max in | ||
1795 | conjunction with 52K kvec constraint on arch with 4K | ||
1796 | page size */ | ||
1797 | |||
1798 | if(cifs_sb->rsize < 2048) { | ||
1799 | cifs_sb->rsize = 2048; | ||
1800 | /* Windows ME may prefer this */ | ||
1801 | cFYI(1,("readsize set to minimum 2048")); | ||
1793 | } | 1802 | } |
1794 | cifs_sb->mnt_uid = volume_info.linux_uid; | 1803 | cifs_sb->mnt_uid = volume_info.linux_uid; |
1795 | cifs_sb->mnt_gid = volume_info.linux_gid; | 1804 | cifs_sb->mnt_gid = volume_info.linux_gid; |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 77c990f0cb..675bd25682 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -1190,7 +1190,6 @@ retry: | |||
1190 | /* BB what if continued retry is | 1190 | /* BB what if continued retry is |
1191 | requested via mount flags? */ | 1191 | requested via mount flags? */ |
1192 | set_bit(AS_EIO, &mapping->flags); | 1192 | set_bit(AS_EIO, &mapping->flags); |
1193 | SetPageError(page); | ||
1194 | } else { | 1193 | } else { |
1195 | cifs_stats_bytes_written(cifs_sb->tcon, | 1194 | cifs_stats_bytes_written(cifs_sb->tcon, |
1196 | bytes_written); | 1195 | bytes_written); |
@@ -1198,6 +1197,13 @@ retry: | |||
1198 | } | 1197 | } |
1199 | for (i = 0; i < n_iov; i++) { | 1198 | for (i = 0; i < n_iov; i++) { |
1200 | page = pvec.pages[first + i]; | 1199 | page = pvec.pages[first + i]; |
1200 | /* Should we also set page error on | ||
1201 | success rc but too little data written? */ | ||
1202 | /* BB investigate retry logic on temporary | ||
1203 | server crash cases and how recovery works | ||
1204 | when page marked as error */ | ||
1205 | if(rc) | ||
1206 | SetPageError(page); | ||
1201 | kunmap(page); | 1207 | kunmap(page); |
1202 | unlock_page(page); | 1208 | unlock_page(page); |
1203 | page_cache_release(page); | 1209 | page_cache_release(page); |
@@ -1436,13 +1442,15 @@ ssize_t cifs_user_read(struct file *file, char __user *read_data, | |||
1436 | &bytes_read, &smb_read_data, | 1442 | &bytes_read, &smb_read_data, |
1437 | &buf_type); | 1443 | &buf_type); |
1438 | pSMBr = (struct smb_com_read_rsp *)smb_read_data; | 1444 | pSMBr = (struct smb_com_read_rsp *)smb_read_data; |
1439 | if (copy_to_user(current_offset, | ||
1440 | smb_read_data + 4 /* RFC1001 hdr */ | ||
1441 | + le16_to_cpu(pSMBr->DataOffset), | ||
1442 | bytes_read)) { | ||
1443 | rc = -EFAULT; | ||
1444 | } | ||
1445 | if (smb_read_data) { | 1445 | if (smb_read_data) { |
1446 | if (copy_to_user(current_offset, | ||
1447 | smb_read_data + | ||
1448 | 4 /* RFC1001 length field */ + | ||
1449 | le16_to_cpu(pSMBr->DataOffset), | ||
1450 | bytes_read)) { | ||
1451 | rc = -EFAULT; | ||
1452 | } | ||
1453 | |||
1446 | if(buf_type == CIFS_SMALL_BUFFER) | 1454 | if(buf_type == CIFS_SMALL_BUFFER) |
1447 | cifs_small_buf_release(smb_read_data); | 1455 | cifs_small_buf_release(smb_read_data); |
1448 | else if(buf_type == CIFS_LARGE_BUFFER) | 1456 | else if(buf_type == CIFS_LARGE_BUFFER) |
diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 812c6bb0fe..432ba15e2c 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c | |||
@@ -475,7 +475,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length) | |||
475 | return 0; | 475 | return 0; |
476 | } | 476 | } |
477 | int | 477 | int |
478 | is_valid_oplock_break(struct smb_hdr *buf) | 478 | is_valid_oplock_break(struct smb_hdr *buf, struct TCP_Server_Info *srv) |
479 | { | 479 | { |
480 | struct smb_com_lock_req * pSMB = (struct smb_com_lock_req *)buf; | 480 | struct smb_com_lock_req * pSMB = (struct smb_com_lock_req *)buf; |
481 | struct list_head *tmp; | 481 | struct list_head *tmp; |
@@ -535,7 +535,7 @@ is_valid_oplock_break(struct smb_hdr *buf) | |||
535 | read_lock(&GlobalSMBSeslock); | 535 | read_lock(&GlobalSMBSeslock); |
536 | list_for_each(tmp, &GlobalTreeConnectionList) { | 536 | list_for_each(tmp, &GlobalTreeConnectionList) { |
537 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); | 537 | tcon = list_entry(tmp, struct cifsTconInfo, cifsConnectionList); |
538 | if (tcon->tid == buf->Tid) { | 538 | if ((tcon->tid == buf->Tid) && (srv == tcon->ses->server)) { |
539 | cifs_stats_inc(&tcon->num_oplock_brks); | 539 | cifs_stats_inc(&tcon->num_oplock_brks); |
540 | list_for_each(tmp1,&tcon->openFileList){ | 540 | list_for_each(tmp1,&tcon->openFileList){ |
541 | netfile = list_entry(tmp1,struct cifsFileInfo, | 541 | netfile = list_entry(tmp1,struct cifsFileInfo, |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index 7b98792150..b12cb8a7da 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -498,7 +498,6 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
498 | else | 498 | else |
499 | *pRespBufType = CIFS_SMALL_BUFFER; | 499 | *pRespBufType = CIFS_SMALL_BUFFER; |
500 | iov[0].iov_len = receive_len + 4; | 500 | iov[0].iov_len = receive_len + 4; |
501 | iov[1].iov_len = 0; | ||
502 | 501 | ||
503 | dump_smb(midQ->resp_buf, 80); | 502 | dump_smb(midQ->resp_buf, 80); |
504 | /* convert the length into a more usable form */ | 503 | /* convert the length into a more usable form */ |