Re: BTRFS cannot remove empry directory pretending it is not empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux