From patchwork Mon Apr 11 04:02:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 697371 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p3B42k8P004307 for ; Mon, 11 Apr 2011 04:02:46 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750724Ab1DKECo (ORCPT ); Mon, 11 Apr 2011 00:02:44 -0400 Received: from ipmail07.adl2.internode.on.net ([150.101.137.131]:55250 "EHLO ipmail07.adl2.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750696Ab1DKECn (ORCPT ); Mon, 11 Apr 2011 00:02:43 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlYEAOp8ok15LHHJgWdsb2JhbACmGBUBARYmJcB1DoVgBJpj Received: from ppp121-44-113-201.lns20.syd6.internode.on.net (HELO dastard) ([121.44.113.201]) by ipmail07.adl2.internode.on.net with ESMTP; 11 Apr 2011 13:32:13 +0930 Received: from dave by dastard with local (Exim 4.72) (envelope-from ) id 1Q98KH-0005i2-Qf; Mon, 11 Apr 2011 14:02:09 +1000 Date: Mon, 11 Apr 2011 14:02:09 +1000 From: Dave Chinner To: Will Simoneau Cc: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org Subject: Re: lockdep splat: nfsroot on 2.6.39-rc2 Message-ID: <20110411040209.GA21395@dastard> References: <20110410025502.GA15112@ele.uri.edu> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110410025502.GA15112@ele.uri.edu> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 11 Apr 2011 04:02:46 +0000 (UTC) On Sat, Apr 09, 2011 at 10:55:02PM -0400, Will Simoneau wrote: > Hi, > > I just got this soft-lockup 3 times in a row and was able to reproduce > it with lockdep enabled. The kernel is Linus git 94c8a984 plus patches > to support my hardware. System is a full custom 2-way SMP mipsel/R4K > clone on an FPGA, I am hoping this is not my fault or the hardware's > fault though. Root is on NFS (tcp). > > This seems to happen consistently when running "apt-get update". Ideas? > Known bug? The bug is in nfs_commit_inode(), where it calls nfs_scan_commit() with the inode->i_lock held and that calls __mark_inode_dirty() which takes the inode->i_lock.... The patch below should fix this problem. Cheers, Dave. Tested-by: Will Simoneau diff --git a/fs/nfs/write.c b/fs/nfs/write.c index af0c627..e4cbc11 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -542,11 +542,15 @@ nfs_scan_commit(struct inode *inode, struct list_head *dst, pgoff_t idx_start, u if (!nfs_need_commit(nfsi)) return 0; + spin_lock(&inode->i_lock); ret = nfs_scan_list(nfsi, dst, idx_start, npages, NFS_PAGE_TAG_COMMIT); if (ret > 0) nfsi->ncommit -= ret; + spin_unlock(&inode->i_lock); + if (nfs_need_commit(NFS_I(inode))) __mark_inode_dirty(inode, I_DIRTY_DATASYNC); + return ret; } #else @@ -1483,9 +1487,7 @@ int nfs_commit_inode(struct inode *inode, int how) res = nfs_commit_set_lock(NFS_I(inode), may_wait); if (res <= 0) goto out_mark_dirty; - spin_lock(&inode->i_lock); res = nfs_scan_commit(inode, &head, 0, 0); - spin_unlock(&inode->i_lock); if (res) { int error;