From patchwork Sun Aug 28 06:22:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaliy Gusev X-Patchwork-Id: 1105442 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7S6MnB5017767 for ; Sun, 28 Aug 2011 06:22:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751016Ab1H1GWs (ORCPT ); Sun, 28 Aug 2011 02:22:48 -0400 Received: from mail-bw0-f46.google.com ([209.85.214.46]:51079 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750949Ab1H1GWr (ORCPT ); Sun, 28 Aug 2011 02:22:47 -0400 Received: by bke11 with SMTP id 11so3440684bke.19 for ; Sat, 27 Aug 2011 23:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=yUKtTXAL+7fxbDSPFUCqduMv7MPl4lu5HuBmQPZdRYo=; b=DDh00Vw9KiQFBhUQEkEqCNhVMToEdu3cfqdC8LZkOnmSCchQqjnoEjciKz0rdCswIt xl1he8FUZFKrqULsImj35U0vcBFtwKtg0armlOF3aye8FukPYrEgsgK2U2+2RkXfdvYm pLrfuK/iZAY93+XmryrEPU+55AWjP9UgAxxxo= Received: by 10.204.7.151 with SMTP id d23mr1412043bkd.299.1314512566546; Sat, 27 Aug 2011 23:22:46 -0700 (PDT) Received: from vT510.Home ([46.158.188.40]) by mx.google.com with ESMTPS id h26sm870592bkt.19.2011.08.27.23.22.44 (version=SSLv3 cipher=OTHER); Sat, 27 Aug 2011 23:22:45 -0700 (PDT) From: Vitaliy Gusev To: Trond.Myklebust@netapp.com Cc: peng_tao@emc.com, linux-nfs@vger.kernel.org, Vitaliy Gusev Subject: [PATCH] nfs: fix inifinite loop at nfs4_layoutcommit_release Date: Sun, 28 Aug 2011 10:22:38 +0400 Message-Id: <1314512558-16912-1-git-send-email-gusev.vitaliy@nexenta.com> X-Mailer: git-send-email 1.7.4.1 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 (demeter2.kernel.org [140.211.167.43]); Sun, 28 Aug 2011 06:22:50 +0000 (UTC) pnfs_layout_segment can be already under handling LAYOUTCOMMIT, so adding list twice causes hang: BUG: soft lockup - CPU#0 stuck for 22s! [kworker/0:0:4] Call Trace: nfs4_layoutcommit_release+0x5a/0x9c [nfs] rpc_release_calldata+0x17/0x19 [sunrpc] rpc_free_task+0x5e/0x66 [sunrpc] __rpc_execute+0x29e/0x2ad [sunrpc] rpc_async_schedule+0x15/0x17 [sunrpc] process_one_work+0x213/0x3ba process_one_work+0x142/0x3ba __rpc_execute+0x2ad/0x2ad [sunrpc] worker_thread+0xfd/0x181 Signed-off-by: Vitaliy Gusev --- fs/nfs/pnfs.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index e550e88..1465f44 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -1376,7 +1376,8 @@ static void pnfs_list_write_lseg(struct inode *inode, struct list_head *listp) list_for_each_entry(lseg, &NFS_I(inode)->layout->plh_segs, pls_list) { if (lseg->pls_range.iomode == IOMODE_RW && - test_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags)) + test_bit(NFS_LSEG_LAYOUTCOMMIT, &lseg->pls_flags) && + list_empty(&lseg->pls_lc_list)) list_add(&lseg->pls_lc_list, listp); } }