From patchwork Mon Mar 16 18:36:31 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 12456 Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n2GIb9h9022431 for ; Mon, 16 Mar 2009 18:37:09 GMT Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 24F94163C94 for ; Mon, 16 Mar 2009 18:36:54 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on dp.samba.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.8 tests=AWL, BAYES_00 autolearn=ham version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mail.etersoft.ru (mail.etersoft.ru [87.249.47.46]) by lists.samba.org (Postfix) with ESMTP id E0CD8163B61 for ; Mon, 16 Mar 2009 18:36:19 +0000 (GMT) Received: from localhost (as.office.etersoft.ru [192.168.0.10]) by mail.etersoft.ru (Postfix) with ESMTP id 19BBD2FAED3; Mon, 16 Mar 2009 21:36:34 +0300 (MSK) X-Virus-Scanned: amavisd-new at office.etersoft.ru Received: from mail.etersoft.ru ([192.168.0.1]) by localhost (as.office.etersoft.ru [192.168.0.10]) (amavisd-new, port 10024) with LMTP id 0E0FbHAnx3PT; Mon, 16 Mar 2009 21:36:33 +0300 (MSK) From: Pavel Shilovsky To: "Steve French (smfltc)" Subject: Re: [linux-cifs-client] [PATCH] Cannot allocate memory Date: Mon, 16 Mar 2009 21:36:31 +0300 User-Agent: KMail/1.10.3 (Linux/2.6.26-1-686; KDE/4.1.3; i686; ; ) References: <49B687D8.2060600@etersoft.ru> <49BA4C46.4080601@etersoft.ru> <20090314160749.5fa5d8e8@tupile.poochiereds.net> In-Reply-To: <20090314160749.5fa5d8e8@tupile.poochiereds.net> MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200903162136.31933.piastry@etersoft.ru> Cc: linux-cifs-client@lists.samba.org X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Errors-To: linux-cifs-client-bounces+patchwork-cifs-client=patchwork.kernel.org@lists.samba.org Signed-off-by: Pavel Shilovsky Acked-by: Jeff Layton diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 9fbf4df..a5989aa 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -182,6 +182,7 @@ struct TCP_Server_Info {         struct mac_key mac_signing_key;         char ntlmv2_hash[16];         unsigned long lstrp; /* when we got last response from this server */ +       struct completion done;  };  /* diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index cd4ccc8..480c48e 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -337,6 +337,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)         bool isMultiRsp;         int reconnect; +       init_completion(&server->done);         current->flags |= PF_MEMALLOC;         cFYI(1, ("Demultiplex PID: %d", task_pid_nr(current))); @@ -747,7 +748,6 @@ multi_t2_fnd:         kfree(server->hostname);         task_to_wake = xchg(&server->tsk, NULL); -       kfree(server);         length = atomic_dec_return(&tcpSesAllocCount);         if (length  > 0) @@ -764,6 +764,8 @@ multi_t2_fnd:                 set_current_state(TASK_RUNNING);         } +       complete_all(&server->done); +         module_put_and_exit(0);  } @@ -1418,6 +1420,10 @@ cifs_put_tcp_session(struct TCP_Server_Info *server)         task = xchg(&server->tsk, NULL);         if (task)                 force_sig(SIGKILL, task); + +       wait_for_completion_interruptible(&server->done); + +       kfree(server);  }  static struct TCP_Server_Info *