On Wed, Mar 20, 2019 at 02:37:16PM +0800, Qu Wenruo wrote: > + if (S_ISDIR(mode) && btrfs_inode_nlink(leaf, iitem) > 1) { > + inode_item_err(fs_info, leaf, slot, > + "invalid nlink: has %u expect no more than 1 for > dir", > + btrfs_inode_nlink(leaf, iitem)); > + goto error; > + }
I'm not sure about this check, the number of links for a directory is 1, but the exact count could be implemented (there's a project idea for that). I don't know if this will require an incompat bit or not. As long as the number is not authoritative (ie. can be verified and fixed from the actual directory items), then I'd say don't check it at all, or perhaps do only weak check if it's > 0. Out of all the verified inode data, this is the least important, I think we're not losing some significant piece of information.