linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: btrfs_evict_inode must clear all inodes
@ 2018-01-29 16:46 Jeff Mahoney
  2018-01-29 16:48 ` Nikolay Borisov
  2018-01-29 19:58 ` Liu Bo
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Mahoney @ 2018-01-29 16:46 UTC (permalink / raw)
  To: linux-btrfs; +Cc: Nikolay Borisov

btrfs_evict_inode must clear all inodes or we'll hit a BUG_ON in evict().

Fixes: 3d48d9810de (btrfs: Handle uninitialised inode eviction)
Cc: Nikolay Borisov <nborisov@suse.com>
Cc: <stable@vger.kernel.org> # v4.8+
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
---
 fs/btrfs/inode.c |    1 +
 1 file changed, 1 insertion(+)

--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5282,6 +5282,7 @@ void btrfs_evict_inode(struct inode *ino
 	trace_btrfs_inode_evict(inode);
 
 	if (!root) {
+		clear_inode(inode);
 		kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
 		return;
 	}

-- 
Jeff Mahoney
SUSE Labs

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

* Re: [PATCH] btrfs: btrfs_evict_inode must clear all inodes
  2018-01-29 16:46 [PATCH] btrfs: btrfs_evict_inode must clear all inodes Jeff Mahoney
@ 2018-01-29 16:48 ` Nikolay Borisov
  2018-01-29 19:58 ` Liu Bo
  1 sibling, 0 replies; 4+ messages in thread
From: Nikolay Borisov @ 2018-01-29 16:48 UTC (permalink / raw)
  To: Jeff Mahoney, linux-btrfs



On 29.01.2018 18:46, Jeff Mahoney wrote:
> btrfs_evict_inode must clear all inodes or we'll hit a BUG_ON in evict().
> 
> Fixes: 3d48d9810de (btrfs: Handle uninitialised inode eviction)
> Cc: Nikolay Borisov <nborisov@suse.com>
> Cc: <stable@vger.kernel.org> # v4.8+
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>


Yep, this is a genuine bug, however Liu Bo already sent a fix for that:

Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly

> ---
>  fs/btrfs/inode.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -5282,6 +5282,7 @@ void btrfs_evict_inode(struct inode *ino
>  	trace_btrfs_inode_evict(inode);
>  
>  	if (!root) {
> +		clear_inode(inode);
>  		kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
>  		return;
>  	}
> 

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

* Re: [PATCH] btrfs: btrfs_evict_inode must clear all inodes
  2018-01-29 16:46 [PATCH] btrfs: btrfs_evict_inode must clear all inodes Jeff Mahoney
  2018-01-29 16:48 ` Nikolay Borisov
@ 2018-01-29 19:58 ` Liu Bo
  2018-01-29 20:03   ` Jeff Mahoney
  1 sibling, 1 reply; 4+ messages in thread
From: Liu Bo @ 2018-01-29 19:58 UTC (permalink / raw)
  To: Jeff Mahoney; +Cc: linux-btrfs, Nikolay Borisov

On Mon, Jan 29, 2018 at 11:46:28AM -0500, Jeff Mahoney wrote:
> btrfs_evict_inode must clear all inodes or we'll hit a BUG_ON in evict().
> 
> Fixes: 3d48d9810de (btrfs: Handle uninitialised inode eviction)
> Cc: Nikolay Borisov <nborisov@suse.com>
> Cc: <stable@vger.kernel.org> # v4.8+
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> ---
>  fs/btrfs/inode.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -5282,6 +5282,7 @@ void btrfs_evict_inode(struct inode *ino
>  	trace_btrfs_inode_evict(inode);
>  
>  	if (!root) {
> +		clear_inode(inode);
>  		kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));

I had a patch for this, and also kmem_cache_free() is not supposed to
be called here, but in ->destroy_inode().

Thanks,

-liubo
>  		return;
>  	}
> 
> -- 
> Jeff Mahoney
> SUSE Labs
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] btrfs: btrfs_evict_inode must clear all inodes
  2018-01-29 19:58 ` Liu Bo
@ 2018-01-29 20:03   ` Jeff Mahoney
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Mahoney @ 2018-01-29 20:03 UTC (permalink / raw)
  To: bo.li.liu; +Cc: linux-btrfs, Nikolay Borisov

On 1/29/18 2:58 PM, Liu Bo wrote:
> On Mon, Jan 29, 2018 at 11:46:28AM -0500, Jeff Mahoney wrote:
>> btrfs_evict_inode must clear all inodes or we'll hit a BUG_ON in evict().
>>
>> Fixes: 3d48d9810de (btrfs: Handle uninitialised inode eviction)
>> Cc: Nikolay Borisov <nborisov@suse.com>
>> Cc: <stable@vger.kernel.org> # v4.8+
>> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
>> ---
>>  fs/btrfs/inode.c |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> --- a/fs/btrfs/inode.c
>> +++ b/fs/btrfs/inode.c
>> @@ -5282,6 +5282,7 @@ void btrfs_evict_inode(struct inode *ino
>>  	trace_btrfs_inode_evict(inode);
>>  
>>  	if (!root) {
>> +		clear_inode(inode);
>>  		kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
> 
> I had a patch for this, and also kmem_cache_free() is not supposed to
> be called here, but in ->destroy_inode().

Yep, that too.

Thanks,

-Jeff

-- 
Jeff Mahoney
SUSE Labs

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

end of thread, other threads:[~2018-01-29 20:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-29 16:46 [PATCH] btrfs: btrfs_evict_inode must clear all inodes Jeff Mahoney
2018-01-29 16:48 ` Nikolay Borisov
2018-01-29 19:58 ` Liu Bo
2018-01-29 20:03   ` Jeff Mahoney

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