#include <linux/list.h>
#include <linux/seq_file.h>
#include <linux/vfs.h>
+#include <linux/mempool.h>
#include "cifsfs.h"
#include "cifspdu.h"
#define DECLARE_GLOBALS_HERE
#include "cifs_debug.h"
#include "cifs_fs_sb.h"
#include <linux/mm.h>
-#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of all SMB PDUs */
+#define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */
-#ifdef CIFS_QUOTA
+#ifdef CONFIG_CIFS_QUOTA
static struct quotactl_ops cifs_quotactl_ops;
#endif
-extern struct file_system_type cifs_fs_type;
-
int cifsFYI = 0;
int cifsERROR = 1;
int traceSMB = 0;
sb->s_op = &cifs_super_ops;
/* if(cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
sb->s_blocksize = cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
-#ifdef CIFS_QUOTA
+#ifdef CONFIG_CIFS_QUOTA
sb->s_qcop = &cifs_quotactl_ops;
#endif
sb->s_blocksize = CIFS_MAX_MSGSIZE;
static int cifs_permission(struct inode * inode, int mask, struct nameidata *nd)
{
- struct cifs_sb_info *cifs_sb;
+ struct cifs_sb_info *cifs_sb;
- cifs_sb = CIFS_SB(inode->i_sb);
+ cifs_sb = CIFS_SB(inode->i_sb);
- if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) {
- /* the server supports the Unix-like mode bits and does its
- own permission checks, and therefore we do not allow the file
- mode to be overriden on these mounts - so do not do perm
- check on client side */
+ if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_PERM) {
return 0;
} else /* file mode might have been restricted at mount time
on the client (above and beyond ACL on servers) for
}
static kmem_cache_t *cifs_inode_cachep;
-kmem_cache_t *cifs_req_cachep;
-kmem_cache_t *cifs_mid_cachep;
+static kmem_cache_t *cifs_req_cachep;
+static kmem_cache_t *cifs_mid_cachep;
kmem_cache_t *cifs_oplock_cachep;
+mempool_t *cifs_req_poolp;
+mempool_t *cifs_mid_poolp;
static struct inode *
cifs_alloc_inode(struct super_block *sb)
if (cifs_sb) {
if (cifs_sb->tcon) {
seq_printf(s, ",unc=%s", cifs_sb->tcon->treeName);
- if ((cifs_sb->tcon->ses) && (cifs_sb->tcon->ses->userName))
- seq_printf(s, ",username=%s",
+ if (cifs_sb->tcon->ses) {
+ if (cifs_sb->tcon->ses->userName)
+ seq_printf(s, ",username=%s",
cifs_sb->tcon->ses->userName);
- if(cifs_sb->tcon->ses->domainName)
- seq_printf(s, ",domain=%s",
- cifs_sb->tcon->ses->domainName);
+ if(cifs_sb->tcon->ses->domainName)
+ seq_printf(s, ",domain=%s",
+ cifs_sb->tcon->ses->domainName);
+ }
}
seq_printf(s, ",rsize=%d",cifs_sb->rsize);
seq_printf(s, ",wsize=%d",cifs_sb->wsize);
return 0;
}
-#ifdef CIFS_QUOTA
+#ifdef CONFIG_CIFS_QUOTA
int cifs_xquota_set(struct super_block * sb, int quota_type, qid_t qid,
struct fs_disk_quota * pdquota)
{
}
static ssize_t
-cifs_read_wrapper(struct file * file, char *read_data, size_t read_size,
+cifs_read_wrapper(struct file * file, char __user *read_data, size_t read_size,
loff_t * poffset)
{
if(file == NULL)
}
static ssize_t
-cifs_write_wrapper(struct file * file, const char *write_data,
+cifs_write_wrapper(struct file * file, const char __user *write_data,
size_t write_size, loff_t * poffset)
{
ssize_t written;
.getattr = cifs_getattr, /* do we need this anymore? */
.rename = cifs_rename,
.permission = cifs_permission,
-#ifdef CIFS_XATTR
+#ifdef CONFIG_CIFS_XATTR
.setxattr = cifs_setxattr,
.getxattr = cifs_getxattr,
.listxattr = cifs_listxattr,
};
struct inode_operations cifs_symlink_inode_ops = {
- .readlink = cifs_readlink,
+ .readlink = generic_readlink,
.follow_link = cifs_follow_link,
+ .put_link = cifs_put_link,
.permission = cifs_permission,
/* BB add the following two eventually */
/* revalidate: cifs_revalidate,
setattr: cifs_notify_change, *//* BB do we need notify change */
-#ifdef CIFS_XATTR
+#ifdef CONFIG_CIFS_XATTR
.setxattr = cifs_setxattr,
.getxattr = cifs_getxattr,
.listxattr = cifs_listxattr,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
.sendfile = generic_file_sendfile,
-#ifdef CIFS_FCNTL
- .fcntl = cifs_fcntl,
-#endif
+ .dir_notify = cifs_dir_notify,
};
struct file_operations cifs_dir_ops = {
.readdir = cifs_readdir,
.release = cifs_closedir,
.read = generic_read_dir,
-#ifdef CIFS_FCNTL
- .fcntl = cifs_fcntl,
-#endif
+ .dir_notify = cifs_dir_notify,
};
static void
{
cifs_inode_cachep = kmem_cache_create("cifs_inode_cache",
sizeof (struct cifsInodeInfo),
- 0, SLAB_HWCACHE_ALIGN|SLAB_RECLAIM_ACCOUNT,
+ 0, SLAB_RECLAIM_ACCOUNT,
cifs_init_once, NULL);
if (cifs_inode_cachep == NULL)
return -ENOMEM;
if (cifs_req_cachep == NULL)
return -ENOMEM;
+ cifs_req_poolp = mempool_create(CIFS_MIN_RCV_POOL,
+ mempool_alloc_slab,
+ mempool_free_slab,
+ cifs_req_cachep);
+
+ if(cifs_req_poolp == NULL) {
+ kmem_cache_destroy(cifs_req_cachep);
+ return -ENOMEM;
+ }
+
return 0;
}
static void
cifs_destroy_request_bufs(void)
{
+ mempool_destroy(cifs_req_poolp);
if (kmem_cache_destroy(cifs_req_cachep))
printk(KERN_WARNING
"cifs_destroy_request_cache: error not all structures were freed\n");
SLAB_HWCACHE_ALIGN, NULL, NULL);
if (cifs_mid_cachep == NULL)
return -ENOMEM;
+
+ cifs_mid_poolp = mempool_create(3 /* a reasonable min simultan opers */,
+ mempool_alloc_slab,
+ mempool_free_slab,
+ cifs_mid_cachep);
+ if(cifs_mid_poolp == NULL) {
+ kmem_cache_destroy(cifs_mid_cachep);
+ return -ENOMEM;
+ }
+
cifs_oplock_cachep = kmem_cache_create("cifs_oplock_structs",
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);
return -ENOMEM;
}
static void
cifs_destroy_mids(void)
{
+ mempool_destroy(cifs_mid_poolp);
if (kmem_cache_destroy(cifs_mid_cachep))
printk(KERN_WARNING
"cifs_destroy_mids: error not all structures were freed\n");
+
if (kmem_cache_destroy(cifs_oplock_cachep))
printk(KERN_WARNING
"error not all oplock structures were freed\n");
*/
atomic_set(&sesInfoAllocCount, 0);
atomic_set(&tconInfoAllocCount, 0);
+ atomic_set(&tcpSesAllocCount,0);
atomic_set(&tcpSesReconnectCount, 0);
atomic_set(&tconInfoReconnectCount, 0);
if (!rc) {
rc = register_filesystem(&cifs_fs_type);
if (!rc) {
- kernel_thread(cifs_oplock_thread, NULL,
+ rc = (int)kernel_thread(cifs_oplock_thread, NULL,
CLONE_FS | CLONE_FILES | CLONE_VM);
- return rc; /* Success */
- } else
- cifs_destroy_request_bufs();
+ if(rc > 0)
+ return 0;
+ else
+ cERROR(1,("error %d create oplock thread",rc));
+ }
+ cifs_destroy_request_bufs();
}
cifs_destroy_mids();
}