Commit c0fc6f25 authored by Steve French's avatar Steve French

Merge bk://cifs.bkbits.net/linux-2.5cifs

into stevef95.austin.ibm.com:/usr/src/bk/linux-2.5cifs
parents 5abccd42 8b550088
Version 1.07 Version 1.07
------------ ------------
Fix some small memory leaks in some unmount error paths. Fix some small memory leaks in some unmount error paths. Fix major leak
of cache pages in readpages causing multiple read oriented stress
testcases (including fsx, and even large file copy) to fail over time.
Version 1.06 Version 1.06
------------ ------------
......
...@@ -44,7 +44,7 @@ extern void SMBencrypt(unsigned char *passwd, unsigned char *c8, ...@@ -44,7 +44,7 @@ extern void SMBencrypt(unsigned char *passwd, unsigned char *c8,
unsigned char *p24); unsigned char *p24);
extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
unsigned char *p24); unsigned char *p24);
extern int cifs_inet_addr(char *); extern int cifs_inet_pton(int, const char *, void *dst);
struct smb_vol { struct smb_vol {
char *username; char *username;
...@@ -992,7 +992,23 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -992,7 +992,23 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
} }
if (volume_info.UNCip && volume_info.UNC) { if (volume_info.UNCip && volume_info.UNC) {
sin_server.sin_addr.s_addr = cifs_inet_addr(volume_info.UNCip); rc = cifs_inet_pton(AF_INET, volume_info.UNCip,&sin_server.sin_addr.s_addr);
if(rc == 0) {
/* not ipv4 address, try ipv6 */
rc = cifs_inet_pton(AF_INET6,volume_info.UNCip,&sin_server6.sin6_addr.in6_u);
}
if(rc != 1) {
/* we failed translating address */
if(volume_info.UNC)
kfree(volume_info.UNC);
if(volume_info.password)
kfree(volume_info.password);
FreeXid(xid);
return -EINVAL;
}
cFYI(1, ("UNC: %s ip: %s ", volume_info.UNC, volume_info.UNCip)); cFYI(1, ("UNC: %s ip: %s ", volume_info.UNC, volume_info.UNCip));
} else if (volume_info.UNCip){ } else if (volume_info.UNCip){
/* BB using ip addr as server name connect to the DFS root below */ /* BB using ip addr as server name connect to the DFS root below */
......
...@@ -933,7 +933,6 @@ static void cifs_copy_cache_pages(struct address_space *mapping, ...@@ -933,7 +933,6 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
continue; continue;
} }
page_cache_get(page);
target = kmap_atomic(page,KM_USER0); target = kmap_atomic(page,KM_USER0);
if(PAGE_CACHE_SIZE > bytes_read) { if(PAGE_CACHE_SIZE > bytes_read) {
...@@ -947,12 +946,11 @@ static void cifs_copy_cache_pages(struct address_space *mapping, ...@@ -947,12 +946,11 @@ static void cifs_copy_cache_pages(struct address_space *mapping,
} }
kunmap_atomic(target,KM_USER0); kunmap_atomic(target,KM_USER0);
if (!pagevec_add(plru_pvec, page))
__pagevec_lru_add(plru_pvec);
flush_dcache_page(page); flush_dcache_page(page);
SetPageUptodate(page); SetPageUptodate(page);
unlock_page(page); /* BB verify we need to unlock here */ unlock_page(page);
/* page_cache_release(page);*/ if (!pagevec_add(plru_pvec, page))
__pagevec_lru_add(plru_pvec);
data += PAGE_CACHE_SIZE; data += PAGE_CACHE_SIZE;
} }
return; return;
...@@ -1092,10 +1090,10 @@ cifs_readpages(struct file *file, struct address_space *mapping, ...@@ -1092,10 +1090,10 @@ cifs_readpages(struct file *file, struct address_space *mapping,
pagevec_lru_add(&lru_pvec); pagevec_lru_add(&lru_pvec);
/* need to free smb_read_data buf before exit */ /* need to free smb_read_data buf before exit */
if(smb_read_data) { if(smb_read_data) {
cifs_buf_release(smb_read_data); cifs_buf_release(smb_read_data);
smb_read_data = 0; smb_read_data = 0;
} }
FreeXid(xid); FreeXid(xid);
return rc; return rc;
......
...@@ -125,10 +125,10 @@ const struct smb_to_posix_error mapping_table_ERRHRD[] = { ...@@ -125,10 +125,10 @@ const struct smb_to_posix_error mapping_table_ERRHRD[] = {
/* Convert string containing dotted ip address to binary form */ /* Convert string containing dotted ip address to binary form */
/* returns 0 if invalid address */ /* returns 0 if invalid address */
/* BB add address family, change rc to status flag and return *//* also see inet_pton */ /* BB add address family, change rc to status flag and return union or for ipv6 */
/* To identify v4 vs. v6 - 1) check for colon (v6 only) 2) then call inet_pton to parse for bad address */ /* will need parent to call something like inet_pton to convert ipv6 address BB */
int int
cifs_inet_addr(char *cp) cifs_inet_pton(int address_family, char *cp,void *dst)
{ {
struct in_addr address; struct in_addr address;
int value; int value;
...@@ -140,6 +140,9 @@ cifs_inet_addr(char *cp) ...@@ -140,6 +140,9 @@ cifs_inet_addr(char *cp)
static const int addr_class_max[4] = static const int addr_class_max[4] =
{ 0xffffffff, 0xffffff, 0xffff, 0xff }; { 0xffffffff, 0xffffff, 0xffff, 0xff };
if(address_family != AF_INET)
return -EAFNOSUPPORT;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
bytes[i] = 0; bytes[i] = 0;
} }
...@@ -166,6 +169,9 @@ cifs_inet_addr(char *cp) ...@@ -166,6 +169,9 @@ cifs_inet_addr(char *cp)
return 0; return 0;
*end++ = value; *end++ = value;
temp = *++cp; temp = *++cp;
} else if (temp == ':') {
cFYI(1,("IPv6 addresses not supported for CIFS mounts yet"));
return -1;
} else } else
break; break;
} }
...@@ -182,8 +188,8 @@ cifs_inet_addr(char *cp) ...@@ -182,8 +188,8 @@ cifs_inet_addr(char *cp)
return 0; return 0;
address.s_addr = *((int *) bytes) | htonl(value); address.s_addr = *((int *) bytes) | htonl(value);
return address.s_addr; *((int *)dst) = address.s_addr;
return 1; /* success */
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment