From patchwork Tue Apr 6 18:41:29 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 90846 Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o36IffuX013576 for ; Tue, 6 Apr 2010 18:42:17 GMT Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id B39D3AD093; Tue, 6 Apr 2010 12:41:42 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.8 tests=BAYES_00 autolearn=ham version=3.2.5 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 35B02ACFCE for ; Tue, 6 Apr 2010 12:41:36 -0600 (MDT) From: Pavel Shilovsky To: Jeff Layton Date: Tue, 6 Apr 2010 22:41:29 +0400 User-Agent: KMail/1.13.1 (Linux/2.6.32.9-70.fc12.x86_64; KDE/4.4.1; x86_64; ; ) References: <201004060114.36019.piastry@etersoft.ru> <201004060117.39791.piastry@etersoft.ru> <20100406081458.7c564420@tlielax.poochiereds.net> In-Reply-To: <20100406081458.7c564420@tlielax.poochiereds.net> MIME-Version: 1.0 Message-Id: <201004062241.30237.piastry@etersoft.ru> Cc: Steve French , linux-cifs-client@lists.samba.org Subject: Re: [linux-cifs-client] [PATCH] Fix losing locks during fork X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 06 Apr 2010 18:42:18 +0000 (UTC) From: Pavel Shilovsky When process does fork() private_data of files with lock list stays the same for file descriptors of the parent and of the child. While finishing the child closes files and deletes locks from the list even if unlocking fails. When the child process finishes the parent doesn't have lock in lock list and can't unlock previously before fork() locked region after the child process finished. This patch provides behaviour to save locks in lock list if unlocking fails. Signed-off-by: Pavel Shilovsky Reviewed-by: Jeff Layton --- fs/cifs/file.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index c34b7f8..7185cd3 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -898,9 +898,10 @@ int cifs_lock(struct file *file, int cmd, struct file_lock *pfLock) 1, 0, li->type, false); if (stored_rc) rc = stored_rc; - - list_del(&li->llist); - kfree(li); + else { + list_del(&li->llist); + kfree(li); + } } } mutex_unlock(&fid->lock_mutex); -- 1.6.6.1