aboutsummaryrefslogtreecommitdiff
path: root/fs/cifs/netmisc.c
AgeCommit message (Collapse)Author
2013-05-04[CIFS] cifs: Rename cERROR and cFYI to cifs_dbgJoe Perches
It's not obvious from reading the macro names that these macros are for debugging. Convert the names to a single more typical kernel style cifs_dbg macro. cERROR(1, ...) -> cifs_dbg(VFS, ...) cFYI(1, ...) -> cifs_dbg(FYI, ...) cFYI(DBG2, ...) -> cifs_dbg(NOISY, ...) Move the terminating format newline from the macro to the call site. Add CONFIG_CIFS_DEBUG function cifs_vfs_err to emit the "CIFS VFS: " prefix for VFS messages. Size is reduced ~ 1% when CONFIG_CIFS_DEBUG is set (default y) $ size fs/cifs/cifs.ko* text data bss dec hex filename 265245 2525 132 267902 4167e fs/cifs/cifs.ko.new 268359 2525 132 271016 422a8 fs/cifs/cifs.ko.old Other miscellaneous changes around these conversions: o Miscellaneous typo fixes o Add terminating \n's to almost all formats and remove them from the macros to be more kernel style like. A few formats previously had defective \n's o Remove unnecessary OOM messages as kmalloc() calls dump_stack o Coalesce formats to make grep easier, added missing spaces when coalescing formats o Use %s, __func__ instead of embedded function name o Removed unnecessary "cifs: " prefixes o Convert kzalloc with multiply to kcalloc o Remove unused cifswarn macro Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
2013-03-13cifs: map NT_STATUS_SHARING_VIOLATION to EBUSY instead of ETXTBSYSachin Prabhu
NT_SHARING_VIOLATION errors are mapped to ETXTBSY which is unexpected for operations such as unlink where we can hit these errors. The patch maps the error NT_SHARING_VIOLATION to EBUSY instead. The patch also replaces all instances of ETXTBSY in cifs_rename_pending_delete() with EBUSY. Signed-off-by: Sachin Prabhu <sprabhu@redhat.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2012-12-05cifs: get rid of smb_vol->UNCip and smb_vol->portJeff Layton
Passing this around as a string is contorted and painful. Instead, just convert these to a sockaddr as soon as possible, since that's how we're going to work with it later anyway. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <smfrench@gmail.com>
2012-09-26cifs: change DOS/NT/POSIX mapping of ERRnoresourceJeff Layton
ERRnoresource is an ERRSRV level (aka server-side) error and means "No resources currently available for request". Currently that maps to POSIX -ENOBUFS. No NT errors map to it currently. NT_STATUS_INSUFFICIENT_RESOURCES and NT_STATUS_INSUFF_SERVER_RESOURCES are also similar in meaning. Currently the client maps those to ERRnomem, which maps to -ENOMEM in POSIX. All of these mappings seem to be quite wrong to me and are confusing for users. All of the above errors indicate problems on the server, not the client. Reporting -ENOMEM or -ENOBUFS implies that the client is running out of resources. This patch changes those mappings. The NT_* errors are changed to map to the SRV level ERRnoresource. That error is in turn changed to return -EREMOTEIO which is the only POSIX error I could find that conveys that something went wrong on the server. While we're at it, change the SMB2 equivalent error to return the same. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Suresh Jayaraman <sjayaraman@suse.com> Signed-off-by: Steve French <smfrench@gmail.com>
2012-09-24CIFS: Move readdir code to ops structPavel Shilovsky
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
2012-03-31cifs: writing past end of struct in cifs_convert_address()Dan Carpenter
"s6->sin6_scope_id" is an int bits but strict_strtoul() writes a long so this can corrupt memory on 64 bit systems. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2012-03-23CIFS: Separate protocol-specific code from cifs_readv_receive codePavel Shilovsky
Signed-off-by: Pavel Shilovsky <piastry@etersoft.ru>
2011-05-23cifs: consolidate SendReceive response checksJeff Layton
Further consolidate the SendReceive code by moving the checks run over the packet into a separate function that all the SendReceive variants can call. We can also eliminate the check for a receive_len that's too big or too small. cifs_demultiplex_thread already checks that and disconnects the socket if that occurs, while setting the midStatus to MALFORMED. It'll never call this code if that's the case. Finally do a little cleanup. Use "goto out" on errors so that the flow of code in the normal case is more evident. Also switch the logErr variable in map_smb_to_linux_error to a bool. Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2011-05-19cifs: keep BCC in little-endian formatJeff Layton
This is the same patch as originally posted, just with some merge conflicts fixed up... Currently, the ByteCount is usually converted to host-endian on receive. This is confusing however, as we need to keep two sets of routines for accessing it, and keep track of when to use each routine. Munging received packets like this also limits when the signature can be calulated. Simplify the code by keeping the received ByteCount in little-endian format. This allows us to eliminate a set of routines for accessing it and we can now drop the *_le suffixes from the accessor functions since that's now implied. While we're at it, switch all of the places that read the ByteCount directly to use the get_bcc inline which should also clean up some unaligned accesses. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2011-02-17cifs: fix handling of scopeid in cifs_convert_addressJeff Layton
The code finds, the '%' sign in an ipv6 address and copies that to a buffer allocated on the stack. It then ignores that buffer, and passes 'pct' to simple_strtoul(), which doesn't work right because we're comparing 'endp' against a completely different string. Fix it by passing the correct pointer. While we're at it, this is a good candidate for conversion to strict_strtoul as well. Cc: stable@kernel.org Cc: David Howells <dhowells@redhat.com> Reported-by: Björn JACKE <bj@sernet.de> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2011-01-20cifs: use get/put_unaligned functions to access ByteCountJeff Layton
It's possible that when we access the ByteCount that the alignment will be off. Most CPUs deal with that transparently, but there's usually some performance impact. Some CPUs raise an exception on unaligned accesses. Fix this by accessing the byte count using the get_unaligned and put_unaligned inlined functions. While we're at it, fix the types of some of the variables that end up getting returns from these functions. Acked-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2011-01-14cifs: cFYI the entire error code in map_smb_to_linux_errorJeff Layton
We currently only print the DOS error part. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2010-09-08cifs: prevent possible memory corruption in cifs_demultiplex_threadJeff Layton
cifs_demultiplex_thread sets the addr.sockAddr.sin_port without any regard for the socket family. While it may be that the error in question here never occurs on an IPv6 socket, it's probably best to be safe and set the port properly if it ever does. Break the port setting code out of cifs_fill_sockaddr and into a new function, and call that from cifs_demultiplex_thread. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2010-08-05CIFS: Make cifs_convert_address() take a const src pointer and a lengthDavid Howells
Make cifs_convert_address() take a const src pointer and a length so that all the strlen() calls in their can be cut out and to make it unnecessary to modify the src string. Also return the data length from dns_resolve_server_name_to_ip() so that a strlen() can be cut out of cifs_compose_mount_options() too. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: David Howells <dhowells@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2010-08-02cifs: map NT_STATUS_ERROR_WRITE_PROTECTED to -EROFSJeff Layton
Seems like a more sensible mapping than -EIO. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2010-08-02cifs: set the port in sockaddr in a more clearly defined fashionJeff Layton
This patch should replace the patch I sent a couple of weeks ago to set the port in cifs_convert_address. Currently we set this in cifs_find_tcp_session, but that's more of a side effect than anything. Add a new function called cifs_fill_sockaddr. Have it call cifs_convert_address and then set the port. This also allows us to skip passing in the port as a separate parm to cifs_find_tcp_session. Also, change cifs_convert_address take a struct sockaddr * rather than void * to make it clearer how this function should be called. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2010-04-21[CIFS] Neaten cERROR and cFYI macros, reduce text spaceJoe Perches
Neaten cERROR and cFYI macros, reduce text space ~2.5K Convert '__FILE__ ": " fmt' to '"%s: " fmt', __FILE__' to save text space Surround macros with do {} while Add parentheses to macros Make statement expression macro from macro with assign Remove now unnecessary parentheses from cFYI and cERROR uses defconfig with CIFS support old $ size fs/cifs/built-in.o text data bss dec hex filename 156012 1760 148 157920 268e0 fs/cifs/built-in.o defconfig with CIFS support old $ size fs/cifs/built-in.o text data bss dec hex filename 153508 1760 148 155416 25f18 fs/cifs/built-in.o allyesconfig old: $ size fs/cifs/built-in.o text data bss dec hex filename 309138 3864 74824 387826 5eaf2 fs/cifs/built-in.o allyesconfig new $ size fs/cifs/built-in.o text data bss dec hex filename 305655 3864 74824 384343 5dd57 fs/cifs/built-in.o Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2009-06-25cifs: have cifs parse scope_id out of IPv6 addresses and use itJeff Layton
This patch has CIFS look for a '%' in an IPv6 address. If one is present then it will try to treat that value as a numeric interface index suitable for stuffing into the sin6_scope_id field. This should allow people to mount servers on IPv6 link-local addresses. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: David Holder <david@erion.co.uk> Signed-off-by: Steve French <sfrench@us.ibm.com>
2009-06-15[CIFS] Fix build breakSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2009-06-13cifs: add new routine for converting AF_INET and AF_INET6 addrsJeff Layton
...to consolidate some logic used in more than one place. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2009-05-28cifs: make cnvrtDosUnixTm take a little-endian args and an offsetJeff Layton
The callers primarily end up converting the args from le anyway. Also, most of the callers end up needing to add an offset to the result. The exception to these rules is cnvrtDosCifsTm, but there are no callers of that function, so we might as well remove it. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
2009-05-28cifs: have cifs_NTtimeToUnix take a little-endian argJeff Layton
...and just have the function call le64_to_cpu. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Steve French <sfrench@us.ibm.com>
2009-04-30[CIFS] Remove unneeded QuerySymlink call and fix mapping for unmapped statusSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-13[CIFS] cleanup old checkpatch warningsSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-08[CIFS] Fixed build warning in is_ipIgor Mammedov
Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-02-12[CIFS] clean up some hard to read ifdefsSteve French
Christoph had noticed too many ifdefs in the CIFS code making it hard to read. This patch removes about a quarter of them from the C files in cifs by improving a few key ifdefs in the .h files. Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-02-07[CIFS] reduce checkpatch warningsSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-11-05[CIFS] Fix walking out end of cifs daclSteve French
Acked-by: Shirish Pargaonkar <shirishp@us.ibm.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-11-01[CIFS] when mount helper missing fix slash wrong direction in shareSteve French
Kernel bugzilla bug #9228 If mount helper (mount.cifs) missing, mounts with form like //10.11.12.13/c$ would not work (only mounts with slash e.g. //10.11.12.13\\c$ would work) due to problem with slash supposed to be converted to backslash by the mount helper (which is not there). If we fail on converting an IPv4 address in in4_pton then try to canonicalize the first slash (ie between sharename and host ip address) if necessary. If we have to retry to check for IPv6 address the slash is already converted if necessary. Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-10-25[CIFS] acl support part 6Steve French
Acked-by: Shirish Pargaonkar <shirishp@us.ibm.com> CC: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-10-18[CIFS] log better errors on failed mountsSteve French
Also returns more accurate errors to mount for the cases of account expired and password expired Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-10-17[CIFS] Fix minor problems noticed by scanSteve French
Coverity scan pointed out some minor possible errors. Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-17[CIFS] More whitespace/formatting fixes (noticed by checkpatch)Steve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-15[CIFS] Fix build break - inet.h not included when experimental ifdef offSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-13[CIFS] whitespace/formatting fixesSteve French
This should be the last big batch of whitespace/formatting fixes. checkpatch warnings for the cifs directory are down about 90% and many of the remaining ones are harder to remove or make the code harder to read. Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-10[CIFS] whitespace cleanupSteve French
More than halfway there Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-08[CIFS] more whitespace fixesSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-07[CIFS] more whitespace cleanupSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-07-06[CIFS] ipv6 support no longer experimentalJeff
Signed-off-by: Steve French <sfrench@us.ibm.com>
2007-04-25[CIFS] Add IPv6 supportSteve French
IPv6 support was started a few years ago in the cifs client, but lacked a kernel helper function for parsing the ascii form of the ipv6 address. Now that that is added (and now IPv6 is the default that some OS use now) it was fairly easy to finish the cifs ipv6 support. This requires that CIFS_EXPERIMENTAL be enabled and (at least until the mount.cifs module is modified to use a new ipv6 friendly call instead of gethostbyname) and the ipv6 address be passed on the mount as "ip=" mount option. Thanks Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-10-12[CIFS] Fix old DOS time conversion to handle timezoneSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-10-11[CIFS] Do not need to adjust for Jan/Feb for leap daySteve French
calculation in 2100 (year divisible by 100) Signed-off-by: Yehuda Sadeh Weinraub <Yehuda.Sadeh@expand.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-10-11[CIFS] Fix leaps year calculation for years after 2100Steve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-10-06[CIFS] readdir (ffirst) enablement of accurate timestamps from legacy serversSteve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-09-28[CIFS] Legacy time handling for Win9x and OS/2 part 1Steve French
Signed-off-by: Steve French <sfrench@us.ibm.com>
2006-08-11[CIFS]Jeremy Allison
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-06-02[CIFS] Fix mapping of old SMB return code Invalid Net Name so it isSteve French
recognized on mount the old mapping of this was to ENODEV (instead of ENXIO) - but ENODEV is what mount returns when the cifs driver will not load so change this to map to ENXIO (which was what the equivalent condition returned for mapping errors from more modern servers) 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 French
2005-11-29[CIFS] Fix umount --force to wake up the pending response queue, not justSteve French
the request queue. Also periodically wakeup response_q so threads can check if stuck requests have timed out. Workaround Windows server illegal smb length on transact2 findfirst response. Signed-off-by: Steve French <sfrench@us.ibm.com>
2005-10-11[CIFS] CIFS Stats improvementsSteve French
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>