linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: linux-btrfs@vger.kernel.org
Cc: kernel-team@fb.com, Chris Mason <clm@fb.com>,
	Josef Bacik <josef@toxicpanda.com>,
	Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH v3 11/11] Btrfs: reserve space for O_TMPFILE orphan item deletion
Date: Fri, 11 May 2018 00:56:16 -0700	[thread overview]
Message-ID: <b09d6b4eed91637c18c00559af62b80aeabefed7.1526025007.git.osandov@fb.com> (raw)
In-Reply-To: <cover.1526025007.git.osandov@fb.com>
In-Reply-To: <cover.1526025007.git.osandov@fb.com>

From: Omar Sandoval <osandov@fb.com>

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 <fdmanana@suse.com>
Signed-off-by: Omar Sandoval <osandov@fb.com>
---
 fs/btrfs/inode.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1edb4148ec74..98cf08944552 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6465,8 +6465,9 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
 	 * 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);
 		trans = NULL;
-- 
2.17.0


      parent reply	other threads:[~2018-05-11  7:56 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11  7:56 [PATCH v3 00/11] Btrfs: orphan and truncate fixes Omar Sandoval
2018-05-11  7:56 ` [PATCH v3 01/11] Btrfs: remove stale comment referencing vmtruncate() Omar Sandoval
2018-05-11 10:19   ` David Sterba
2018-05-11 17:16     ` Omar Sandoval
2018-05-11  7:56 ` [PATCH v3 02/11] Btrfs: fix error handling in btrfs_truncate_inode_items() Omar Sandoval
2018-05-11  7:56 ` [PATCH v3 03/11] Btrfs: don't BUG_ON() " Omar Sandoval
2018-05-11  7:56 ` [PATCH v3 04/11] Btrfs: stop creating orphan items for truncate Omar Sandoval
2018-05-11 14:17   ` Josef Bacik
2018-05-11  7:56 ` [PATCH v3 05/11] Btrfs: get rid of BTRFS_INODE_HAS_ORPHAN_ITEM Omar Sandoval
2018-05-11  9:22   ` Nikolay Borisov
2018-05-11 10:06   ` David Sterba
2018-05-11 16:10     ` Josef Bacik
2018-05-11 16:51       ` David Sterba
2018-05-11 17:16         ` Omar Sandoval
2018-05-11  7:56 ` [PATCH v3 06/11] Btrfs: delete dead code in btrfs_orphan_commit_root() Omar Sandoval
2018-05-11 14:19   ` Josef Bacik
2018-05-11  7:56 ` [PATCH v3 07/11] Btrfs: don't return ino to ino cache if inode item removal fails Omar Sandoval
2018-05-11 14:20   ` Josef Bacik
2018-05-11  7:56 ` [PATCH v3 08/11] Btrfs: refactor btrfs_evict_inode() reserve refill dance Omar Sandoval
2018-05-11  7:56 ` [PATCH v3 09/11] Btrfs: fix ENOSPC caused by orphan items reservations Omar Sandoval
2018-05-11  9:47   ` Nikolay Borisov
2018-05-11  7:56 ` [PATCH v3 10/11] Btrfs: get rid of unused orphan infrastructure Omar Sandoval
2018-05-11  9:31   ` Nikolay Borisov
2018-05-11  7:56 ` Omar Sandoval [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b09d6b4eed91637c18c00559af62b80aeabefed7.1526025007.git.osandov@fb.com \
    --to=osandov@osandov.com \
    --cc=clm@fb.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).