From patchwork Fri Aug 8 15:00:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Weston Andros Adamson X-Patchwork-Id: 4696681 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B629FC0338 for ; Fri, 8 Aug 2014 15:01:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADC302015E for ; Fri, 8 Aug 2014 15:01:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A74C5201B4 for ; Fri, 8 Aug 2014 15:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752821AbaHHPBO (ORCPT ); Fri, 8 Aug 2014 11:01:14 -0400 Received: from mail-ie0-f180.google.com ([209.85.223.180]:37856 "EHLO mail-ie0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbaHHPBN (ORCPT ); Fri, 8 Aug 2014 11:01:13 -0400 Received: by mail-ie0-f180.google.com with SMTP id at20so6538402iec.39 for ; Fri, 08 Aug 2014 08:01:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=N8RW9udCJnxSgT/h6SrG4X4ffraW8xK+tlJ5rqtlMM8=; b=DvkKMCnFYuhOc3vZWUU+591zwnyhC831xIoxvWUPlk93WlysmIjguc3tMcb8wHwjmF O+XAQy8Di0jP0mmics/I1JNDlT4nlpQEg9UhOtUBoqgmcq0CDN9aA45waJtz3poV8e0K 1dj00Xxm8bLke6KxfcghqiD13rqoAmHaLgrzi4ydR1UblLpz0W5Gs//V/NwflP/xrve5 vobZKY/q2uehDl+IW1sGoJUjHpm8L2iSphMsvGrowjeB5nWq9wwdoYJs5jrE8Dq2mVF4 EBFM3uH0+RU3HWjFkdUxvvb69fQkv13OiJAmlerVkmatsVdfDg63ieFVAerh5Y4Kd+WB xE4A== X-Gm-Message-State: ALoCoQmTCNnzXJ0V6X0T3lRaA1nOdU9SDrFMpbA97ZogXjBuq6FyW7nCWcZWDEn1AgWhPsHZU0lK X-Received: by 10.43.152.211 with SMTP id kx19mr13121213icc.8.1407510072643; Fri, 08 Aug 2014 08:01:12 -0700 (PDT) Received: from gavrio-wifi.robotsandstuff.fake (c-98-209-19-144.hsd1.mi.comcast.net. [98.209.19.144]) by mx.google.com with ESMTPSA id ro8sm9930523igb.15.2014.08.08.08.01.11 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 Aug 2014 08:01:12 -0700 (PDT) From: Weston Andros Adamson To: trond.myklebust@primarydata.com Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson Subject: [PATCH 4/5] nfs: fix error handling in lock_and_join_requests Date: Fri, 8 Aug 2014 11:00:56 -0400 Message-Id: <1407510057-6881-5-git-send-email-dros@primarydata.com> X-Mailer: git-send-email 1.8.5.2 (Apple Git-48) In-Reply-To: <1407510057-6881-1-git-send-email-dros@primarydata.com> References: <1407510057-6881-1-git-send-email-dros@primarydata.com> Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This fixes handling of errors from nfs_page_group_lock in nfs_lock_and_join_requests. It now releases the inode lock and the reference to the head request. Reported-by: Peng Tao Signed-off-by: Weston Andros Adamson Reviewed-by: Peng Tao --- fs/nfs/write.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/write.c b/fs/nfs/write.c index 321e561..0e3186b 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c @@ -480,8 +480,11 @@ try_again: /* lock each request in the page group */ ret = nfs_page_group_lock(head, true); - if (ret < 0) + if (ret < 0) { + spin_unlock(&inode->i_lock); + nfs_release_request(head); return ERR_PTR(ret); + } subreq = head; do { /*