Received: by 10.192.165.156 with SMTP id m28csp1201587imm; Wed, 11 Apr 2018 14:28:05 -0700 (PDT) X-Google-Smtp-Source: AIpwx483ymPYTdorWFc+1oFEN2Qmj9s0wMHIQ69ZU5YZQrtpR8366xQRptmPw6XfaceBKSpkVJ/Y X-Received: by 2002:a17:902:8c8c:: with SMTP id t12-v6mr6796020plo.100.1523482085355; Wed, 11 Apr 2018 14:28:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523482085; cv=none; d=google.com; s=arc-20160816; b=n9ntKIvS20aF4QXjO9v9hNy9ELjmyieLebj+PQf0YxsZLB9X4i4IRnapOTRbLy6Vp3 rFnp3c+s13fqQb5NHZ1kkMAtuyZr0SAF/pOzo2EP+UTIw1Ztw8YpX6h24bs3HAv5Vu9S NSowHyq3j/bOuIXYZZzO+bKB4zdD2r3OUJF+4jUlk7eoIMG6FpcaJ2Yeg0n+EdPxMsWM mN8b0UOI1+mkw0FzVn+9iK1iNuYXJMY0URSi72F6DzFePdxapLLr9FdZLkxXP/Xo54cm IT0TDB3NKF3Sa9TUR3TiO0XV5ooqhBh01MYeiZdnDXE9VhBRYUba/bne610YjNgYQm2C CgfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=cEQMH8s9iu8AyehjPtcUxJcCQwPti+wwvEhfAtbW7wk=; b=AXlZH7IIwXfPwurfg/rhdBliujJZJ3IZEvctEfvA0bT8rVhm5L+UG8jI3NPb9IetEL kVTDvdGp6qCKQvnG4EMWX41LCLxL132Js9JngyrDqtXfH2VMfy1bxnETtHskrBFT2IA9 +a7wgeLOq3veshXBrKkZXTK4Vm+h8F5g4QMZ77Scf2ZMtDqBiLjwfCehwUSyyq9Exluy uOKHJb/eGOut57RhCZFpKne3nXwEfFLcqJviU/L3B9gz5geS/EWhKU/wEXJDkwvqczpA wePuwTJ2Oy/OIxD4Evfc2SRoxgE1pJkNgwsLk5ss5HPUqU/BsCxpzBjYD2uRi+QPlDHM b31Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y65si1210794pgb.588.2018.04.11.14.27.28; Wed, 11 Apr 2018 14:28:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754398AbeDKSj0 (ORCPT + 99 others); Wed, 11 Apr 2018 14:39:26 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56032 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754371AbeDKSjX (ORCPT ); Wed, 11 Apr 2018 14:39:23 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8A21F4A3; Wed, 11 Apr 2018 18:39:22 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rabin Vincent , Pavel Shilovsky , Steve French , Sasha Levin Subject: [PATCH 3.18 012/121] CIFS: silence lockdep splat in cifs_relock_file() Date: Wed, 11 Apr 2018 20:35:15 +0200 Message-Id: <20180411183456.956328731@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183456.195010921@linuxfoundation.org> References: <20180411183456.195010921@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Rabin Vincent [ Upstream commit 560d388950ceda5e7c7cdef7f3d9a8ff297bbf9d ] cifs_relock_file() can perform a down_write() on the inode's lock_sem even though it was already performed in cifs_strict_readv(). Lockdep complains about this. AFAICS, there is no problem here, and lockdep just needs to be told that this nesting is OK. ============================================= [ INFO: possible recursive locking detected ] 4.11.0+ #20 Not tainted --------------------------------------------- cat/701 is trying to acquire lock: (&cifsi->lock_sem){++++.+}, at: cifs_reopen_file+0x7a7/0xc00 but task is already holding lock: (&cifsi->lock_sem){++++.+}, at: cifs_strict_readv+0x177/0x310 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&cifsi->lock_sem); lock(&cifsi->lock_sem); *** DEADLOCK *** May be due to missing lock nesting notation 1 lock held by cat/701: #0: (&cifsi->lock_sem){++++.+}, at: cifs_strict_readv+0x177/0x310 stack backtrace: CPU: 0 PID: 701 Comm: cat Not tainted 4.11.0+ #20 Call Trace: dump_stack+0x85/0xc2 __lock_acquire+0x17dd/0x2260 ? trace_hardirqs_on_thunk+0x1a/0x1c ? preempt_schedule_irq+0x6b/0x80 lock_acquire+0xcc/0x260 ? lock_acquire+0xcc/0x260 ? cifs_reopen_file+0x7a7/0xc00 down_read+0x2d/0x70 ? cifs_reopen_file+0x7a7/0xc00 cifs_reopen_file+0x7a7/0xc00 ? printk+0x43/0x4b cifs_readpage_worker+0x327/0x8a0 cifs_readpage+0x8c/0x2a0 generic_file_read_iter+0x692/0xd00 cifs_strict_readv+0x29f/0x310 generic_file_splice_read+0x11c/0x1c0 do_splice_to+0xa5/0xc0 splice_direct_to_actor+0xfa/0x350 ? generic_pipe_buf_nosteal+0x10/0x10 do_splice_direct+0xb5/0xe0 do_sendfile+0x278/0x3a0 SyS_sendfile64+0xc4/0xe0 entry_SYSCALL_64_fastpath+0x1f/0xbe Signed-off-by: Rabin Vincent Acked-by: Pavel Shilovsky Signed-off-by: Steve French Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- fs/cifs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -583,7 +583,7 @@ cifs_relock_file(struct cifsFileInfo *cf struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); int rc = 0; - down_read(&cinode->lock_sem); + down_read_nested(&cinode->lock_sem, SINGLE_DEPTH_NESTING); if (cinode->can_cache_brlcks) { /* can cache locks - no need to relock */ up_read(&cinode->lock_sem);