From: Robbie Ko <robbieko@synology.com>
To: linux-btrfs@vger.kernel.org
Cc: Robbie Ko <robbieko@synology.com>
Subject: [PATCH v3 5/7] Btrfs: incremental send, fix rmdir but dir have a unprocess item
Date: Tue, 23 Jun 2015 18:39:49 +0800 [thread overview]
Message-ID: <1435055991-10109-6-git-send-email-robbieko@synology.com> (raw)
In-Reply-To: <1435055991-10109-1-git-send-email-robbieko@synology.com>
There's one case where we attempt to rmdir a directory prematurely.
Example:
Parent snapshot:
|---- a/ (ino 279)
|---- c (ino 282)
|---- del/ (ino 281)
|---- tmp/ (ino 280)
|---- long/ (ino 283)
Send snapshot:
|---- a/ (ino 279)
|---- long (ino 283)
|---- c/ (ino 282)
|---- tmp/ (ino 280)
While process inode 281, since inode 280 is waiting for inode 282,
rmdir_ino of struct waitng_dir_move for inode 280 will assigned to 281
and an orphan_dir_info will be created for node 281 in can_rmdir().
Such that, when process inode 282, we will do following steps.
First, move inode 282 from a/c to c
Second, move inode 280 from del/tmp to c/tmp
Third, try to remove inode 281
In Third step, we pass 283 (sctx->cur_ino + 1) as the send_progress to the
can_rmdir() function and that makes it return true when it shouldn't,
because the inode 283 wasn't processed yet and it's still a child of
the directory with inode number 281, which makes the receiver run into
an ENOTEMPTY error when attempting to remove the directory.
Signed-off-by: Robbie Ko <robbieko@synology.com>
---
fs/btrfs/send.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index 194df76..838abf4 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -3211,7 +3211,7 @@ static int apply_dir_move(struct send_ctx *sctx, struct pending_dir_move *pm)
/* already deleted */
goto finish;
}
- ret = can_rmdir(sctx, rmdir_ino, odi->gen, sctx->cur_ino + 1);
+ ret = can_rmdir(sctx, rmdir_ino, odi->gen, sctx->cur_ino);
if (ret < 0)
goto out;
if (!ret)
--
1.9.1
next prev parent reply other threads:[~2015-06-23 10:39 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-23 10:39 [PATCH v3 0/7] Btrfs incremental send fix serval case for rename and rm directory Robbie Ko
2015-06-23 10:39 ` [PATCH v3 1/7] Revert "Btrfs: incremental send, remove dead code" Robbie Ko
2015-06-23 15:09 ` Filipe David Manana
2015-06-23 15:24 ` David Sterba
2015-06-23 10:39 ` [PATCH v3 2/7] Btrfs: incremental send, avoid circular waiting and descendant overwrite ancestor need to update path Robbie Ko
2015-06-23 10:39 ` [PATCH v3 3/7] Btrfs: incremental send, avoid ancestor rename to descendant Robbie Ko
2015-06-23 15:05 ` Filipe David Manana
2015-06-23 10:39 ` [PATCH v3 4/7] Btrfs: incremental send, fix orphan_dir_info leak Robbie Ko
2015-06-23 10:39 ` Robbie Ko [this message]
2015-06-23 10:39 ` [PATCH v3 6/7] Btrfs: incremental send, don't send utimes for non-existing directory Robbie Ko
2015-06-23 10:39 ` [PATCH v3 7/7] Btrfs: incremental send, avoid the overhead of allocating an orphan_dir_info object unnecessarily Robbie Ko
2015-06-23 14:52 ` David Sterba
2015-06-23 15:35 ` [PATCH v3 0/7] Btrfs incremental send fix serval case for rename and rm directory Filipe David Manana
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=1435055991-10109-6-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox