Linux-BTRFS Archive on lore.kernel.org
 help / color / 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
  2019-08-10  1:06 ` Qu Wenruo
  0 siblings, 2 replies; 4+ 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	[flat|nested] 4+ 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
  1 sibling, 1 reply; 4+ 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] 4+ 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; 4+ 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] 4+ 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
  1 sibling, 0 replies; 4+ 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] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ 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

Linux-BTRFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \
		linux-btrfs@vger.kernel.org linux-btrfs@archiver.kernel.org
	public-inbox-index linux-btrfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox