btrfs-progs: don't check nbytes on unlinked files
PATCH 1/1 btrfs-progs: don't check nbytes on unlinked files
We don't update the inode when evicting it, so the nbytes will be wrong in between transaction commits. This isn't a problem, stop complaining about it to make generic/269 stop randomly failing.
--- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
check/main.c +1 -1
@@ -807,7 +807,7 @@ static void maybe_free_inode_rec(struct cache_tree *inode_cache, }else if (S_ISREG (rec->imode) ||S_ISLNK (rec->imode)) {if (rec->found_dir_item) rec->errors |=I_ERR_ODD_DIR_ITEM ; -if (rec->found_size != rec->nbytes) +if (rec->nlink >0 && rec->found_size != rec->nbytes) rec->errors |=I_ERR_FILE_NBYTES_WRONG ; if (rec->nlink > 0 && !no_holes && (rec->extent_end < rec->isize ||
Signature · 1 line
2.21.0
Quoted 5 lines · Josef Bacik
We don't update the inode when evicting it, so the nbytes will be wrong in between transaction commits. This isn't a problem, stop complaining about it to make generic/269 stop randomly failing.
Signed-off-by Josef Bacik <[email protected]>
We shouldn't be able to see unlinked files in the tree. At the very least they should be orphans, no ? So why do we need this check ?
Quoted 18 lines
--- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)check/main.c +1
-1@@ -807,7 +807,7 @@ static void maybe_free_inode_rec(struct cache_tree *inode_cache, }else if (S_ISREG (rec->imode) ||S_ISLNK (rec->imode)) {if (rec->found_dir_item) rec->errors |=I_ERR_ODD_DIR_ITEM ; -if (rec->found_size != rec->nbytes) +if (rec->nlink >0 && rec->found_size != rec->nbytes) rec->errors |=I_ERR_FILE_NBYTES_WRONG ; if (rec->nlink > 0 && !no_holes && (rec->extent_end < rec->isize ||
Quoted 12 lines · Nikolay Borisov
Quoted 5 lines · Josef Bacik
We don't update the inode when evicting it, so the nbytes will be wrong in between transaction commits. This isn't a problem, stop complaining about it to make generic/269 stop randomly failing.
Signed-off-by Josef Bacik <[email protected]>We shouldn't be able to see unlinked files in the tree. At the very least they should be orphans, no ? So why do we need this check ?
Because we don't update the inode when evicting it. btrfsck doesn't skip inodes that have orphan items, it just does it's normal checks, which is why we need this. Thanks,
Josef
Quoted 3 lines · Josef Bacik
We don't update the inode when evicting it, so the nbytes will be wrong in between transaction commits. This isn't a problem, stop complaining about it to make generic/269 stop randomly failing.
Would you like to add the same check for lowmem mode?
Or mind me to do that?
Thanks,
Qu
Quoted 20 lines
Signed-off-by Josef Bacik <[email protected]>--- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)check/main.c +1
-1@@ -807,7 +807,7 @@ static void maybe_free_inode_rec(struct cache_tree *inode_cache, }else if (S_ISREG (rec->imode) ||S_ISLNK (rec->imode)) {if (rec->found_dir_item) rec->errors |=I_ERR_ODD_DIR_ITEM ; -if (rec->found_size != rec->nbytes) +if (rec->nlink >0 && rec->found_size != rec->nbytes) rec->errors |=I_ERR_FILE_NBYTES_WRONG ; if (rec->nlink > 0 && !no_holes && (rec->extent_end < rec->isize ||
Quoted 10 lines · Qu Wenruo
Quoted 3 lines · Josef Bacik
We don't update the inode when evicting it, so the nbytes will be wrong in between transaction commits. This isn't a problem, stop complaining about it to make generic/269 stop randomly failing.
Would you like to add the same check for lowmem mode?
Or mind me to do that?
Yes please. Thanks.
Quoted 5 lines · Josef Bacik
We don't update the inode when evicting it, so the nbytes will be wrong in between transaction commits. This isn't a problem, stop complaining about it to make generic/269 stop randomly failing.
Signed-off-by Josef Bacik <[email protected]>
Added to devel, thanks.
Quoted 9 lines
--- check/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)check/main.c +0
-0
check/main.c static void maybe_free_inode_rec(struct cache_tree *inode_cache, · line 810
Quoted 5 lines
check/main.c +1
-1@@ -807,7 +807,7 @@ static void maybe_free_inode_rec(struct cache_tree *inode_cache, }else if (S_ISREG (rec->imode) ||S_ISLNK (rec->imode)) {if (rec->found_dir_item) rec->errors |=I_ERR_ODD_DIR_ITEM ; -if (rec->found_size != rec->nbytes) +if (rec->nlink >0 && rec->found_size != rec->nbytes)
I've added a comment above the line.