linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: bingjingc <bingjingc@synology.com>
To: fdmanana@kernel.org, josef@toxicpanda.com, dsterba@suse.com,
	clm@fb.com, linux-btrfs@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: bingjingc@synology.com, robbieko@synology.com, bxxxjxxg@gmail.com
Subject: [PATCH 0/2] btrfs: send: fix a bug that sending unlink commands for directories
Date: Mon,  8 Aug 2022 18:27:33 +0800	[thread overview]
Message-ID: <20220808102735.4556-1-bingjingc@synology.com> (raw)

From: BingJing Chang <bingjingc@synology.com>

There is a bug sending unlink commands for directories. In
commit 46b2f4590aab ("Btrfs: fix send failure when root has deleted files
still open")', orphan inode issue was addressed. There're no reference
paths for these orphan inodes, so the send operation fails with an ENOENT
error. Therefore, in that patch, sctx->ignore_cur_inode was introduced to
be set if the current inode has a link count of zero for bypassing some
unnecessary steps. And a helper function btrfs_unlink_all_paths() was
introduced and called to clean up old reference paths found in the parent
snapshot. However, not only regular files but also directories can be
orphan inodes. So if it meets an orphan directory, a wrong unlink command
for this directory will be issued. Soon the unlink command fails with an
EISDIR error.


BingJing Chang (2):
  btrfs: send: refactor get_inode_info()
  btrfs: send: fix a bug that sending unlink commands for directories

 fs/btrfs/send.c | 390 +++++++++++++++++++++++-------------------------
 1 file changed, 189 insertions(+), 201 deletions(-)

-- 
2.37.1


             reply	other threads:[~2022-08-08 10:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-08 10:27 bingjingc [this message]
2022-08-08 10:27 ` [PATCH 1/2] btrfs: send: refactor get_inode_info() bingjingc
2022-08-08 16:17   ` Filipe Manana
2022-08-08 10:27 ` [PATCH 2/2] btrfs: send: fix a bug that sending unlink commands for directories bingjingc
2022-08-08 16:22   ` Filipe Manana
2022-08-11  6:09     ` bingjing chang

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=20220808102735.4556-1-bingjingc@synology.com \
    --to=bingjingc@synology.com \
    --cc=bxxxjxxg@gmail.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=fdmanana@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robbieko@synology.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).