aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs (follow)
AgeCommit message (Collapse)AuthorFilesLines
2008-07-14Merge commit 'v2.6.26' into bkl-removalJonathan Corbet26-653/+773
2008-07-12cifs: fix wksidarr declaration to be big-endian friendlyJeff Layton1-5/+5
The current definition of wksidarr works fine on little endian arches (since cpu_to_le32 is a no-op there), but on big-endian arches, it fails to compile with this error: error: braced-group within expression allowed only inside a function The problem is that this static declaration has cpu_to_le32 embedded within it, and that expands into a function macro. We need to use __constant_cpu_to_le32() instead. Signed-off-by: Jeff Layton <jlayton@redhat.com> Cc: Steven French <sfrench@us.ibm.com> Cc: <stable@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-12cifs: fix inode leak in cifs_get_inode_info_unixJeff Layton1-10/+10
Try this: mount a share with unix extensions create a file on it umount the share You'll get the following message in the ring buffer: VFS: Busy inodes after unmount of cifs. Self-destruct in 5 seconds. Have a nice day... ...the problem is that cifs_get_inode_info_unix is creating and hashing a new inode even when it's going to return error anyway. The first lookup when creating a file returns an error so we end up leaking this inode before we do the actual create. This appears to be a regression caused by commit 0e4bbde94fdc33f5b3d793166b21bf768ca3e098. The following patch seems to fix it for me, and fixes a minor formatting nit as well. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Steven French <sfrench@us.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-02Remove BKL from remote_llseek v2Andi Kleen1-1/+1
- Replace remote_llseek with generic_file_llseek_unlocked (to force compilation failures in all users) - Change all users to either use generic_file_llseek_unlocked directly or take the BKL around. I changed the file systems who don't use the BKL for anything (CIFS, GFS) to call it directly. NCPFS and SMBFS and NFS take the BKL, but explicitely in their own source now. I moved them all over in a single patch to avoid unbisectable sections. Open problem: 32bit kernels can corrupt fpos because its modification is not atomic, but they can do that anyways because there's other paths who modify it without BKL. Do we need a special lock for the pos/f_version = 0 checks? Trond says the NFS BKL is likely not needed, but keep it for now until his full audit. v2: Use generic_file_llseek_unlocked instead of remote_llseek_unlocked and factor duplicated code (suggested by hch) Cc: Trond.Myklebust@netapp.com Cc: swhiteho@redhat.com Cc: sfrench@samba.org Cc: vandrove@vc.cvut.cz Signed-off-by: Andi Kleen <ak@suse.de> Signed-off-by: Andi Kleen <ak@linux.intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
2008-06-11Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6Linus Torvalds11-130/+172
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6: [CIFS] cifs: fix oops on mount when CONFIG_CIFS_DFS_UPCALL is enabled [CIFS] Fix hang in mount when negprot causes server to kill tcp session disable most mode changes on non-unix/non-cifsacl mounts [CIFS] Correct incorrect obscure open flag [CIFS] warn if both dynperm and cifsacl mount options specified silently ignore ownership changes unless unix extensions are enabled or we're faking uid changes [CIFS] remove trailing whitespace when creating new inodes, use file_mode/dir_mode exclusively on mount without unix extensions on non-posix shares, clear write bits in mode when ATTR_READONLY is set [CIFS] remove unused variables
2008-06-10[CIFS] cifs: fix oops on mount when CONFIG_CIFS_DFS_UPCALL is enabledSteve French1-11/+10
simple "mount -t cifs //xxx /mnt" oopsed on strlen of options http://kerneloops.org/guilty.php?guilty=cifs_get_sb&version=2.6.25-release&start=16711 \ 68&end=1703935&class=oops Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com> Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-06-10[CIFS] Fix hang in mount when negprot causes server to kill tcp sessionSteve French2-0/+6
Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-06-05asn1: additional sanity checking during BER decodingChris Wright1-0/+14
- Don't trust a length which is greater than the working buffer. An invalid length could cause overflow when calculating buffer size for decoding oid. - An oid length of zero is invalid and allows for an off-by-one error when decoding oid because the first subid actually encodes first 2 subids. - A primitive encoding may not have an indefinite length. Thanks to Wei Wang from McAfee for report. Cc: Steven French <sfrench@us.ibm.com> Cc: stable@kernel.org Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-06-04cifs endianness fixesAl Viro1-3/+3
__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-05-25disable most mode changes on non-unix/non-cifsacl mountsJeff Layton1-12/+26
CIFS currently allows you to change the mode of an inode on a share that doesn't have unix extensions enabled, and isn't using cifsacl. The inode in this case *only* has its mode changed in memory on the client. This is problematic since it can change any time the inode is purged from the cache. This patch makes cifs_setattr silently ignore most mode changes when unix extensions and cifsacl support are not enabled, and when the share is not mounted with the "dynperm" option. The exceptions are: When a mode change would remove all write access to an inode we turn on the ATTR_READONLY bit on the server and remove all write bits from the inode's mode in memory. When a mode change would add a write bit to an inode that previously had them all turned off, it turns off the ATTR_READONLY bit on the server, and resets the mode back to what it would normally be (generally, the file_mode or dir_mode of the share). Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-23[CIFS] Correct incorrect obscure open flagSteve French1-5/+18
Also add defines for pipe subcommand codes Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-23[CIFS] warn if both dynperm and cifsacl mount options specifiedSteve French1-0/+4
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-23silently ignore ownership changes unless unix extensions are enabled or we're faking uid changesJeff Layton1-7/+20
CIFS currently allows you to change the ownership of a file, but unless unix extensions are enabled this change is not passed off to the server. Have CIFS silently ignore ownership changes that can't be persistently stored on the server unless the "setuids" option is explicitly specified. We could return an error here (-EOPNOTSUPP or something), but this is how most disk-based windows filesystems on behave on Linux (e.g. VFAT, NTFS, etc). With cifsacl support and proper Windows to Unix idmapping support, we may be able to do this more properly in the future. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-23[CIFS] remove trailing whitespaceSteve French1-1/+1
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-23when creating new inodes, use file_mode/dir_mode exclusively on mount without unix extensionsJeff Layton2-3/+8
When CIFS creates a new inode on a mount without unix extensions, it temporarily assigns the mode that was passed to it in the create/mkdir call. Eventually, when the inode is revalidated, it changes to have the file_mode or dir_mode for the mount. This is confusing to users who expect that the mode shouldn't change this way. It's also problematic since only the mode is treated this way, not the uid or gid. Suppose you have a CIFS mount that's mounted with: uid=0,gid=0,file_mode=0666,dir_mode=0777 ...if an unprivileged user comes along and does this on the mount: mkdir -m 0700 foo touch foo/bar ...there is a period of time where the touch will fail, since the dir will initially be owned by root and have mode 0700. If the user waits long enough, then "foo" will be revalidated and will get the correct dir_mode permissions. This patch changes cifs_mkdir and cifs_create to not overwrite the mode found by the initial cifs_get_inode_info call after the inode is created on the server. Legacy behavior can be reenabled with the new "dynperm" mount option. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-23on non-posix shares, clear write bits in mode when ATTR_READONLY is setJeff Layton2-72/+75
When mounting a share with posix extensions disabled, cifs_get_inode_info turns off all the write bits in the mode for regular files if ATTR_READONLY is set. Directories and other inode types, however, can also have ATTR_READONLY set, but the mode gives no indication of this. This patch makes this apply to other inode types besides regular files. It also cleans up how modes are set in cifs_get_inode_info for both the "normal" and "dynperm" cases. Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-23[CIFS] remove unused variablesSteve French5-20/+5
CC: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-22[CIFS] Fix reversed memset argumentsDave Jones1-2/+2
Signed-off-by: Dave Jones <davej@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-22Adds username in the upcall key for unattended mounts with keytabIgor Mammedov1-0/+3
Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-22[CIFS] Remove redundant NULL checkSteve French1-12/+6
Noticed by Coverity checker. Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-21[CIFS] Remove debug statementSteve French1-1/+1
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-21Fix possible access to undefined memory region.Igor Mammedov1-4/+5
Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-20[CIFS] Enable DFS support for Windows query path infoSteve French1-146/+178
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[CIFS] Enable DFS support for Unix query path infoSteve French4-50/+85
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-19[CIFS] add missing seq_printf to cifs_show_options for hard mount optionSteve French1-0/+3
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-17[CIFS] add more complete mount options to cifs_show_optionsSteve French1-1/+30
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-16[CIFS] Add missing defines for DFSSteve French2-8/+18
Also has minor cleanup of previous patch CC: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-16CIFSGetDFSRefer cleanup + dfs_referral_level_3 fixed to conform REFERRAL_V3 the MS-DFSC spec.Igor Mammedov2-82/+139
Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-16Fixed DFS code to work with new 'build_path_from_dentry', that returns full path if share in the dfs, now.Igor Mammedov1-48/+1
Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-15[CIFS] enable parsing for transport encryption mount parmSteve French3-8/+23
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[CIFS] Finishup DFS codeSteve French4-97/+80
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[CIFS] BKL-removal: convert CIFS over to unlocked_ioctlSteve French3-9/+8
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[CIFS] suppress duplicate warningSteve French1-1/+1
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[CIFS] Fix paths when share is in DFS to include proper prefixSteve French5-127/+37
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-14add function to convert access flags to legacy open modeJeff Layton2-9/+16
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-14clarify return value of cifs_convert_flags()Jeff Layton1-1/+5
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-13[CIFS] don't explicitly do a FindClose on rewind when directory search has endedSteve French1-2/+5
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[CIFS] cleanup old checkpatch warningsSteve French5-29/+45
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-13[CIFS] CIFSSMBPosixLock should return -EINVAL on errorMarcin Slusarz1-1/+1
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-13fix memory leak in CIFSFindNextJeff Layton2-1/+3
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-12[CIFS] CIFS currently allows for permissions to be changed on files, evenJeff Layton2-0/+8
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-11[CIFS] don't allow demultiplex thread to exit until kthread_stop is calledSteve French1-14/+14
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[CIFS] when not using unix extensions, check for and set ATTR_READONLY on create and mkdirJeff Layton4-17/+31
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[CIFS] add local struct inode pointer to cifs_setattrJeff Layton2-11/+11
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[CIFS] cifs_find_tcp_session cleanupCyrill Gorcunov1-25/+26
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-09[CIFS] fix build warningSteve French1-1/+1
Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-08[CIFS] Fixed build warning in is_ipIgor Mammedov3-32/+5
Signed-off-by: Igor Mammedov <niallain@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-06[CIFS] cleanup cifsd completionSteve French1-6/+0
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[CIFS] Remove over-indented code in find_unc().Steve French1-33/+31
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
2008-05-06Merge branch 'master' of /pub/scm/linux/kernel/git/torvalds/linux-2.6Steve French1-2/+2