diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-05 18:30:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-05-05 18:30:53 -0400 |
commit | b7405e16435f710edfae6ba32bef4ca20d3de145 (patch) | |
tree | e79fd7560d8c093cb975ed61b24d009a080872c5 /fs/cifs/connect.c | |
parent | ea62ccd00fd0b6720b033adfc9984f31130ce195 (diff) | |
parent | 0ec54aa8af5e6faa346aa55a1ad15ee6c25bb42d (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
[CIFS] Fix typo in cifs readme from previous commit
[CIFS] Make sec=none force an anonymous mount
[CIFS] Change semaphore to mutex for cifs lock_sem
[CIFS] Fix oops in reset_cifs_unix_caps on reconnect
[CIFS] UID/GID override on CIFS mounts to Samba
[CIFS] prefixpath mounts to servers supporting posix paths used wrong slash
[CIFS] Update cifs version to 1.49
[CIFS] Replace kmalloc/memset combination with kzalloc
[CIFS] Add IPv6 support
[CIFS] New CIFS POSIX mkdir performance improvement (part 2)
[CIFS] New CIFS POSIX mkdir performance improvement
[CIFS] Add write perm for usr to file on windows should remove r/o dos attr
[CIFS] Remove unnecessary parm to cifs_reopen_file
[CIFS] Switch cifsd to kthread_run from kernel_thread
[CIFS] Remove unnecessary checks
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 140 |
1 files changed, 80 insertions, 60 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 20ba7dcc9959..216fb625843f 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/mempool.h> | 30 | #include <linux/mempool.h> |
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/completion.h> | 32 | #include <linux/completion.h> |
33 | #include <linux/kthread.h> | ||
33 | #include <linux/pagevec.h> | 34 | #include <linux/pagevec.h> |
34 | #include <linux/freezer.h> | 35 | #include <linux/freezer.h> |
35 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
@@ -74,6 +75,8 @@ struct smb_vol { | |||
74 | unsigned retry:1; | 75 | unsigned retry:1; |
75 | unsigned intr:1; | 76 | unsigned intr:1; |
76 | unsigned setuids:1; | 77 | unsigned setuids:1; |
78 | unsigned override_uid:1; | ||
79 | unsigned override_gid:1; | ||
77 | unsigned noperm:1; | 80 | unsigned noperm:1; |
78 | unsigned no_psx_acl:1; /* set if posix acl support should be disabled */ | 81 | unsigned no_psx_acl:1; /* set if posix acl support should be disabled */ |
79 | unsigned cifs_acl:1; | 82 | unsigned cifs_acl:1; |
@@ -120,7 +123,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
120 | struct mid_q_entry * mid_entry; | 123 | struct mid_q_entry * mid_entry; |
121 | 124 | ||
122 | spin_lock(&GlobalMid_Lock); | 125 | spin_lock(&GlobalMid_Lock); |
123 | if(server->tcpStatus == CifsExiting) { | 126 | if( kthread_should_stop() ) { |
124 | /* the demux thread will exit normally | 127 | /* the demux thread will exit normally |
125 | next time through the loop */ | 128 | next time through the loop */ |
126 | spin_unlock(&GlobalMid_Lock); | 129 | spin_unlock(&GlobalMid_Lock); |
@@ -182,7 +185,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
182 | spin_unlock(&GlobalMid_Lock); | 185 | spin_unlock(&GlobalMid_Lock); |
183 | up(&server->tcpSem); | 186 | up(&server->tcpSem); |
184 | 187 | ||
185 | while ((server->tcpStatus != CifsExiting) && (server->tcpStatus != CifsGood)) | 188 | while ( (!kthread_should_stop()) && (server->tcpStatus != CifsGood)) |
186 | { | 189 | { |
187 | try_to_freeze(); | 190 | try_to_freeze(); |
188 | if(server->protocolType == IPV6) { | 191 | if(server->protocolType == IPV6) { |
@@ -199,7 +202,7 @@ cifs_reconnect(struct TCP_Server_Info *server) | |||
199 | } else { | 202 | } else { |
200 | atomic_inc(&tcpSesReconnectCount); | 203 | atomic_inc(&tcpSesReconnectCount); |
201 | spin_lock(&GlobalMid_Lock); | 204 | spin_lock(&GlobalMid_Lock); |
202 | if(server->tcpStatus != CifsExiting) | 205 | if( !kthread_should_stop() ) |
203 | server->tcpStatus = CifsGood; | 206 | server->tcpStatus = CifsGood; |
204 | server->sequence_number = 0; | 207 | server->sequence_number = 0; |
205 | spin_unlock(&GlobalMid_Lock); | 208 | spin_unlock(&GlobalMid_Lock); |
@@ -345,7 +348,6 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
345 | int isMultiRsp; | 348 | int isMultiRsp; |
346 | int reconnect; | 349 | int reconnect; |
347 | 350 | ||
348 | daemonize("cifsd"); | ||
349 | allow_signal(SIGKILL); | 351 | allow_signal(SIGKILL); |
350 | current->flags |= PF_MEMALLOC; | 352 | current->flags |= PF_MEMALLOC; |
351 | server->tsk = current; /* save process info to wake at shutdown */ | 353 | server->tsk = current; /* save process info to wake at shutdown */ |
@@ -361,7 +363,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
361 | GFP_KERNEL); | 363 | GFP_KERNEL); |
362 | } | 364 | } |
363 | 365 | ||
364 | while (server->tcpStatus != CifsExiting) { | 366 | while (!kthread_should_stop()) { |
365 | if (try_to_freeze()) | 367 | if (try_to_freeze()) |
366 | continue; | 368 | continue; |
367 | if (bigbuf == NULL) { | 369 | if (bigbuf == NULL) { |
@@ -400,7 +402,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
400 | kernel_recvmsg(csocket, &smb_msg, | 402 | kernel_recvmsg(csocket, &smb_msg, |
401 | &iov, 1, 4, 0 /* BB see socket.h flags */); | 403 | &iov, 1, 4, 0 /* BB see socket.h flags */); |
402 | 404 | ||
403 | if (server->tcpStatus == CifsExiting) { | 405 | if ( kthread_should_stop() ) { |
404 | break; | 406 | break; |
405 | } else if (server->tcpStatus == CifsNeedReconnect) { | 407 | } else if (server->tcpStatus == CifsNeedReconnect) { |
406 | cFYI(1, ("Reconnect after server stopped responding")); | 408 | cFYI(1, ("Reconnect after server stopped responding")); |
@@ -524,7 +526,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) | |||
524 | total_read += length) { | 526 | total_read += length) { |
525 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, | 527 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, |
526 | pdu_length - total_read, 0); | 528 | pdu_length - total_read, 0); |
527 | if((server->tcpStatus == CifsExiting) || | 529 | if( kthread_should_stop() || |
528 | (length == -EINTR)) { | 530 | (length == -EINTR)) { |
529 | /* then will exit */ | 531 | /* then will exit */ |
530 | reconnect = 2; | 532 | reconnect = 2; |
@@ -757,7 +759,6 @@ multi_t2_fnd: | |||
757 | GFP_KERNEL); | 759 | GFP_KERNEL); |
758 | } | 760 | } |
759 | 761 | ||
760 | complete_and_exit(&cifsd_complete, 0); | ||
761 | return 0; | 762 | return 0; |
762 | } | 763 | } |
763 | 764 | ||
@@ -973,7 +974,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
973 | } | 974 | } |
974 | if ((temp_len = strnlen(value, 300)) < 300) { | 975 | if ((temp_len = strnlen(value, 300)) < 300) { |
975 | vol->UNC = kmalloc(temp_len+1,GFP_KERNEL); | 976 | vol->UNC = kmalloc(temp_len+1,GFP_KERNEL); |
976 | if(vol->UNC == NULL) | 977 | if (vol->UNC == NULL) |
977 | return 1; | 978 | return 1; |
978 | strcpy(vol->UNC,value); | 979 | strcpy(vol->UNC,value); |
979 | if (strncmp(vol->UNC, "//", 2) == 0) { | 980 | if (strncmp(vol->UNC, "//", 2) == 0) { |
@@ -1010,12 +1011,12 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
1010 | return 1; /* needs_arg; */ | 1011 | return 1; /* needs_arg; */ |
1011 | } | 1012 | } |
1012 | if ((temp_len = strnlen(value, 1024)) < 1024) { | 1013 | if ((temp_len = strnlen(value, 1024)) < 1024) { |
1013 | if(value[0] != '/') | 1014 | if (value[0] != '/') |
1014 | temp_len++; /* missing leading slash */ | 1015 | temp_len++; /* missing leading slash */ |
1015 | vol->prepath = kmalloc(temp_len+1,GFP_KERNEL); | 1016 | vol->prepath = kmalloc(temp_len+1,GFP_KERNEL); |
1016 | if(vol->prepath == NULL) | 1017 | if (vol->prepath == NULL) |
1017 | return 1; | 1018 | return 1; |
1018 | if(value[0] != '/') { | 1019 | if (value[0] != '/') { |
1019 | vol->prepath[0] = '/'; | 1020 | vol->prepath[0] = '/'; |
1020 | strcpy(vol->prepath+1,value); | 1021 | strcpy(vol->prepath+1,value); |
1021 | } else | 1022 | } else |
@@ -1031,7 +1032,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
1031 | return 1; /* needs_arg; */ | 1032 | return 1; /* needs_arg; */ |
1032 | } | 1033 | } |
1033 | if (strnlen(value, 65) < 65) { | 1034 | if (strnlen(value, 65) < 65) { |
1034 | if(strnicmp(value,"default",7)) | 1035 | if (strnicmp(value,"default",7)) |
1035 | vol->iocharset = value; | 1036 | vol->iocharset = value; |
1036 | /* if iocharset not set load_nls_default used by caller */ | 1037 | /* if iocharset not set load_nls_default used by caller */ |
1037 | cFYI(1, ("iocharset set to %s",value)); | 1038 | cFYI(1, ("iocharset set to %s",value)); |
@@ -1043,11 +1044,13 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
1043 | if (value && *value) { | 1044 | if (value && *value) { |
1044 | vol->linux_uid = | 1045 | vol->linux_uid = |
1045 | simple_strtoul(value, &value, 0); | 1046 | simple_strtoul(value, &value, 0); |
1047 | vol->override_uid = 1; | ||
1046 | } | 1048 | } |
1047 | } else if (strnicmp(data, "gid", 3) == 0) { | 1049 | } else if (strnicmp(data, "gid", 3) == 0) { |
1048 | if (value && *value) { | 1050 | if (value && *value) { |
1049 | vol->linux_gid = | 1051 | vol->linux_gid = |
1050 | simple_strtoul(value, &value, 0); | 1052 | simple_strtoul(value, &value, 0); |
1053 | vol->override_gid = 1; | ||
1051 | } | 1054 | } |
1052 | } else if (strnicmp(data, "file_mode", 4) == 0) { | 1055 | } else if (strnicmp(data, "file_mode", 4) == 0) { |
1053 | if (value && *value) { | 1056 | if (value && *value) { |
@@ -1102,7 +1105,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
1102 | } | 1105 | } |
1103 | /* The string has 16th byte zero still from | 1106 | /* The string has 16th byte zero still from |
1104 | set at top of the function */ | 1107 | set at top of the function */ |
1105 | if((i==15) && (value[i] != 0)) | 1108 | if ((i==15) && (value[i] != 0)) |
1106 | printk(KERN_WARNING "CIFS: netbiosname longer than 15 truncated.\n"); | 1109 | printk(KERN_WARNING "CIFS: netbiosname longer than 15 truncated.\n"); |
1107 | } | 1110 | } |
1108 | } else if (strnicmp(data, "servern", 7) == 0) { | 1111 | } else if (strnicmp(data, "servern", 7) == 0) { |
@@ -1126,7 +1129,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
1126 | } | 1129 | } |
1127 | /* The string has 16th byte zero still from | 1130 | /* The string has 16th byte zero still from |
1128 | set at top of the function */ | 1131 | set at top of the function */ |
1129 | if((i==15) && (value[i] != 0)) | 1132 | if ((i==15) && (value[i] != 0)) |
1130 | printk(KERN_WARNING "CIFS: server netbiosname longer than 15 truncated.\n"); | 1133 | printk(KERN_WARNING "CIFS: server netbiosname longer than 15 truncated.\n"); |
1131 | } | 1134 | } |
1132 | } else if (strnicmp(data, "credentials", 4) == 0) { | 1135 | } else if (strnicmp(data, "credentials", 4) == 0) { |
@@ -1233,13 +1236,13 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol) | |||
1233 | printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data); | 1236 | printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data); |
1234 | } | 1237 | } |
1235 | if (vol->UNC == NULL) { | 1238 | if (vol->UNC == NULL) { |
1236 | if(devname == NULL) { | 1239 | if (devname == NULL) { |
1237 | printk(KERN_WARNING "CIFS: Missing UNC name for mount target\n"); | 1240 | printk(KERN_WARNING "CIFS: Missing UNC name for mount target\n"); |
1238 | return 1; | 1241 | return 1; |
1239 | } | 1242 | } |
1240 | if ((temp_len = strnlen(devname, 300)) < 300) { | 1243 | if ((temp_len = strnlen(devname, 300)) < 300) { |
1241 | vol->UNC = kmalloc(temp_len+1,GFP_KERNEL); | 1244 | vol->UNC = kmalloc(temp_len+1,GFP_KERNEL); |
1242 | if(vol->UNC == NULL) | 1245 | if (vol->UNC == NULL) |
1243 | return 1; | 1246 | return 1; |
1244 | strcpy(vol->UNC,devname); | 1247 | strcpy(vol->UNC,devname); |
1245 | if (strncmp(vol->UNC, "//", 2) == 0) { | 1248 | if (strncmp(vol->UNC, "//", 2) == 0) { |
@@ -1663,7 +1666,13 @@ void reset_cifs_unix_caps(int xid, struct cifsTconInfo * tcon, | |||
1663 | CIFS_SB(sb)->mnt_cifs_flags |= | 1666 | CIFS_SB(sb)->mnt_cifs_flags |= |
1664 | CIFS_MOUNT_POSIX_PATHS; | 1667 | CIFS_MOUNT_POSIX_PATHS; |
1665 | } | 1668 | } |
1666 | 1669 | ||
1670 | /* We might be setting the path sep back to a different | ||
1671 | form if we are reconnecting and the server switched its | ||
1672 | posix path capability for this share */ | ||
1673 | if(sb && (CIFS_SB(sb)->prepathlen > 0)) | ||
1674 | CIFS_SB(sb)->prepath[0] = CIFS_DIR_SEP(CIFS_SB(sb)); | ||
1675 | |||
1667 | cFYI(1,("Negotiate caps 0x%x",(int)cap)); | 1676 | cFYI(1,("Negotiate caps 0x%x",(int)cap)); |
1668 | #ifdef CONFIG_CIFS_DEBUG2 | 1677 | #ifdef CONFIG_CIFS_DEBUG2 |
1669 | if(cap & CIFS_UNIX_FCNTL_CAP) | 1678 | if(cap & CIFS_UNIX_FCNTL_CAP) |
@@ -1712,12 +1721,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1712 | return -EINVAL; | 1721 | return -EINVAL; |
1713 | } | 1722 | } |
1714 | 1723 | ||
1715 | if (volume_info.username) { | 1724 | if (volume_info.nullauth) { |
1725 | cFYI(1,("null user")); | ||
1726 | volume_info.username = NULL; | ||
1727 | } else if (volume_info.username) { | ||
1716 | /* BB fixme parse for domain name here */ | 1728 | /* BB fixme parse for domain name here */ |
1717 | cFYI(1, ("Username: %s ", volume_info.username)); | 1729 | cFYI(1, ("Username: %s ", volume_info.username)); |
1718 | |||
1719 | } else if (volume_info.nullauth) { | ||
1720 | cFYI(1,("null user")); | ||
1721 | } else { | 1730 | } else { |
1722 | cifserror("No username specified"); | 1731 | cifserror("No username specified"); |
1723 | /* In userspace mount helper we can get user name from alternate | 1732 | /* In userspace mount helper we can get user name from alternate |
@@ -1791,11 +1800,12 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1791 | existingCifsSes = cifs_find_tcp_session(&sin_server.sin_addr, | 1800 | existingCifsSes = cifs_find_tcp_session(&sin_server.sin_addr, |
1792 | NULL /* no ipv6 addr */, | 1801 | NULL /* no ipv6 addr */, |
1793 | volume_info.username, &srvTcp); | 1802 | volume_info.username, &srvTcp); |
1794 | else if(address_type == AF_INET6) | 1803 | else if(address_type == AF_INET6) { |
1804 | cFYI(1,("looking for ipv6 address")); | ||
1795 | existingCifsSes = cifs_find_tcp_session(NULL /* no ipv4 addr */, | 1805 | existingCifsSes = cifs_find_tcp_session(NULL /* no ipv4 addr */, |
1796 | &sin_server6.sin6_addr, | 1806 | &sin_server6.sin6_addr, |
1797 | volume_info.username, &srvTcp); | 1807 | volume_info.username, &srvTcp); |
1798 | else { | 1808 | } else { |
1799 | kfree(volume_info.UNC); | 1809 | kfree(volume_info.UNC); |
1800 | kfree(volume_info.password); | 1810 | kfree(volume_info.password); |
1801 | kfree(volume_info.prepath); | 1811 | kfree(volume_info.prepath); |
@@ -1807,17 +1817,23 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1807 | if (srvTcp) { | 1817 | if (srvTcp) { |
1808 | cFYI(1, ("Existing tcp session with server found")); | 1818 | cFYI(1, ("Existing tcp session with server found")); |
1809 | } else { /* create socket */ | 1819 | } else { /* create socket */ |
1810 | if(volume_info.port) | 1820 | if (volume_info.port) |
1811 | sin_server.sin_port = htons(volume_info.port); | 1821 | sin_server.sin_port = htons(volume_info.port); |
1812 | else | 1822 | else |
1813 | sin_server.sin_port = 0; | 1823 | sin_server.sin_port = 0; |
1814 | rc = ipv4_connect(&sin_server,&csocket, | 1824 | if (address_type == AF_INET6) { |
1825 | cFYI(1,("attempting ipv6 connect")); | ||
1826 | /* BB should we allow ipv6 on port 139? */ | ||
1827 | /* other OS never observed in Wild doing 139 with v6 */ | ||
1828 | rc = ipv6_connect(&sin_server6,&csocket); | ||
1829 | } else | ||
1830 | rc = ipv4_connect(&sin_server,&csocket, | ||
1815 | volume_info.source_rfc1001_name, | 1831 | volume_info.source_rfc1001_name, |
1816 | volume_info.target_rfc1001_name); | 1832 | volume_info.target_rfc1001_name); |
1817 | if (rc < 0) { | 1833 | if (rc < 0) { |
1818 | cERROR(1, | 1834 | cERROR(1, |
1819 | ("Error connecting to IPv4 socket. Aborting operation")); | 1835 | ("Error connecting to IPv4 socket. Aborting operation")); |
1820 | if(csocket != NULL) | 1836 | if (csocket != NULL) |
1821 | sock_release(csocket); | 1837 | sock_release(csocket); |
1822 | kfree(volume_info.UNC); | 1838 | kfree(volume_info.UNC); |
1823 | kfree(volume_info.password); | 1839 | kfree(volume_info.password); |
@@ -1850,10 +1866,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1850 | so no need to spinlock this init of tcpStatus */ | 1866 | so no need to spinlock this init of tcpStatus */ |
1851 | srvTcp->tcpStatus = CifsNew; | 1867 | srvTcp->tcpStatus = CifsNew; |
1852 | init_MUTEX(&srvTcp->tcpSem); | 1868 | init_MUTEX(&srvTcp->tcpSem); |
1853 | rc = (int)kernel_thread((void *)(void *)cifs_demultiplex_thread, srvTcp, | 1869 | srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd"); |
1854 | CLONE_FS | CLONE_FILES | CLONE_VM); | 1870 | if ( IS_ERR(srvTcp->tsk) ) { |
1855 | if(rc < 0) { | 1871 | rc = PTR_ERR(srvTcp->tsk); |
1856 | rc = -ENOMEM; | 1872 | cERROR(1,("error %d create cifsd thread", rc)); |
1873 | srvTcp->tsk = NULL; | ||
1857 | sock_release(csocket); | 1874 | sock_release(csocket); |
1858 | kfree(volume_info.UNC); | 1875 | kfree(volume_info.UNC); |
1859 | kfree(volume_info.password); | 1876 | kfree(volume_info.password); |
@@ -1896,7 +1913,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1896 | int len = strlen(volume_info.domainname); | 1913 | int len = strlen(volume_info.domainname); |
1897 | pSesInfo->domainName = | 1914 | pSesInfo->domainName = |
1898 | kmalloc(len + 1, GFP_KERNEL); | 1915 | kmalloc(len + 1, GFP_KERNEL); |
1899 | if(pSesInfo->domainName) | 1916 | if (pSesInfo->domainName) |
1900 | strcpy(pSesInfo->domainName, | 1917 | strcpy(pSesInfo->domainName, |
1901 | volume_info.domainname); | 1918 | volume_info.domainname); |
1902 | } | 1919 | } |
@@ -1906,7 +1923,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1906 | /* BB FIXME need to pass vol->secFlgs BB */ | 1923 | /* BB FIXME need to pass vol->secFlgs BB */ |
1907 | rc = cifs_setup_session(xid,pSesInfo, cifs_sb->local_nls); | 1924 | rc = cifs_setup_session(xid,pSesInfo, cifs_sb->local_nls); |
1908 | up(&pSesInfo->sesSem); | 1925 | up(&pSesInfo->sesSem); |
1909 | if(!rc) | 1926 | if (!rc) |
1910 | atomic_inc(&srvTcp->socketUseCount); | 1927 | atomic_inc(&srvTcp->socketUseCount); |
1911 | } else | 1928 | } else |
1912 | kfree(volume_info.password); | 1929 | kfree(volume_info.password); |
@@ -1914,7 +1931,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1914 | 1931 | ||
1915 | /* search for existing tcon to this server share */ | 1932 | /* search for existing tcon to this server share */ |
1916 | if (!rc) { | 1933 | if (!rc) { |
1917 | if(volume_info.rsize > CIFSMaxBufSize) { | 1934 | if (volume_info.rsize > CIFSMaxBufSize) { |
1918 | cERROR(1,("rsize %d too large, using MaxBufSize", | 1935 | cERROR(1,("rsize %d too large, using MaxBufSize", |
1919 | volume_info.rsize)); | 1936 | volume_info.rsize)); |
1920 | cifs_sb->rsize = CIFSMaxBufSize; | 1937 | cifs_sb->rsize = CIFSMaxBufSize; |
@@ -1923,11 +1940,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1923 | else /* default */ | 1940 | else /* default */ |
1924 | cifs_sb->rsize = CIFSMaxBufSize; | 1941 | cifs_sb->rsize = CIFSMaxBufSize; |
1925 | 1942 | ||
1926 | if(volume_info.wsize > PAGEVEC_SIZE * PAGE_CACHE_SIZE) { | 1943 | if (volume_info.wsize > PAGEVEC_SIZE * PAGE_CACHE_SIZE) { |
1927 | cERROR(1,("wsize %d too large using 4096 instead", | 1944 | cERROR(1,("wsize %d too large using 4096 instead", |
1928 | volume_info.wsize)); | 1945 | volume_info.wsize)); |
1929 | cifs_sb->wsize = 4096; | 1946 | cifs_sb->wsize = 4096; |
1930 | } else if(volume_info.wsize) | 1947 | } else if (volume_info.wsize) |
1931 | cifs_sb->wsize = volume_info.wsize; | 1948 | cifs_sb->wsize = volume_info.wsize; |
1932 | else | 1949 | else |
1933 | cifs_sb->wsize = | 1950 | cifs_sb->wsize = |
@@ -1940,14 +1957,14 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1940 | conjunction with 52K kvec constraint on arch with 4K | 1957 | conjunction with 52K kvec constraint on arch with 4K |
1941 | page size */ | 1958 | page size */ |
1942 | 1959 | ||
1943 | if(cifs_sb->rsize < 2048) { | 1960 | if (cifs_sb->rsize < 2048) { |
1944 | cifs_sb->rsize = 2048; | 1961 | cifs_sb->rsize = 2048; |
1945 | /* Windows ME may prefer this */ | 1962 | /* Windows ME may prefer this */ |
1946 | cFYI(1,("readsize set to minimum 2048")); | 1963 | cFYI(1,("readsize set to minimum 2048")); |
1947 | } | 1964 | } |
1948 | /* calculate prepath */ | 1965 | /* calculate prepath */ |
1949 | cifs_sb->prepath = volume_info.prepath; | 1966 | cifs_sb->prepath = volume_info.prepath; |
1950 | if(cifs_sb->prepath) { | 1967 | if (cifs_sb->prepath) { |
1951 | cifs_sb->prepathlen = strlen(cifs_sb->prepath); | 1968 | cifs_sb->prepathlen = strlen(cifs_sb->prepath); |
1952 | cifs_sb->prepath[0] = CIFS_DIR_SEP(cifs_sb); | 1969 | cifs_sb->prepath[0] = CIFS_DIR_SEP(cifs_sb); |
1953 | volume_info.prepath = NULL; | 1970 | volume_info.prepath = NULL; |
@@ -1960,24 +1977,27 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
1960 | cFYI(1,("file mode: 0x%x dir mode: 0x%x", | 1977 | cFYI(1,("file mode: 0x%x dir mode: 0x%x", |
1961 | cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode)); | 1978 | cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode)); |
1962 | 1979 | ||
1963 | if(volume_info.noperm) | 1980 | if (volume_info.noperm) |
1964 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; | 1981 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; |
1965 | if(volume_info.setuids) | 1982 | if (volume_info.setuids) |
1966 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SET_UID; | 1983 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SET_UID; |
1967 | if(volume_info.server_ino) | 1984 | if (volume_info.server_ino) |
1968 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SERVER_INUM; | 1985 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_SERVER_INUM; |
1969 | if(volume_info.remap) | 1986 | if (volume_info.remap) |
1970 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MAP_SPECIAL_CHR; | 1987 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_MAP_SPECIAL_CHR; |
1971 | if(volume_info.no_xattr) | 1988 | if (volume_info.no_xattr) |
1972 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_XATTR; | 1989 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_XATTR; |
1973 | if(volume_info.sfu_emul) | 1990 | if (volume_info.sfu_emul) |
1974 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL; | 1991 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_UNX_EMUL; |
1975 | if(volume_info.nobrl) | 1992 | if (volume_info.nobrl) |
1976 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL; | 1993 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_BRL; |
1977 | if(volume_info.cifs_acl) | 1994 | if (volume_info.cifs_acl) |
1978 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; | 1995 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_CIFS_ACL; |
1979 | 1996 | if (volume_info.override_uid) | |
1980 | if(volume_info.direct_io) { | 1997 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_UID; |
1998 | if (volume_info.override_gid) | ||
1999 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_OVERR_GID; | ||
2000 | if (volume_info.direct_io) { | ||
1981 | cFYI(1,("mounting share using direct i/o")); | 2001 | cFYI(1,("mounting share using direct i/o")); |
1982 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; | 2002 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_DIRECT_IO; |
1983 | } | 2003 | } |
@@ -2030,7 +2050,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2030 | } | 2050 | } |
2031 | } | 2051 | } |
2032 | } | 2052 | } |
2033 | if(pSesInfo) { | 2053 | if (pSesInfo) { |
2034 | if (pSesInfo->capabilities & CAP_LARGE_FILES) { | 2054 | if (pSesInfo->capabilities & CAP_LARGE_FILES) { |
2035 | sb->s_maxbytes = (u64) 1 << 63; | 2055 | sb->s_maxbytes = (u64) 1 << 63; |
2036 | } else | 2056 | } else |
@@ -2044,13 +2064,13 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2044 | if (rc) { | 2064 | if (rc) { |
2045 | /* if session setup failed, use count is zero but | 2065 | /* if session setup failed, use count is zero but |
2046 | we still need to free cifsd thread */ | 2066 | we still need to free cifsd thread */ |
2047 | if(atomic_read(&srvTcp->socketUseCount) == 0) { | 2067 | if (atomic_read(&srvTcp->socketUseCount) == 0) { |
2048 | spin_lock(&GlobalMid_Lock); | 2068 | spin_lock(&GlobalMid_Lock); |
2049 | srvTcp->tcpStatus = CifsExiting; | 2069 | srvTcp->tcpStatus = CifsExiting; |
2050 | spin_unlock(&GlobalMid_Lock); | 2070 | spin_unlock(&GlobalMid_Lock); |
2051 | if(srvTcp->tsk) { | 2071 | if (srvTcp->tsk) { |
2052 | send_sig(SIGKILL,srvTcp->tsk,1); | 2072 | send_sig(SIGKILL,srvTcp->tsk,1); |
2053 | wait_for_completion(&cifsd_complete); | 2073 | kthread_stop(srvTcp->tsk); |
2054 | } | 2074 | } |
2055 | } | 2075 | } |
2056 | /* If find_unc succeeded then rc == 0 so we can not end */ | 2076 | /* If find_unc succeeded then rc == 0 so we can not end */ |
@@ -2063,10 +2083,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2063 | int temp_rc; | 2083 | int temp_rc; |
2064 | temp_rc = CIFSSMBLogoff(xid, pSesInfo); | 2084 | temp_rc = CIFSSMBLogoff(xid, pSesInfo); |
2065 | /* if the socketUseCount is now zero */ | 2085 | /* if the socketUseCount is now zero */ |
2066 | if((temp_rc == -ESHUTDOWN) && | 2086 | if ((temp_rc == -ESHUTDOWN) && |
2067 | (pSesInfo->server->tsk)) { | 2087 | (pSesInfo->server) && (pSesInfo->server->tsk)) { |
2068 | send_sig(SIGKILL,pSesInfo->server->tsk,1); | 2088 | send_sig(SIGKILL,pSesInfo->server->tsk,1); |
2069 | wait_for_completion(&cifsd_complete); | 2089 | kthread_stop(pSesInfo->server->tsk); |
2070 | } | 2090 | } |
2071 | } else | 2091 | } else |
2072 | cFYI(1, ("No session or bad tcon")); | 2092 | cFYI(1, ("No session or bad tcon")); |
@@ -2127,7 +2147,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2127 | __u16 count; | 2147 | __u16 count; |
2128 | 2148 | ||
2129 | cFYI(1, ("In sesssetup")); | 2149 | cFYI(1, ("In sesssetup")); |
2130 | if(ses == NULL) | 2150 | if (ses == NULL) |
2131 | return -EINVAL; | 2151 | return -EINVAL; |
2132 | user = ses->userName; | 2152 | user = ses->userName; |
2133 | domain = ses->domainName; | 2153 | domain = ses->domainName; |
@@ -2182,7 +2202,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2182 | *bcc_ptr = 0; | 2202 | *bcc_ptr = 0; |
2183 | bcc_ptr++; | 2203 | bcc_ptr++; |
2184 | } | 2204 | } |
2185 | if(user == NULL) | 2205 | if (user == NULL) |
2186 | bytes_returned = 0; /* skip null user */ | 2206 | bytes_returned = 0; /* skip null user */ |
2187 | else | 2207 | else |
2188 | bytes_returned = | 2208 | bytes_returned = |
@@ -2216,7 +2236,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, | |||
2216 | bcc_ptr += 2 * bytes_returned; | 2236 | bcc_ptr += 2 * bytes_returned; |
2217 | bcc_ptr += 2; | 2237 | bcc_ptr += 2; |
2218 | } else { | 2238 | } else { |
2219 | if(user != NULL) { | 2239 | if (user != NULL) { |
2220 | strncpy(bcc_ptr, user, 200); | 2240 | strncpy(bcc_ptr, user, 200); |
2221 | bcc_ptr += strnlen(user, 200); | 2241 | bcc_ptr += strnlen(user, 200); |
2222 | } | 2242 | } |
@@ -3316,7 +3336,7 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) | |||
3316 | cFYI(1,("Waking up socket by sending it signal")); | 3336 | cFYI(1,("Waking up socket by sending it signal")); |
3317 | if(cifsd_task) { | 3337 | if(cifsd_task) { |
3318 | send_sig(SIGKILL,cifsd_task,1); | 3338 | send_sig(SIGKILL,cifsd_task,1); |
3319 | wait_for_completion(&cifsd_complete); | 3339 | kthread_stop(cifsd_task); |
3320 | } | 3340 | } |
3321 | rc = 0; | 3341 | rc = 0; |
3322 | } /* else - we have an smb session | 3342 | } /* else - we have an smb session |