linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duncan <1i5t5.duncan@cox.net>
To: linux-btrfs@vger.kernel.org
Subject: Re: BTRFS cannot remove empry directory pretending it is not empty
Date: Fri, 21 Aug 2015 11:23:19 +0000 (UTC)	[thread overview]
Message-ID: <pan$3546e$3dbd1a66$4b200cff$9537e206@cox.net> (raw)
In-Reply-To: 2017000.AEG9PyVY17@zafu

Swâmi Petaramesh posted on Fri, 21 Aug 2015 10:19:54 +0200 as excerpted:

> BTRFS refuses to remove an empty dir and pretends it is not empty (and
> there is no BTRFS subvolume involved in there...)
> 
> # uname -r 4.1.5-1-ARCH

[The below description of the bug apparently involved is my not 
necessarily perfect understanding.  I don't claim to know the technical 
details behind inodes and thus it's possible my understanding isn't 
entirely correct.]

There was a recent inode refcounting bug that it sounds like you may well 
have hit, that failed to decrement (or double-incremented) the refcount 
in some cases, such that when a file was deleted, the filesystem still 
thought it had a reference to the inode and didn't delete it, resulting 
in inodes remaining but without a name attached to them.  These nameless 
inodes then prevent deletion of the directories the files were in, 
because the filesystem thinks there's still files there even tho there's 
no name associated with them so there's no file available to delete.

AFAIK, the bug is now fixed, but for those affected, the bad-refcounts 
remain.  I believe btrfs check should detect the problem and with
--repair should fix it, but of course caution is urged in using --repair 
as there's still a chance it'll do damage if there's other problems it 
doesn't understand and thus tries to fix in the wrong way.

So I'd suggest running btrfs check, without --repair, first, and see what 
it says.  If the only reported problems have to do with inode refcounts, 
then (assuming your backups are current, just in case, admin's rule of 
backups, if you don't have them, you don't care about losing the data) 
I'd then go ahead and run it with --repair.

Of course to do that you'll have to have the filesystem unmounted, and 
have access to a reasonably new btrfs command on the initr* or from your 
emergency boot, if it's the root filesystem.  Could be fun... but it 
should correct the issue.

-- 
Duncan - List replies preferred.   No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master."  Richard Stallman


  parent reply	other threads:[~2015-08-21 11:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-21  8:19 BTRFS cannot remove empry directory pretending it is not empty Swâmi Petaramesh
2015-08-21  8:47 ` Karsten Heymann
2015-08-21  9:15   ` Swâmi Petaramesh
2015-08-21  9:16     ` Roman Mamedov
2015-08-21  9:45 ` Hugo Mills
2015-08-21 11:23 ` Duncan [this message]
2015-08-21 15:39   ` Swâmi Petaramesh
2015-08-21 18:07     ` Duncan
2015-08-25  8:18   ` BTRFS cannot remove empty " Swâmi Petaramesh
2015-08-25  8:37     ` Duncan
2015-08-25 13:25       ` Swâmi Petaramesh
2015-08-25 14:03         ` Swâmi Petaramesh
2015-08-25 22:29           ` Duncan
2015-08-25 22:38             ` Hugo Mills
     [not found]             ` <9Aea1r00U2Q6ekd01Aebva>
2015-08-25 23:32               ` Duncan

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='pan$3546e$3dbd1a66$4b200cff$9537e206@cox.net' \
    --to=1i5t5.duncan@cox.net \
    --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).