Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-28 Thread Qu Wenruo
On 2019/3/28 下午10:25, David Sterba wrote: > On Thu, Mar 28, 2019 at 10:13:19PM +0800, Qu Wenruo wrote: >> That means we have hard link for directories. > > Yes, hard links of directories are forbidden by VFS but that's not the > point here: > > https://btrfs.wiki.kernel.o

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-28 Thread David Sterba
On Thu, Mar 28, 2019 at 10:13:19PM +0800, Qu Wenruo wrote: > That means we have hard link for directories. > >>> > >>> Yes, hard links of directories are forbidden by VFS but that's not the > >>> point here: > >>> > >>> https://btrfs.wiki.kernel.org/index.php/Project_ideas#Track_link_count_for

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-28 Thread Qu Wenruo
On 2019/3/28 下午10:07, David Sterba wrote: > On Thu, Mar 28, 2019 at 10:00:22PM +0800, Qu Wenruo wrote: >> >> >> On 2019/3/28 下午9:57, David Sterba wrote: >>> On Thu, Mar 28, 2019 at 09:42:59PM +0800, Qu Wenruo wrote: On 2019/3/28 下午9:38, David Sterba wrote: > On Wed, Mar 20, 20

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-28 Thread David Sterba
On Thu, Mar 28, 2019 at 10:00:22PM +0800, Qu Wenruo wrote: > > > On 2019/3/28 下午9:57, David Sterba wrote: > > On Thu, Mar 28, 2019 at 09:42:59PM +0800, Qu Wenruo wrote: > >> > >> > >> On 2019/3/28 下午9:38, David Sterba wrote: > >>> On Wed, Mar 20, 2019 at 02:37:16PM +0800, Qu Wenruo wrote: >

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-28 Thread Qu Wenruo
On 2019/3/28 下午9:57, David Sterba wrote: > On Thu, Mar 28, 2019 at 09:42:59PM +0800, Qu Wenruo wrote: >> >> >> On 2019/3/28 下午9:38, David Sterba wrote: >>> On Wed, Mar 20, 2019 at 02:37:16PM +0800, Qu Wenruo wrote: + if (S_ISDIR(mode) && btrfs_inode_nlink(leaf, iitem) > 1) { +

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-28 Thread David Sterba
On Thu, Mar 28, 2019 at 09:42:59PM +0800, Qu Wenruo wrote: > > > On 2019/3/28 下午9:38, David Sterba wrote: > > 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, > >> +

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-28 Thread Qu Wenruo
On 2019/3/28 下午9:38, David Sterba wrote: > 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

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-28 Thread David Sterba
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_in

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-26 Thread Qu Wenruo
On 2019/3/27 上午12:02, David Sterba wrote: > On Mon, Mar 25, 2019 at 12:27:24PM +0800, Qu Wenruo wrote: >> >> >> On 2019/3/20 下午2:37, Qu Wenruo wrote: >>> There is a report in kernel bugzilla about mismatch file type in dir >>> item and inode item. >>> >>> This inspires us to check inode mode in

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-26 Thread David Sterba
On Mon, Mar 25, 2019 at 12:27:24PM +0800, Qu Wenruo wrote: > > > On 2019/3/20 下午2:37, Qu Wenruo wrote: > > There is a report in kernel bugzilla about mismatch file type in dir > > item and inode item. > > > > This inspires us to check inode mode in inode item. > > > > This patch will check the fo

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-26 Thread David Sterba
On Wed, Mar 20, 2019 at 02:37:16PM +0800, Qu Wenruo wrote: > @@ -1539,6 +1539,8 @@ do { >\ > #define BTRFS_INODE_COMPRESS (1 << 11) > > #define BTRFS_INODE_ROOT_ITEM_INIT (1 << 31) > +#define BTRFS_INODE_FLAG_MASK

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-24 Thread Qu Wenruo
On 2019/3/20 下午2:37, Qu Wenruo wrote: > There is a report in kernel bugzilla about mismatch file type in dir > item and inode item. > > This inspires us to check inode mode in inode item. > > This patch will check the following members: > - inode key objectid > Should be ROOT_DIR_DIR or [256,

Re: [PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-20 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn Although I prefer direct returns instead of gotos if there's no cleanup. -- Johannes ThumshirnSUSE Labs Filesystems jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N

[PATCh v2 8/9] btrfs: tree-checker: Verify inode item

2019-03-19 Thread Qu Wenruo
There is a report in kernel bugzilla about mismatch file type in dir item and inode item. This inspires us to check inode mode in inode item. This patch will check the following members: - inode key objectid Should be ROOT_DIR_DIR or [256, (u64)-256] or FREE_INO. - inode key offset Should be