All of lore.kernel.org
 help / color / mirror / Atom feed
From: redneb@gmx.com
To: linux-btrfs@vger.kernel.org
Subject: bug: cannot delete an empty directory (the directory is NOT a subvolume)
Date: Fri, 5 Nov 2010 20:27:14 -0400	[thread overview]
Message-ID: <20101106002714.GA7762@epicurus> (raw)

I think this can be best explained by an example. Suppose that you have 
the following setup:

         mkfs.btrfs /dev/somedisk
         mount /dev/somedisk /mnt/btrfs
         mkdir /mnt/btrfs/aaa
         btrfs subvolume snapshot /mnt/btrfs /mnt/btrfs/aaa/bbb

So /mnt/btrfs/aaa is a ordinary directory containaing /mnt/btrfs/aaa/bbb 
which is a subvolume. The latter contains /mnt/btrfs/aaa/bbb/aaa which 
is a directory. This directory is empty (ls -a does not find anything) 
but it cannot be deleted:

# rmdir /mnt/btrfs/aaa/bbb/aaa
rmdir: failed to remove `/mnt/btrfs/aaa/bbb/aaa': Directory not empty

As it turns out, it contains a "ghost" directory named bbb that is not 
reported by ls -a but can be deleted by rmdir:

# rmdir /mnt/btrfs/aaa/bbb/aaa/bbb
(no errors, status code 0)

Now we can also delete /mnt/btrfs/aaa/bbb/aaa:

# rmdir /mnt/btrfs/aaa/bbb/aaa
(no errors, status code 0)

                 reply	other threads:[~2010-11-06  0:27 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=20101106002714.GA7762@epicurus \
    --to=redneb@gmx.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.