diff options
author | Steve French <stevef@smfhome1.smfdom> | 2004-07-28 14:16:47 -0500 |
---|---|---|
committer | Steve French <cifs.adm@hostme.bitkeeper.com> | 2004-07-28 14:16:47 -0500 |
commit | 4c3bd7e4ab6f0e5572a43f61f73cff0115d6fc41 (patch) | |
tree | 29542f7f81e355098a3da47a846411cafdbcea36 /fs | |
parent | 75ffe424cee3f0ae5334a2a93f500115ff4dae67 (diff) | |
download | history-4c3bd7e4ab6f0e5572a43f61f73cff0115d6fc41.tar.gz |
[CIFS] Resize cifs request buffer mempools as tcp sessions are added to avoid potential deadlocks.
Signed-off-by: Steve French (sfrench@us.ibm.com)
Diffstat (limited to 'fs')
-rw-r--r-- | fs/cifs/cifsfs.c | 3 | ||||
-rw-r--r-- | fs/cifs/cifsglob.h | 4 | ||||
-rw-r--r-- | fs/cifs/connect.c | 22 |
3 files changed, 26 insertions, 3 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index ad20e058abb196..2607ce38a697a0 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -41,8 +41,6 @@ #include "cifs_fs_sb.h" #include <linux/mm.h> #define CIFS_MAGIC_NUMBER 0xFF534D42 /* the first four bytes of SMB PDUs */ -/* BB when mempool_resize is added back in, we will resize pool on new mount */ -#define CIFS_MIN_RCV_POOL 11 /* enough for progress to five servers */ #ifdef CONFIG_CIFS_QUOTA static struct quotactl_ops cifs_quotactl_ops; @@ -742,6 +740,7 @@ init_cifs(void) */ atomic_set(&sesInfoAllocCount, 0); atomic_set(&tconInfoAllocCount, 0); + atomic_set(&tcpSesAllocCount,0); atomic_set(&tcpSesReconnectCount, 0); atomic_set(&tconInfoReconnectCount, 0); diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index cfbfac7a74b6dc..21ac75cf02d7a7 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -32,6 +32,8 @@ termination then *2 for unicode versions */ #define MAX_PASSWORD_SIZE 16 +#define CIFS_MIN_RCV_POOL 4 + /* * MAX_REQ is the maximum number of requests that WE will send * on one socket concurently. It also matches the most common @@ -391,7 +393,7 @@ GLOBAL_EXTERN char Local_System_Name[15]; */ GLOBAL_EXTERN atomic_t sesInfoAllocCount; GLOBAL_EXTERN atomic_t tconInfoAllocCount; - +GLOBAL_EXTERN atomic_t tcpSesAllocCount; GLOBAL_EXTERN atomic_t tcpSesReconnectCount; GLOBAL_EXTERN atomic_t tconInfoReconnectCount; diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index e93f69075c08e2..bb6b0f3b2fb205 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -28,6 +28,7 @@ #include <linux/pagemap.h> #include <linux/ctype.h> #include <linux/utsname.h> +#include <linux/mempool.h> #include <asm/uaccess.h> #include <asm/processor.h> #include "cifspdu.h" @@ -49,6 +50,8 @@ extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, unsigned char *p24); extern int cifs_inet_pton(int, const char *, void *dst); +extern mempool_t *cifs_req_poolp; + struct smb_vol { char *username; char *password; @@ -204,6 +207,15 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) current->flags |= PF_MEMALLOC; server->tsk = current; /* save process info to wake at shutdown */ cFYI(1, ("Demultiplex PID: %d", current->pid)); + write_lock(&GlobalSMBSeslock); + atomic_inc(&tcpSesAllocCount); + length = tcpSesAllocCount.counter; + write_unlock(&GlobalSMBSeslock); + if(length > 1) { + mempool_resize(cifs_req_poolp, + length + CIFS_MIN_RCV_POOL, + GFP_KERNEL); + } while (server->tcpStatus != CifsExiting) { if (smb_buffer == NULL) @@ -467,6 +479,16 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) } kfree(server); + write_lock(&GlobalSMBSeslock); + atomic_dec(&tcpSesAllocCount); + length = tcpSesAllocCount.counter; + write_unlock(&GlobalSMBSeslock); + if(length > 0) { + mempool_resize(cifs_req_poolp, + length + CIFS_MIN_RCV_POOL, + GFP_KERNEL); + } + set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(HZ/4); return 0; |