From patchwork Sat Jun 27 11:04:55 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 29227 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (mail.samba.org [66.70.73.150]) by bilbo.ozlabs.org (Postfix) with ESMTP id 80FD1B7098 for ; Sat, 27 Jun 2009 21:05:31 +1000 (EST) Received: from dp.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id EA788163CAB for ; Sat, 27 Jun 2009 11:04: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.2 required=3.8 tests=AWL,BAYES_00, FORGED_RCVD_HELO,NO_MORE_FUNN,SPF_PASS autolearn=no version=3.1.7 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.120]) by lists.samba.org (Postfix) with ESMTP id 96AEC163BC2 for ; Sat, 27 Jun 2009 11:04:21 +0000 (GMT) Received: from mail.poochiereds.net ([71.70.153.3]) by cdptpa-omta04.mail.rr.com with ESMTP id <20090627110456405.CMLM4077@cdptpa-omta04.mail.rr.com>; Sat, 27 Jun 2009 11:04:56 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 3246358118; Sat, 27 Jun 2009 07:04:55 -0400 (EDT) From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Sat, 27 Jun 2009 07:04:55 -0400 Message-Id: <1246100695-10344-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.6.0.6 Cc: smfrench@gmail.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [linux-cifs-client] [PATCH] cifs: fix fh_mutex locking in cifs_reopen_file 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+incoming=patchwork.ozlabs.org@lists.samba.org Errors-To: linux-cifs-client-bounces+incoming=patchwork.ozlabs.org@lists.samba.org Fixes a regression caused by commit a6ce4932fbdbcd8f8e8c6df76812014351c32892 When this lock was converted to a mutex, the locks were turned into unlocks and vice-versa. Signed-off-by: Jeff Layton Cc: Stable Tree --- fs/cifs/file.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/cifs/file.c b/fs/cifs/file.c index ebdbe62..97ce4bf 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -493,9 +493,9 @@ static int cifs_reopen_file(struct file *file, bool can_flush) return -EBADF; xid = GetXid(); - mutex_unlock(&pCifsFile->fh_mutex); + mutex_lock(&pCifsFile->fh_mutex); if (!pCifsFile->invalidHandle) { - mutex_lock(&pCifsFile->fh_mutex); + mutex_unlock(&pCifsFile->fh_mutex); rc = 0; FreeXid(xid); return rc; @@ -527,7 +527,7 @@ static int cifs_reopen_file(struct file *file, bool can_flush) if (full_path == NULL) { rc = -ENOMEM; reopen_error_exit: - mutex_lock(&pCifsFile->fh_mutex); + mutex_unlock(&pCifsFile->fh_mutex); FreeXid(xid); return rc; } @@ -569,14 +569,14 @@ reopen_error_exit: cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); if (rc) { - mutex_lock(&pCifsFile->fh_mutex); + mutex_unlock(&pCifsFile->fh_mutex); cFYI(1, ("cifs_open returned 0x%x", rc)); cFYI(1, ("oplock: %d", oplock)); } else { reopen_success: pCifsFile->netfid = netfid; pCifsFile->invalidHandle = false; - mutex_lock(&pCifsFile->fh_mutex); + mutex_unlock(&pCifsFile->fh_mutex); pCifsInode = CIFS_I(inode); if (pCifsInode) { if (can_flush) {