Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp257106ybi; Wed, 29 May 2019 20:47:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqxGpWaMTXIR8a2MYBLS0Kvzf8CoKGQ7YlsIgv51J43zbvZOgzEjnF0VaY0jMOFBDORhzP+f X-Received: by 2002:a63:ff23:: with SMTP id k35mr1757839pgi.139.1559188077715; Wed, 29 May 2019 20:47:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188077; cv=none; d=google.com; s=arc-20160816; b=nXO1O52q3IlQgz+C78tDYnI8jJxnTsnW+CssCBKx4KFozL1em9imObcc6TzSwQYXNo 2H+65Z932+aQ6KB5skC2czqCJvXq4hIddrwpVHAEH5keaDPoFc4LoAwNULNaxYXfiDuL D46Fmi9L4NcE5oOUeNKdRxSmCjrRKql9aq2jqvfBkTgto3cr/DAE/Bbc/XFlVTu3BXVu ZXgY+JeBhXyWztM6Hp54s78Hlx4ENtehT2OIBCpdmVefcW0gtCQy99P0WmtOSjqbGdyR 4rj0U9AFrM+3AqN709CEcrH4X0ONsr/gm6an8evYkTkxaZU2dzvjXHIDmJF1CPutJEm4 z/mQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=BERYBmqwmzM0mtTI9tDVYWrJ44nJP3M5wWUNs2EsO7w=; b=RTMCdVaKZt1+wyUMei3AKmsUNuRX3eLrudb/TSLOBhPHqxfWztSqxWmZatT3XX0/bF 3AX8C3NtIM+LnqMpfCvQQNC1zujxGr2j/fWZDXKJMkvIBEsRlef+YIVLC85m1p+Bj0jX NIU8VasdwJnCNcZUM1Vd1XJBKdkzDcwFKmxp9yD17VdEo7LyLM2TFu4n6JQ0JcunPqwI joOrd9y8bM8PgTJbCxGtfDUDRhyEkA2xNjtoqywwiAxuivXrIeCgQCT1DcHwWxTuU8JJ zTJeW73ggJoqDnWAm4m+XHXPlyGSQy5XyRzGNFWx2gHkwMQ4k07FNLFy/bpV0trbykAZ HHoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YYRYk+B8; 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 i22si2149177pfd.84.2019.05.29.20.47.41; Wed, 29 May 2019 20:47:57 -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; dkim=pass header.i=@kernel.org header.s=default header.b=YYRYk+B8; 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 S1732383AbfE3DU4 (ORCPT + 99 others); Wed, 29 May 2019 23:20:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:41138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730584AbfE3DQF (ORCPT ); Wed, 29 May 2019 23:16:05 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 58C592458C; Thu, 30 May 2019 03:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186165; bh=f/uod0iwRLio3JMBjO0UmblrUC2/9F1p45ejVxG6x3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYRYk+B8vnMM41S2Fx3SfZYXi9GxGn4sxtXY+aQRTNJgdl5rc4Siyhg28WaLB8rER piJqUtMwcBJEZ5fv0duk8lzUcYNN3Kehzi+4Lp7kDuqXxIEkM/5oV55U3aRMBmbJ62 cudWIKSAghxEqWLyK3ztP+sDOdn9hHeC70/k1neU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Josef Bacik , David Sterba Subject: [PATCH 4.19 017/276] btrfs: dont double unlock on error in btrfs_punch_hole Date: Wed, 29 May 2019 20:02:55 -0700 Message-Id: <20190530030525.025076629@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030523.133519668@linuxfoundation.org> References: <20190530030523.133519668@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Josef Bacik commit 8fca955057b9c58467d1b231e43f19c4cf26ae8c upstream. If we have an error writing out a delalloc range in btrfs_punch_hole_lock_range we'll unlock the inode and then goto out_only_mutex, where we will again unlock the inode. This is bad, don't do this. Fixes: f27451f22996 ("Btrfs: add support for fallocate's zero range operation") CC: stable@vger.kernel.org # 4.19+ Reviewed-by: Filipe Manana Signed-off-by: Josef Bacik Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2565,10 +2565,8 @@ static int btrfs_punch_hole(struct inode ret = btrfs_punch_hole_lock_range(inode, lockstart, lockend, &cached_state); - if (ret) { - inode_unlock(inode); + if (ret) goto out_only_mutex; - } path = btrfs_alloc_path(); if (!path) {