All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robbie Ko <robbieko@synology.com>
To: linux-btrfs@vger.kernel.org
Cc: Robbie Ko <robbieko@synology.com>
Subject: [PATCH v2 4/7] Btrfs: incremental send, fix orphan_dir_info leak
Date: Mon, 22 Jun 2015 17:08:45 +0800	[thread overview]
Message-ID: <1434964128-31757-5-git-send-email-robbieko@synology.com> (raw)
In-Reply-To: <1434964128-31757-1-git-send-email-robbieko@synology.com>

There's one case where we leak a orphan_dir_info structure.

Example:

Parent snapshot:
|---- a/ (ino 279)
    |---- c (ino 282)
|---- del/ (ino 281)
    |---- tmp/ (ino 280)
    |---- long/ (ino 283)
    |---- longlong/ (ino 284)

Send snapshot:
|---- a/ (ino 279)
    |---- long (ino 283)
    |---- longlong (ino 284)
|---- c/ (ino 282)
    |---- tmp/ (ino 280)

Freeing an existing orphan_dir_info for a directory, when we realize
we can't rmdir the directory because it has a descendant that wasn't
yet processed, and the orphan_dir_info was created because it had a
descendant that had its rename operation delayed.

Signed-off-by: Robbie Ko <robbieko@synology.com>
---

V2: modify comment

 fs/btrfs/send.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index b946067..bc9efbe 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -2913,6 +2913,11 @@ static int can_rmdir(struct send_ctx *sctx, u64 dir, u64 dir_gen,
 		}
 
 		if (loc.objectid > send_progress) {
+			struct orphan_dir_info *odi;
+
+			odi = get_orphan_dir_info(sctx, dir);
+			if (odi)
+				free_orphan_dir_info(sctx, odi);
 			ret = 0;
 			goto out;
 		}
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in

  parent reply	other threads:[~2015-06-22  9:08 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-22  9:08 [PATCH v2 0/7] Btrfs incremental send fix serval case for rename and rm directory Robbie Ko
2015-06-22  9:08 ` [PATCH v2 1/7] Revert "Btrfs: incremental send, remove dead code" Robbie Ko
2015-06-22 11:32   ` Filipe David Manana
2015-06-22  9:08 ` [PATCH v2 2/7] Btrfs: incremental send, avoid circular waiting and descendant overwrite ancestor need to update path Robbie Ko
2015-06-22 11:35   ` Filipe David Manana
2015-06-22  9:08 ` [PATCH v2 3/7] Btrfs: incremental send, avoid ancestor rename to descendant Robbie Ko
2015-06-22 11:36   ` Filipe David Manana
2015-06-22  9:08 ` Robbie Ko [this message]
2015-06-22  9:08 ` [PATCH v2 5/7] Btrfs: incremental send, fix rmdir but dir have a unprocess item Robbie Ko
2015-06-22  9:08 ` [PATCH v2 6/7] Btrfs: incremental send, don't send utimes for non-existing directory Robbie Ko
2015-06-22 11:37   ` Filipe David Manana
2015-06-22  9:08 ` [PATCH v2 7/7] Btrfs: incremental send, avoid the overhead of allocating an orphan_dir_info object unnecessarily Robbie Ko

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=1434964128-31757-5-git-send-email-robbieko@synology.com \
    --to=robbieko@synology.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.