Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3310255imu; Sun, 11 Nov 2018 12:06:26 -0800 (PST) X-Google-Smtp-Source: AJdET5fMlpYtptir/Rcn4V1tGcRompW1azcxXy8Aioe6onZGsGjxFobUSmqoZyiUYi3bN+hjbfaK X-Received: by 2002:a17:902:70c9:: with SMTP id l9-v6mr16478313plt.329.1541966786150; Sun, 11 Nov 2018 12:06:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541966786; cv=none; d=google.com; s=arc-20160816; b=Oc2btrDCLUqVOZrd3fSEvbuqQJxgNPkcU8DyiUQXMtPLhvLlKJj5vgPNy2ntoE5cYL ES9lsj10QZb2aVD6LGfnpy87yhIb49nge4FyjZ25vkegIDCvAzWUa068moWv0koMlpFY RdCILOYZCGXbqvlCfhfx1A7Wlk6HxOfrOvqG9H/CDir/yDiYvwg8+yDQ9e19yAZIJahk CXJ9Ly940gQYt7jf/8JmAesLKVbErpc5uaM1Y18G4mHkN3GGjgoBOh+xiBHDFW3nKZAo 00ieHlG2+WEUN9G2YZp076dsBDxaAgSXGzSxMqw+4A5rY7TQq5VT8KWr+35/K/cJCCY6 WLDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=TfFvxJCIvfuaEsHEWTQE07rO96UqK71D4SXyi0VmjTc=; b=PcCTZSPGDft3FU01ittbktEBfHaobsFtQTKkHmv6wMH1nb7ZQFk5WqPV5ARFq/XNpg g9B2FoD9EPUuHXCcjaUK7pdWgOflqiWwQdP9R2xp0zypcYFyn2UOKwgJ7crSr8m8lfEx RGOVVQQy4ya+5EExrY6ROqDSkgYLnI/baxWmrwgZl4p0MZMkNNflfHutsAcgGBmKKmJX ArE6RQVAMjRbHPpg+eT0DYsy0vqou9m0cEt0cUrZailJif5YpABuU5nd3fGGv58ASJ5z gK+4jWESR+aQ7ms1bNC9rDHDYJRF9NIhYGbe2TeIwu01Yvm1cSQKit7OYqK2/YK/2t1G +YfQ== 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 j24si8655929pgn.149.2018.11.11.12.06.10; Sun, 11 Nov 2018 12:06:26 -0800 (PST) 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 S1730722AbeKLFzQ (ORCPT + 99 others); Mon, 12 Nov 2018 00:55:16 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:51852 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726519AbeKLFzP (ORCPT ); Mon, 12 Nov 2018 00:55:15 -0500 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gLvt6-0000lG-1D; Sun, 11 Nov 2018 19:59:16 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gLvsQ-0001U5-F7; Sun, 11 Nov 2018 19:58:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "David Sterba" , "Filipe Manana" , "Omar Sandoval" Date: Sun, 11 Nov 2018 19:49:05 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 091/366] Btrfs: reserve space for O_TMPFILE orphan item deletion In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.61-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Omar Sandoval commit 399b0bbf5f680797d3599fa14f16706ffc470145 upstream. btrfs_link() calls btrfs_orphan_del() if it's linking an O_TMPFILE but it doesn't reserve space to do so. Even before the removal of the orphan_block_rsv it wasn't using it. Fixes: ef3b9af50bfa ("Btrfs: implement inode_operations callback tmpfile") Reviewed-by: Filipe Manana Signed-off-by: Omar Sandoval Signed-off-by: David Sterba Signed-off-by: Ben Hutchings --- fs/btrfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -6142,8 +6142,9 @@ static int btrfs_link(struct dentry *old * 2 items for inode and inode ref * 2 items for dir items * 1 item for parent inode + * 1 item for orphan item deletion if O_TMPFILE */ - trans = btrfs_start_transaction(root, 5); + trans = btrfs_start_transaction(root, inode->i_nlink ? 5 : 6); if (IS_ERR(trans)) { err = PTR_ERR(trans); goto fail;