Commit Graph

600 Commits

Author SHA1 Message Date
Al Viro
1d92cfd54a cifs endianness fixes
__le16 fields used as host-endian.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Steve French <smfrench@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-06-04 08:06:01 -07:00
Dave Jones
0a891adccc [CIFS] Fix reversed memset arguments
Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-22 14:20:21 +00:00
Igor Mammedov
e4058245ac Adds username in the upcall key for unattended mounts with keytab
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-22 14:09:37 +00:00
Steve French
0d817bc0d6 [CIFS] Remove redundant NULL check
Noticed by Coverity checker.

Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-22 02:02:03 +00:00
Steve French
397d71ddfd [CIFS] Remove debug statement
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-21 03:49:46 +00:00
Igor Mammedov
5651ced3ab Fix possible access to undefined memory region.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-21 03:49:00 +00:00
Steve French
b9a3260f25 [CIFS] Enable DFS support for Windows query path info
Final piece for handling DFS in query_path_info, constructing a
fake inode for the junction directory which the submount will cover.

This handles the non-Unix (Windows etc.) code path.

Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-20 21:52:32 +00:00
Steve French
0e4bbde94f [CIFS] Enable DFS support for Unix query path info
Final piece for handling DFS in unix_query_path_info, constructing a
fake inode for the junction directory which the submount will cover.

Acked-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-20 19:50:46 +00:00
Steve French
89562b777c [CIFS] add missing seq_printf to cifs_show_options for hard mount option
Also Kari Hurtta noticed a missing check in the same function which is now fixed.

CC: Kari Hurtta <hurtta+gmane@siilo.fmi.fi>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-19 22:26:42 +00:00
Steve French
2b280fab12 [CIFS] add more complete mount options to cifs_show_options
adds various options to cifs_show_options
(displayed when you cat /proc/mounts with a cifs mount).  I limited
the new ones to values that are associated with the mount with the
exception of "seal" (which is a per tree connection property, but I
thought was important enough to show through).

Eventually cifs's parse_mount_options also needs to
be rewritten to use the match_token API but that would be a big enough
change that I would prefer that changing parse_mount_options wait
until next release.

Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-17 03:12:45 +00:00
Steve French
a1fe78f16e [CIFS] Add missing defines for DFS
Also has minor cleanup of previous patch

CC: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-16 18:48:38 +00:00
Igor Mammedov
fec4585fd7 CIFSGetDFSRefer cleanup + dfs_referral_level_3 fixed to conform REFERRAL_V3 the MS-DFSC spec.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-16 18:41:43 +00:00
Igor Mammedov
de2db8d790 Fixed DFS code to work with new 'build_path_from_dentry', that returns full path if share in the dfs, now.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-16 15:23:28 +00:00
Steve French
95b1cb90b7 [CIFS] enable parsing for transport encryption mount parm
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-05-15 16:44:38 +00:00
Steve French
c2cf07d591 [CIFS] Finishup DFS code
Fixup GetDFSRefer to prepare for cleanup of SMB response processing
Fix build warning in link.c

Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-15 06:20:02 +00:00
Steve French
f9ddcca4cf [CIFS] BKL-removal: convert CIFS over to unlocked_ioctl
cifs_ioctl doesn't seem to need the BKL for anything, so convert it over
to use unlocked_ioctl.

Signed-off-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-15 05:51:55 +00:00
Steve French
c32916374b [CIFS] suppress duplicate warning
fs/cifs/dir.c: In function 'cifs_ci_compare':
fs/cifs/dir.c:582: warning: passing argument 1 of 'memcpy' discards
qualifiers from pointer target type

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-15 05:41:54 +00:00
Steve French
646dd53987 [CIFS] Fix paths when share is in DFS to include proper prefix
Some versions of Samba (3.2-pre e.g.) are stricter about checking to make sure that
paths in DFS name spaces are sent in the form \\server\share\dir\subdir ...
instead of \dir\subdir

Acked-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-15 01:50:56 +00:00
Jeff Layton
35fc37d517 add function to convert access flags to legacy open mode
SMBLegacyOpen always opens a file as r/w. This could be problematic
for files with ATTR_READONLY set. Have it interpret the access_mode
into a sane open mode.

Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-14 18:45:30 +00:00
Jeff Layton
e10f7b551d clarify return value of cifs_convert_flags()
cifs_convert_flags returns 0x20197 in the default case. It's not
immediately evident where that number comes from, so change it
to be an or'ed set of flags. The compiler will boil it down anyway.

(Thanks to Guenter Kukkukk for clarifying the flags).

Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-14 18:44:35 +00:00
Steve French
77c57ec896 [CIFS] don't explicitly do a FindClose on rewind when directory search has ended
Do the following series of operations on a CIFS share:

    opendir(dir)
    readdir(dir)
    unlink(file in dir)
    rewinddir(dir)
    readdir(dir)

If the readdir read all entries in the directory this will make CIFS throw an error like this:

     CIFS VFS: Send error in FindClose = -9

CIFS requests "Close at end of search" of the server by setting this bit when issuing FindFirst or FindNext.  Therefore when all search entries are returned, the server may return "end of search" and close the search implicitly when this bit is set by the client on the request.  We check for this when a readdir is explicitly closed - but when the client notices that a directory has changed after the last operation, we attempt to close the directory before reopening by reissuing a second FindFirst. But, the directory may already been implicitly closed (due to end of search) because the first readdir finished. So we only want to issue a FindClose call in this case when we don't expect it to already be closed.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-13 21:39:32 +00:00
Steve French
582d21e5e3 [CIFS] cleanup old checkpatch warnings
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-13 04:54:12 +00:00
Marcin Slusarz
ed5f037005 [CIFS] CIFSSMBPosixLock should return -EINVAL on error
all other codepaths in this function return negative values on errors

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-13 04:01:01 +00:00
Jeff Layton
6353450a2d fix memory leak in CIFSFindNext
When CIFSFindNext gets back an -EBADF from a call, it sets the return
code of the function to 0 and eventually exits. Doing this makes the
cleanup at the end of the function skip freeing the SMB buffer, so
we need to make sure we free the buffer explicitly when doing this.

If we don't you end up with errors like this when unplugging the cifs
kernel module:

slab error in kmem_cache_destroy(): cache `cifs_request': Can't free all objects
 [<c046bdbf>] kmem_cache_destroy+0x61/0xf3
 [<e0f03045>] cifs_destroy_request_bufs+0x14/0x28 [cifs]
 [<e0f2016e>] exit_cifs+0x1e/0x80 [cifs]
 [<c043aeae>] sys_delete_module+0x192/0x1b8
 [<c04451fd>] audit_syscall_entry+0x14b/0x17d
 [<c0405413>] syscall_call+0x7/0xb
 =======================

Signed-off-by: Jeff Layton <jlayton@redhat.com>
2008-05-13 03:06:13 +00:00
Jeff Layton
d0a9c078db [CIFS] CIFS currently allows for permissions to be changed on files, even
when unix extensions and cifsacl support are disabled. These
permissions changes are "ephemeral" however. They are lost whenever
a share is mounted and unmounted, or when memory pressure forces
the inode out of the cache.

Because of this, we'd like to introduce a behavior change to make
CIFS behave more like local DOS/Windows filesystems. When unix
extensions and cifsacl support aren't enabled, then don't silently
ignore changes to permission bits that can't be reflected on the
server.

Still, there may be people relying on the current behavior for
certain applications. This patch adds a new "dynperm" (and a
corresponding "nodynperm") mount option that will be intended
to make the client fall back to legacy behavior when setting
these modes.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-12 22:23:49 +00:00
Steve French
e691b9d1a0 [CIFS] don't allow demultiplex thread to exit until kthread_stop is called
cifs_demultiplex_thread can exit under several conditions:

1) if it's signaled
2) if there's a problem with session setup
3) if kthread_stop is called on it

The first two are problems. If kthread_stop is called on the thread,
there is no guarantee that it will still be up. We need to have the
thread stay up until kthread_stop is called on it.

One option would be to not even try to tear things down until after
kthread_stop is called. However, in the case where there is a problem
setting up the session, there's no real reason to try continuing the
loop.

This patch allows the thread to clean up and prepare for exit under all
three conditions, but it has the thread go to sleep until kthread_stop
is called. This allows us to simplify the shutdown code somewhat since
we can be reasonably sure that the thread won't exit after being
signaled but before kthread_stop is called.

It also removes the places where the thread itself set the tsk variable
since it appeared that it could have a potential race where the thread
might never be shut down.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-11 17:45:44 +00:00
Jeff Layton
67750fb9e0 [CIFS] when not using unix extensions, check for and set ATTR_READONLY on create and mkdir
When creating a directory on a CIFS share without POSIX extensions,
and the given mode has no write bits set, set the ATTR_READONLY bit.

When creating a file, set ATTR_READONLY if the create mode has no write
bits set and we're not using unix extensions.

There are some comments about this being problematic due to the VFS
splitting creates into 2 parts. I'm not sure what that's actually
talking about, but I'm assuming that it has something to do with how
mknod is implemented. In the simple case where we have no unix
extensions and we're just creating a regular file, there's no reason
we can't set ATTR_READONLY.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-11 17:45:43 +00:00
Jeff Layton
02eadeffda [CIFS] add local struct inode pointer to cifs_setattr
Clean up cifs_setattr a bit by adding a local inode pointer, and
changing all of the direntry->d_inode references to it. This also adds a
bit of micro-optimization. d_inode shouldn't change over the life of
this function, so we only need to dereference it once.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-11 17:45:43 +00:00
Cyrill Gorcunov
1b20d67218 [CIFS] cifs_find_tcp_session cleanup
This patch cleans up cifs_find_tcp_session so it become
less indented. Also the error of skipping IPv6 matched
addresses fixed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-11 17:45:43 +00:00
Steve French
af4b3c355c [CIFS] fix build warning
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-09 03:48:05 +00:00
Igor Mammedov
7c5e628f95 [CIFS] Fixed build warning in is_ip
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-08 20:48:42 +00:00
Steve French
cf432eb50f [CIFS] cleanup cifsd completion
Was a holdover from the old kernel_thread based cifsd
code. We needed to know that the thread had set the task variable
before proceeding. Now that kthread_run returns the new task, this
doesn't appear to be needed anymore.

As best I can tell, this sleep was intended to try to prevent
cifs_umount from freeing the cifsSesInfo struct before cifsd had
exited. Now that cifsd is using the kthread API, we know that
when kthread_stop returns that cifsd has exited, so I don't
think this is needed any longer.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Christop Hellwig <hch@infradead.org>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-06 22:27:16 +00:00
Steve French
dea570e08a [CIFS] Remove over-indented code in find_unc().
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-06 22:05:51 +00:00
Steve French
a815752ac0 Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-05-06 17:55:32 +00:00
Steve French
5ade9deaaa [CIFS] fix typo
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-02 20:56:23 +00:00
Steve French
9b1ec9ecea [CIFS] Remove duplicate call to mode_to_acl
The current logic in cifs_setattr calls mode_to_acl twice on mode
changes if cifsacl is enabled. Remove the duplicate call.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
CC: Shirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-29 20:15:43 +00:00
Alexey Dobriyan
36a5aeb878 proc: remove proc_root_fs
Use creation by full path instead: "fs/foo".

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-04-29 08:06:18 -07:00
Steve French
4b18f2a9c3 [CIFS] convert usage of implicit booleans to bool
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-29 00:06:05 +00:00
Igor Mammedov
bf62fd887c [CIFS] fixed compatibility issue with samba refferal request
treeName part is canonicalized to '/' path separator

Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-28 23:05:58 +00:00
Steve French
39da984711 [CIFS] Fix statfs formatting
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-28 04:04:34 +00:00
Steve French
1dbbb60774 Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6 2008-04-28 04:01:34 +00:00
Steve French
d09e860cf0 [CIFS] Adds to dns_resolver checking if the server name is an IP addr and skipping upcall in this case.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: sfrench@us.ibm.com
2008-04-26 00:22:23 +00:00
Steve French
0206e61b46 [CIFS] Fix spelling mistake
Noticed by Joe Perches

Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-25 18:19:40 +00:00
Al Viro
42faad9965 [PATCH] restore sane ->umount_begin() API
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-04-25 09:23:25 -04:00
Igor Mammedov
78d31a3a87 cifs: timeout dfs automounts +little fix.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2008-04-25 09:15:26 -04:00
Steve French
47df179317 [CIFS] Update cifs version number
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-25 02:01:44 +00:00
Steve French
a7f796a60b [CIFS] Fix typo in previous commit
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-24 16:39:07 +00:00
Steve French
ee4987ab5c [CIFS] Fix define for new proxy cap to match documentation
The transport encryption capability and new SetFSInfo level were missing, and the
new proxy capability (which Samba server is implementing) and proxy setfsinfo needed
to be moved down to not collide with Samba's transport encryption capability.

CC: Jeremy Allison <jra@samba.org>
CC: Sam Liddicott <sam@lidicott.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-24 16:31:12 +00:00
Steve French
076d8423a9 [CIFS] Fix UNC path prefix on QueryUnixPathInfo to have correct slash
When a share was in DFS and the server was Unix/Linux, we were sending paths of the form
    \\server\share/dir/file
rather than
    //server/share/dir/file

There was some discussion between me and jra over whether we should use
    /server/share/dir/file
as MS sometimes says - but the documentation for this claims it should be
doubleslash for this type of UNC-like path format and that works, so leaving
it as doubleslash but converting the \ to / in the the //server/share portion.

This gets Samba to now correctly return STATUS_PATH_NOT_COVERED when it is
supposed to (Windows already did since the direction of the slash was not an issue
for them).  Still need another minor change to fully enable DFS (need to finish
some chages to SMBGetDFSRefer

Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-04-18 23:26:26 +00:00
Steve French
2302aca850 [CIFS] Reserve new proxy cap for WAFS
New WAFS filer uses ioctls which are shown to be available
on a share by querying this info level

Acked-by: Sam Liddicott <sam@liddicott.com>
Signed-off-by: Stevef French <sfrench@us.ibm.com>
2008-04-18 16:40:32 +00:00