Commit 3e2ce4da authored by Linus Torvalds's avatar Linus Torvalds

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] CIFS should honour umask
  [CIFS] Missing flag on negprot needed for some servers to force packet signing
  [CIFS] whitespace cleanup part 2
  [CIFS] whitespace cleanup
  [CIFS] fix mempool destroy done in wrong order in cifs error path
  [CIFS] typo in previous patch
  [CIFS] Fix oops on failed cifs mount (in kthread_stop)
parents 3334500b 3ce53fc4
This diff is collapsed.
......@@ -6,16 +6,16 @@
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <linux/fs.h>
......@@ -32,7 +32,7 @@
*
*/
int
cifs_strfromUCS_le(char *to, const __le16 * from,
cifs_strfromUCS_le(char *to, const __le16 * from,
int len, const struct nls_table *codepage)
{
int i;
......@@ -66,7 +66,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len,
{
int charlen;
int i;
wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */
wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */
for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
......@@ -79,7 +79,7 @@ cifs_strtoUCS(__le16 * to, const char *from, int len,
/* A question mark */
to[i] = cpu_to_le16(0x003f);
charlen = 1;
} else
} else
to[i] = cpu_to_le16(wchar_to[i]);
}
......
......@@ -825,8 +825,8 @@ cifs_init_mids(void)
sizeof (struct oplock_q_entry), 0,
SLAB_HWCACHE_ALIGN, NULL, NULL);
if (cifs_oplock_cachep == NULL) {
kmem_cache_destroy(cifs_mid_cachep);
mempool_destroy(cifs_mid_poolp);
kmem_cache_destroy(cifs_mid_cachep);
return -ENOMEM;
}
......
......@@ -433,8 +433,8 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
cFYI(1,("secFlags 0x%x",secFlags));
pSMB->hdr.Mid = GetNextMid(server);
pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
if((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5)
pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
if ((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5)
pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
count = 0;
......
......@@ -2069,8 +2069,15 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
srvTcp->tcpStatus = CifsExiting;
spin_unlock(&GlobalMid_Lock);
if (srvTcp->tsk) {
struct task_struct *tsk;
/* If we could verify that kthread_stop would
always wake up processes blocked in
tcp in recv_mesg then we could remove the
send_sig call */
send_sig(SIGKILL,srvTcp->tsk,1);
kthread_stop(srvTcp->tsk);
tsk = srvTcp->tsk;
if(tsk)
kthread_stop(tsk);
}
}
/* If find_unc succeeded then rc == 0 so we can not end */
......@@ -2085,8 +2092,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
/* if the socketUseCount is now zero */
if ((temp_rc == -ESHUTDOWN) &&
(pSesInfo->server) && (pSesInfo->server->tsk)) {
struct task_struct *tsk;
send_sig(SIGKILL,pSesInfo->server->tsk,1);
kthread_stop(pSesInfo->server->tsk);
tsk = pSesInfo->server->tsk;
if (tsk)
kthread_stop(tsk);
}
} else
cFYI(1, ("No session or bad tcon"));
......@@ -3334,7 +3344,7 @@ cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb)
return 0;
} else if (rc == -ESHUTDOWN) {
cFYI(1,("Waking up socket by sending it signal"));
if(cifsd_task) {
if (cifsd_task) {
send_sig(SIGKILL,cifsd_task,1);
kthread_stop(cifsd_task);
}
......
This diff is collapsed.
......@@ -2,7 +2,7 @@
* fs/cifs/fcntl.c
*
* vfs operations that deal with the file control API
*
*
* Copyright (C) International Business Machines Corp., 2003,2004
* Author(s): Steve French (sfrench@us.ibm.com)
*
......@@ -35,35 +35,34 @@ static __u32 convert_to_cifs_notify_flags(unsigned long fcntl_notify_flags)
/* No way on Linux VFS to ask to monitor xattr
changes (and no stream support either */
if(fcntl_notify_flags & DN_ACCESS) {
if (fcntl_notify_flags & DN_ACCESS) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_ACCESS;
}
if(fcntl_notify_flags & DN_MODIFY) {
if (fcntl_notify_flags & DN_MODIFY) {
/* What does this mean on directories? */
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE |
FILE_NOTIFY_CHANGE_SIZE;
}
if(fcntl_notify_flags & DN_CREATE) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION |
if (fcntl_notify_flags & DN_CREATE) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_CREATION |
FILE_NOTIFY_CHANGE_LAST_WRITE;
}
if(fcntl_notify_flags & DN_DELETE) {
if (fcntl_notify_flags & DN_DELETE) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_LAST_WRITE;
}
if(fcntl_notify_flags & DN_RENAME) {
if (fcntl_notify_flags & DN_RENAME) {
/* BB review this - checking various server behaviors */
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME |
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_DIR_NAME |
FILE_NOTIFY_CHANGE_FILE_NAME;
}
if(fcntl_notify_flags & DN_ATTRIB) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY |
if (fcntl_notify_flags & DN_ATTRIB) {
cifs_ntfy_flags |= FILE_NOTIFY_CHANGE_SECURITY |
FILE_NOTIFY_CHANGE_ATTRIBUTES;
}
/* if(fcntl_notify_flags & DN_MULTISHOT) {
/* if (fcntl_notify_flags & DN_MULTISHOT) {
cifs_ntfy_flags |= ;
} */ /* BB fixme - not sure how to handle this with CIFS yet */
return cifs_ntfy_flags;
}
......@@ -78,8 +77,7 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
__u32 filter = FILE_NOTIFY_CHANGE_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES;
__u16 netfid;
if(experimEnabled == 0)
if (experimEnabled == 0)
return 0;
xid = GetXid();
......@@ -88,21 +86,21 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
full_path = build_path_from_dentry(file->f_path.dentry);
if(full_path == NULL) {
if (full_path == NULL) {
rc = -ENOMEM;
} else {
cFYI(1,("dir notify on file %s Arg 0x%lx",full_path,arg));
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
cFYI(1, ("dir notify on file %s Arg 0x%lx", full_path, arg));
rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
GENERIC_READ | SYNCHRONIZE, 0 /* create options */,
&netfid, &oplock,NULL, cifs_sb->local_nls,
&netfid, &oplock, NULL, cifs_sb->local_nls,
cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
/* BB fixme - add this handle to a notify handle list */
if(rc) {
cFYI(1,("Could not open directory for notify"));
if (rc) {
cFYI(1, ("Could not open directory for notify"));
} else {
filter = convert_to_cifs_notify_flags(arg);
if(filter != 0) {
rc = CIFSSMBNotify(xid, pTcon,
if (filter != 0) {
rc = CIFSSMBNotify(xid, pTcon,
0 /* no subdirs */, netfid,
filter, file, arg & DN_MULTISHOT,
cifs_sb->local_nls);
......@@ -113,10 +111,10 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
it would close automatically but may be a way
to do it easily when inode freed or when
notify info is cleared/changed */
cFYI(1,("notify rc %d",rc));
cFYI(1, ("notify rc %d", rc));
}
}
FreeXid(xid);
return rc;
}
......@@ -986,7 +986,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
* failed to get it from the server or was set bogus */
if ((direntry->d_inode) && (direntry->d_inode->i_nlink < 2))
direntry->d_inode->i_nlink = 2;
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) {
mode &= ~current->fs->umask;
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
CIFSSMBUnixSetPerms(xid, pTcon, full_path,
mode,
......@@ -1004,7 +1005,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
cifs_sb->mnt_cifs_flags &
CIFS_MOUNT_MAP_SPECIAL_CHR);
}
else {
} else {
/* BB to be implemented via Windows secrty descriptors
eg CIFSSMBWinSetPerms(xid, pTcon, full_path, mode,
-1, -1, local_nls); */
......
......@@ -30,7 +30,7 @@
#define CIFS_IOC_CHECKUMOUNT _IO(0xCF, 2)
int cifs_ioctl (struct inode * inode, struct file * filep,
int cifs_ioctl (struct inode * inode, struct file * filep,
unsigned int command, unsigned long arg)
{
int rc = -ENOTTY; /* strange error - but the precedent */
......@@ -47,13 +47,13 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
xid = GetXid();
cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg));
cFYI(1, ("ioctl file %p cmd %u arg %lu", filep, command, arg));
cifs_sb = CIFS_SB(inode->i_sb);
#ifdef CONFIG_CIFS_POSIX
tcon = cifs_sb->tcon;
if(tcon)
if (tcon)
caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
else {
rc = -EIO;
......@@ -62,24 +62,24 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
}
#endif /* CONFIG_CIFS_POSIX */
switch(command) {
switch (command) {
case CIFS_IOC_CHECKUMOUNT:
cFYI(1,("User unmount attempted"));
if(cifs_sb->mnt_uid == current->uid)
cFYI(1, ("User unmount attempted"));
if (cifs_sb->mnt_uid == current->uid)
rc = 0;
else {
rc = -EACCES;
cFYI(1,("uids do not match"));
cFYI(1, ("uids do not match"));
}
break;
#ifdef CONFIG_CIFS_POSIX
case FS_IOC_GETFLAGS:
if(CIFS_UNIX_EXTATTR_CAP & caps) {
if (CIFS_UNIX_EXTATTR_CAP & caps) {
if (pSMBFile == NULL)
break;
rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
&ExtAttrBits, &ExtAttrMask);
if(rc == 0)
if (rc == 0)
rc = put_user(ExtAttrBits &
FS_FL_USER_VISIBLE,
(int __user *)arg);
......@@ -87,8 +87,8 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
break;
case FS_IOC_SETFLAGS:
if(CIFS_UNIX_EXTATTR_CAP & caps) {
if(get_user(ExtAttrBits,(int __user *)arg)) {
if (CIFS_UNIX_EXTATTR_CAP & caps) {
if (get_user(ExtAttrBits, (int __user *)arg)) {
rc = -EFAULT;
break;
}
......@@ -96,16 +96,15 @@ int cifs_ioctl (struct inode * inode, struct file * filep,
break;
/* rc= CIFSGetExtAttr(xid,tcon,pSMBFile->netfid,
extAttrBits, &ExtAttrMask);*/
}
cFYI(1,("set flags not implemented yet"));
cFYI(1, ("set flags not implemented yet"));
break;
#endif /* CONFIG_CIFS_POSIX */
default:
cFYI(1,("unsupported ioctl"));
cFYI(1, ("unsupported ioctl"));
break;
}
FreeXid(xid);
return rc;
}
}
......@@ -18,7 +18,7 @@
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* NB: unlike smb/cifs packets, the RFC1002 structures are big endian */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment