linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikita Gerasimov <nikita.gerasimov@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: How to efficiently remove a subvolume with children located further than BTRFS_INO_LOOKUP_PATH_MAX?
Date: Mon, 5 Feb 2018 20:59:28 +0300	[thread overview]
Message-ID: <1ea28071-c539-b923-e75f-dc1cf21b8414@oracle.com> (raw)

Hi All,

I have an issue with recursively subvolume deletion when child created further than PATH_MAX.

As I understand current algorithm is:
- Find child by BTRFS_IOC_TREE_SEARCH, which is work fine.
- Get relative path to child by BTRFS_IOC_INO_LOOKUP. (that's a problem)
- Open child fd and recursively repeat until BTRFS_IOC_TREE_SEARCH could found something.

So when relative path is not fit into BTRFS_INO_LOOKUP_PATH_MAX,
BTRFS_IOC_INO_LOOKUP return ENAMETOOLONG and zeros as btrfs_ioctl_ino_lookup_args.
The only way I can see by far is walk through parent fs tree to find objects
matching by name with BTRFS_IOC_TREE_SEARCH results and check them byfstat. It doesn't look very good in terms of performance. Is there any 
shorter way to get fd by child btrfs_root_ref?

Also btrfs-progs are fail to delete subvolumes with canonical path > PATH_MAX
because of realpath also return ENAMETOOLONG. At the same time creation by
relative path works fine.


                 reply	other threads:[~2018-02-05 18:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1ea28071-c539-b923-e75f-dc1cf21b8414@oracle.com \
    --to=nikita.gerasimov@oracle.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;
as well as URLs for NNTP newsgroup(s).