linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs-progs: don't check nbytes on unlinked files
@ 2019-08-09 13:18 Josef Bacik
  2019-08-09 15:27 ` Nikolay Borisov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Josef Bacik @ 2019-08-09 13:18 UTC (permalink / raw)
  To: linux-btrfs, kernel-team

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 <josef@toxicpanda.com>
---
 check/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/check/main.c b/check/main.c
index ca2ace10..45726e6e 100644
--- a/check/main.c
+++ b/check/main.c
@@ -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 ||
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs-progs: don't check nbytes on unlinked files
  2019-08-09 13:18 [PATCH] btrfs-progs: don't check nbytes on unlinked files Josef Bacik
@ 2019-08-09 15:27 ` Nikolay Borisov
  2019-08-09 15:30   ` Josef Bacik
  2019-08-10  1:06 ` Qu Wenruo
  2019-08-26 18:36 ` David Sterba
  2 siblings, 1 reply; 6+ messages in thread
From: Nikolay Borisov @ 2019-08-09 15:27 UTC (permalink / raw)
  To: Josef Bacik, kernel-team, linux-btrfs



On 9.08.19 г. 16:18 ч., Josef Bacik wrote:
> 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 <josef@toxicpanda.com>

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 ?

> ---
>  check/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/check/main.c b/check/main.c
> index ca2ace10..45726e6e 100644
> --- a/check/main.c
> +++ b/check/main.c
> @@ -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 ||
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs-progs: don't check nbytes on unlinked files
  2019-08-09 15:27 ` Nikolay Borisov
@ 2019-08-09 15:30   ` Josef Bacik
  0 siblings, 0 replies; 6+ messages in thread
From: Josef Bacik @ 2019-08-09 15:30 UTC (permalink / raw)
  To: Nikolay Borisov; +Cc: Josef Bacik, kernel-team, linux-btrfs

On Fri, Aug 09, 2019 at 06:27:14PM +0300, Nikolay Borisov wrote:
> 
> 
> On 9.08.19 г. 16:18 ч., Josef Bacik wrote:
> > 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 <josef@toxicpanda.com>
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs-progs: don't check nbytes on unlinked files
  2019-08-09 13:18 [PATCH] btrfs-progs: don't check nbytes on unlinked files Josef Bacik
  2019-08-09 15:27 ` Nikolay Borisov
@ 2019-08-10  1:06 ` Qu Wenruo
  2019-08-26 18:34   ` David Sterba
  2019-08-26 18:36 ` David Sterba
  2 siblings, 1 reply; 6+ messages in thread
From: Qu Wenruo @ 2019-08-10  1:06 UTC (permalink / raw)
  To: Josef Bacik, linux-btrfs, kernel-team


[-- Attachment #1.1: Type: text/plain, Size: 1078 bytes --]



On 2019/8/9 下午9:18, Josef Bacik wrote:
> 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
> 
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
> ---
>  check/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/check/main.c b/check/main.c
> index ca2ace10..45726e6e 100644
> --- a/check/main.c
> +++ b/check/main.c
> @@ -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 ||
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs-progs: don't check nbytes on unlinked files
  2019-08-10  1:06 ` Qu Wenruo
@ 2019-08-26 18:34   ` David Sterba
  0 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2019-08-26 18:34 UTC (permalink / raw)
  To: Qu Wenruo; +Cc: Josef Bacik, linux-btrfs, kernel-team

On Sat, Aug 10, 2019 at 09:06:22AM +0800, Qu Wenruo wrote:
> 
> 
> On 2019/8/9 下午9:18, Josef Bacik wrote:
> > 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] btrfs-progs: don't check nbytes on unlinked files
  2019-08-09 13:18 [PATCH] btrfs-progs: don't check nbytes on unlinked files Josef Bacik
  2019-08-09 15:27 ` Nikolay Borisov
  2019-08-10  1:06 ` Qu Wenruo
@ 2019-08-26 18:36 ` David Sterba
  2 siblings, 0 replies; 6+ messages in thread
From: David Sterba @ 2019-08-26 18:36 UTC (permalink / raw)
  To: Josef Bacik; +Cc: linux-btrfs, kernel-team

On Fri, Aug 09, 2019 at 09:18:31AM -0400, Josef Bacik wrote:
> 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 <josef@toxicpanda.com>

Added to devel, thanks.
> ---
>  check/main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/check/main.c b/check/main.c
> index ca2ace10..45726e6e 100644
> --- a/check/main.c
> +++ b/check/main.c
> @@ -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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-08-26 18:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-09 13:18 [PATCH] btrfs-progs: don't check nbytes on unlinked files Josef Bacik
2019-08-09 15:27 ` Nikolay Borisov
2019-08-09 15:30   ` Josef Bacik
2019-08-10  1:06 ` Qu Wenruo
2019-08-26 18:34   ` David Sterba
2019-08-26 18:36 ` David Sterba

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).