aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsglob.h (follow)
AgeCommit message (Collapse)AuthorFilesLines
2008-11-20[CIFS] Do not attempt to close invalidated file handlesSteve French1-1/+9
If a connection with open file handles has gone down and come back up and reconnected without reopening the file handle yet, do not attempt to send an SMB close request for this handle in cifs_close. We were checking for the connection being invalid in cifs_close but since the connection may have been reconnected we also need to check whether the file handle was marked invalid (otherwise we could close the wrong file handle by accident). Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-11-17cifs: reinstate sharing of tree connectionsJeff Layton1-5/+8
Use a similar approach to the SMB session sharing. Add a list of tcons attached to each SMB session. Move the refcount to non-atomic. Protect all of the above with the cifs_tcp_ses_lock. Add functions to properly find and put references to the tcons. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-11-14cifs: reinstate sharing of SMB sessions sans racesJeff Layton1-4/+2
We do this by abandoning the global list of SMB sessions and instead moving to a per-server list. This entails adding a new list head to the TCP_Server_Info struct. The refcounting for the cifsSesInfo is moved to a non-atomic variable. We have to protect it by a lock anyway, so there's no benefit to making it an atomic. The list and refcount are protected by the global cifs_tcp_ses_lock. The patch also adds a new routines to find and put SMB sessions and that properly take and put references under the lock. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-11-14cifs: disable sharing session and tcon and add new TCP sharing codeJeff Layton1-6/+11
The code that allows these structs to be shared is extremely racy. Disable the sharing of SMB and tcon structs for now until we can come up with a way to do this that's race free. We want to continue to share TCP sessions, however since they are required for multiuser mounts. For that, implement a new (hopefully race-free) scheme. Add a new global list of TCP sessions, and take care to get a reference to it whenever we're dealing with one. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-11-14[CIFS] clean up server protocol handlingSteve French1-2/+1
We're currently declaring both a sockaddr_in and sockaddr6_in on the stack, but we really only need storage for one of them. Declare a sockaddr struct and cast it to the proper type. Also, eliminate the protocolType field in the TCP_Server_Info struct. It's redundant since we have a sa_family field in the sockaddr anyway. We may need to revisit this if SCTP is ever implemented, but for now this will simplify the code. CIFS over IPv6 also has a number of problems currently. This fixes all of them that I found. Eventually, it would be nice to move more of the code to be protocol independent, but this is a start. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-11-13[CIFS] remove unused list, add new cifs sock list to prepare for mount/umount fixSteve French1-15/+8
Also adds two lines missing from the previous patch (for the need reconnect flag in the /proc/fs/cifs/DebugData handling) The new global_cifs_sock_list is added, and initialized in init_cifs but not used yet. Jeff Layton will be adding code in to use that and to remove the GlobalTcon and GlobalSMBSession lists. CC: Jeff Layton <jlayton@redhat.com> CC: Shirish Pargaonkar <shirishp@us.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-11-13[CIFS] Fix cifs reconnection flagsSteve French1-0/+5
In preparation for Jeff's big umount/mount fixes to remove the possibility of various races in cifs mount and linked list handling of sessions, sockets and tree connections, this patch cleans up some repetitive code in cifs_mount, and addresses a problem with ses->status and tcon->tidStatus in which we were overloading the "need_reconnect" state with other status in that field. So the "need_reconnect" flag has been broken out from those two state fields (need reconnect was not mutually exclusive from some of the other possible tid and ses states). In addition, a few exit cases in cifs_mount were cleaned up, and a problem with a tcon flag (for lease support) was not being set consistently for the 2nd mount of the same share CC: Jeff Layton <jlayton@redhat.com> CC: Shirish Pargaonkar <shirishp@us.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-10-29[CIFS] Reduce number of socket retries in large write pathSteve French1-0/+2
CIFS in some heavy stress conditions cifs could get EAGAIN repeatedly in smb_send2 which led to repeated retries and eventually failure of large writes which could lead to data corruption. There are three changes that were suggested by various network developers: 1) convert cifs from non-blocking to blocking tcp sendmsg (we left in the retry on failure) 2) change cifs to not set sendbuf and rcvbuf size for the socket (let tcp autotune the buffer sizes since that works much better in the TCP stack now) 3) if we have a partial frame sent in smb_send2, mark the tcp session as invalid (close the socket and reconnect) so we do not corrupt the remaining part of the SMB with the beginning of the next SMB. This does not appear to hurt performance measurably and has been run in various scenarios, but it definately removes a corruption that we were seeing in some high stress test cases. Acked-by: Shirish Pargaonkar <shirishp@us.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-10-23[CIFS] improve setlease handlingSteve French1-0/+1
fcntl(F_SETLEASE) currently is not exported by cifs (nor by local file systems) so cifs grants leases based on how other local processes have opened the file not by whether the file is cacheable (oplocked). This adds the check to make sure that the file is cacheable on the client before checking whether we can grant the lease locally (generic_setlease). It also adds a mount option for cifs (locallease) if the user wants to override this and try to grant leases even if the server did not grant oplock. Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-10-20cifs: track DeletePending flag in cifsInodeInfoJeff Layton1-0/+1
cifs: track DeletePending flag in cifsInodeInfo The QPathInfo call returns a flag that indicates whether DELETE_ON_CLOSE is set. Track it in the cifsInodeInfo. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-10-07[CIFS] make sure we have the right resume info before calling CIFSFindNextSteve French1-0/+1
When we do a seekdir() or equivalent, we usually end up doing a FindFirst call and then call FindNext until we get to the offset that we want. The problem is that when we call FindNext, the code usually doesn't have the proper info (mostly, the filename of the entry from the last search) to resume the search. Add a "last_entry" field to the cifs_search_info that points to the last entry in the search. We calculate this pointer by using the LastNameOffset field from the search parms that are returned. We then use that info to do a cifs_save_resume_key before we call CIFSFindNext. This patch allows CIFS to reliably pass the "telldir" connectathon test. Signed-off-by: Jeff Layton <jlayton@redhat.com> CC: Stable <stable@kernel.org> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-08-19[CIFS] distinguish between Kerberos and MSKerberos in upcallSteve French1-1/+2
Properly handle MSKRB5 by passing sec=mskrb5 to the upcall so that the spengo blob can be generated appropriately. Also, make decode_negTokenInit prefer whichever mechanism is first in the list. Needed for some NetApp servers, and possibly some older versions of Windows which treat the two KRB5 mechanisms differently. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-07-24[CIFS] Fix warnings from checkpatchShirish Pargaonkar1-3/+3
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-23[CIFS] remove unused variablesSteve French1-2/+1
CC: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-15[CIFS] enable parsing for transport encryption mount parmSteve French1-0/+1
Samba now supports transport encryption on particular exports (mounted tree ids can be encrypted for servers which support the unix extensions). This adds parsing support to cifs mount option parsing for this. Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-29[CIFS] convert usage of implicit booleans to boolSteve French1-26/+18
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-02-15[CIFS] Fix mixed case name in structure dfs_info3_paramIgor Mammedov1-1/+1
Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-01-25[CIFS] DFS build fixesSteve French1-9/+32
Also includes a few minor changes suggested by Christoph Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-11-16[CIFS] Have CIFS_SessSetup build correct SPNEGO SessionSetup requestSteve French1-0/+1
Have CIFS_SessSetup call cifs_get_spnego_key when Kerberos is negotiated. Use the info in the key payload to build a session setup request packet. Also clean up how the request buffer in the function is freed on error. With appropriate user space helper (in samba/source/client). Kerberos support (secure session establishment can be done now via Kerberos, previously users would have to use NTLMv2 instead for more secure session setup). Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-11-16[CIFS] add hostname field to TCP_Server_Info structJeff Layton1-0/+1
...and populate it with the hostname portion of the UNC string. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-11-13[CIFS] Fix buffer overflow if server sends corrupt response to smallSteve French1-0/+11
request In SendReceive() function in transport.c - it memcpy's message payload into a buffer passed via out_buf param. The function assumes that all buffers are of size (CIFSMaxBufSize + MAX_CIFS_HDR_SIZE) , unfortunately it is also called with smaller (MAX_CIFS_SMALL_BUFFER_SIZE) buffers. There are eight callers (SMB worker functions) which are primarily affected by this change: TreeDisconnect, uLogoff, Close, findClose, SetFileSize, SetFileTimes, Lock and PosixLock CC: Dave Kleikamp <shaggy@austin.ibm.com> CC: Przemyslaw Wegrzyn <czajnik@czajsoft.pl> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-10-16[CIFS] missing #endif from a previous patchSteve French1-0/+2
Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-10-16[CIFS] Break up unicode_sessetup string functionsJeff Layton1-1/+7
SPNEGO setup needs only some of these strings. Break up unicode_ssetup_strings so we can call them individually. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-10-12[CIFS] fix build break when lanman not enabledSteve French1-0/+3
Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-10-04[CIFS] Fix cifsd so shuts down when signing fails during mountSteve French1-1/+3
Fixes two problems: 1) we dropped down to negotiating lanman if we did not recognize the mechanism (krb5 e.g.) 2) we did not stop cifsd (thus will fail when doing rmod cifs with slab free errors) when we fail tcon but have a bad session (which is the case in which signing is required but we don't allow signing on the client) It also turns on extended security flag in the header when passing "sec=krb5" on mount command (although kerberos support is not done of course) Acked-by: Jeff Layton <jlayton@redhat.com> CC: Shaggy <shaggy@us.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-09-29[CIFS] named pipe support (part 2)Steve French1-1/+1
Also fixes typo which could cause build break Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-09-28[CIFS] CIFS support for named pipes (part 1)Steve French1-0/+2
This allows cifs to mount to ipc shares (IPC$) which will allow user space applications to layer over authenticated cifs connections (useful for Wine and others that would want to put DCE/RPC over CIFS or run CIFS named pipes) Acked-by: Rob Shearman <rob@codeweavers.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-09-24[CIFS] Support for CIFS ACLs (part 1)Steve French1-0/+12
Add code to be able to dump CIFS ACL information when Query Posix ACL with cifsacl mount parm enabled. Signed-off-by: Shirish Pargoankar <shirishp@us.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-18[CIFS] Allow disabling CIFS Unix Extensions as mount optionSteve French1-1/+3
Previously the only way to do this was to umount all mounts to that server, turn off a proc setting (/proc/fs/cifs/LinuxExtensionsEnabled). Fixes Samba bugzilla bug number: 4582 (and also 2008) Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-09[CIFS] Fix packet signatures for NTLMv2 caseSteve French1-1/+13
Signed-off-by: Yehuda Sadeh Weinraub <Yehuda.Sadeh@expand.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-06-28[CIFS] whitespace fixesSteve French1-30/+30
This changeset brought to you ... by patchcheck.pl Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-05-03[CIFS] Change semaphore to mutex for cifs lock_semRoland Dreier1-1/+1
Originally at http://lkml.org/lkml/2006/9/2/86 The recent change to "allow Windows blocking locks to be cancelled via a CANCEL_LOCK call" introduced a new semaphore in struct cifsFileInfo, lock_sem. However, semaphores used as mutexes are deprecated these days, and there's no reason to add a new one to the kernel. Therefore, convert lock_sem to a struct mutex (and also fix one indentation glitch on one of the lines changed anyway). Signed-off-by: Roland Dreier <roland@digitalvampire.org> Signed-off-by: Jan Engelhardt <jengelh@gmx.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-02-27[CIFS] Remove some unused functions/declarationsSteve French1-3/+5
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-09-30[CIFS] Make use of newer QFSInfo dependent on capability bit instead ofSteve French1-1/+1
whether we negotiated legacy lanman dialect so we do not keep retrying for mount to WindowsME Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-09-30[CIFS] Do not send newer QFSInfo to legacy servers which can not support itSteve French1-2/+7
Fix dialect negotiation to save off when we have negotiated lanman. This allows us to avoid sending some somewhat newer requests that the server can not handle and go directly to the older version (infolevel) of the same call. Make sure we try to negotiate a level which allows us to get the server OS (which we check so we can detect Win9x vs. other legacy servers and eventually work around the Win9x DOS time bug (they reverse date/time fields). Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-09-30[CIFS] Rename server time zone fieldSteve French1-1/+1
Server time zone is not really a time zone, rather a time adjustement in seconds. CC: Guenter Kukkukk <linux@kukkukk.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-09-28[CIFS] Remove static and unused symbolsSteve French1-2/+2
Most cases of the ones found by Shaggy by "make namespacecheck" could be removed or made static Ack: Dave Kleikamp <shaggy@austin.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-08-11[CIFS]Jeremy Allison1-6/+9
Allow Windows blocking locks to be cancelled via a CANCEL_LOCK call. TODO - restrict this to servers that support NT_STATUS codes (Win9x will probably not support this call). Signed-off-by: Jeremy Allison <jra@samba.org> Signed-off-by: Steve French <sfrench@us.ibm.com> (cherry picked from 570d4d2d895569825d0d017d4e76b51138f68864 commit)
2006-08-11[CIFS] Do not time out posix brl requests when using new posix setfileinfoSteve French1-1/+2
request and do not time out slow requests to a server that is still responding well to other threads Suggested by jra of Samba team Signed-off-by: Steve French <sfrench@us.ibm.com> (cherry picked from 89b57148115479eef074b8d3f86c4c86c96ac969 commit)
2006-06-27[CIFS] Fix allocation of buffers for new session setup routine to allowSteve French1-0/+1
longer user and domain names and allow passing sec options on mount Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-06-04CIFS] Support for older servers which require plaintext passwords - part 2Steve French1-9/+8
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-06-01[CIFS] Support for setting up SMB sessions to legacy lanman servers part 2Steve French1-1/+1
2006-05-31[CIFS] Support for setting up SMB sessions to legacy lanman serversSteve French1-14/+37
2006-02-14[CIFS] SessionSetup cleanup part 2Steve French1-1/+10
The cifs session setup code has three cases, and a fourth for backlevel LANMAN2 style session setup needed to be added. This new session setup implmentation will eventually replace the other three and should be easier to read while fixing a few minor problems (not setting the LARGE READ/WRITEX flags when NTLMSSP was negotiated for example) and adding support for NTLMv2 (which will be added with the next patch. In the meantime, this code is marked in an CONFIG_CIFS_EXPERIMENTAL block and will not be turned on by default until it is tested against more server types. Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-01-12[CIFS] Add worker function for Get ACL cifs styleSteve French1-0/+2
Signed-off-by: Steve French <sfrench@us.ibm.com>
2005-12-12[CIFS] Avoid extra large buffer allocation (and memcpy) in cifs_readpagesSteve French1-1/+7
Signed-off-by: Steve French <sfrench@us.ibm.com>
2005-12-03[CIFS] Add extended stats (STATS2) for total buffer allocations forSteve French1-2/+6
better performance debugging. Signed-off-by: Steve French <sfrench@us.ibm.com>
2005-10-20[CIFS] Defer close of file handle slightly if there are pending writes thatSteve French1-0/+1
need to get in ahead of it that depend on that file handle. Fixes occassional bad file handle errors on write with heavy use multiple process cases. Signed-off-by: Steve French <sfrench@us.ibm.com>
2005-10-11[CIFS] CIFS Stats improvementsSteve French1-1/+5
New cifs_writepages routine was not updated bytes written in cifs stats. Also added ability to clear /proc/fs/cifs/Stats by writing (0 or 1) to it. Signed-off-by: Steve French <sfrench@us.ibm.com>
2005-10-07[CIFS] /proc/fs/cifs debug code cleanup and new stats2Steve French1-1/+5
These changes to debug code and new stats are helpful in debugging potential tcp performance/configuration problems under cifs. Signed-off-by: Steve French <sfrench@us.ibm.com>