* [PATCH] Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly
@ 2018-01-25 18:02 Liu Bo
2018-01-26 11:35 ` Nikolay Borisov
2018-01-26 14:05 ` Josef Bacik
0 siblings, 2 replies; 3+ messages in thread
From: Liu Bo @ 2018-01-25 18:02 UTC (permalink / raw)
To: linux-btrfs
This regression is introduced in
commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction").
There are two problems,
a) it is ->destroy_inode() that does the final free on inode, not
->evict_inode(),
b) clear_inode() must be called before ->evict_inode() returns.
This could end up hitting BUG_ON(inode->i_state != (I_FREEING | I_CLEAR));
in evict() because I_CLEAR is set in clear_inode().
Fixes: commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction")
Cc: <stable@vger.kernel.org> # v4.7-rc6+
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 281a250..bc6ef73 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5286,7 +5286,7 @@ void btrfs_evict_inode(struct inode *inode)
trace_btrfs_inode_evict(inode);
if (!root) {
- kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
+ clear_inode(inode);
return;
}
--
2.9.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly
2018-01-25 18:02 [PATCH] Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly Liu Bo
@ 2018-01-26 11:35 ` Nikolay Borisov
2018-01-26 14:05 ` Josef Bacik
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2018-01-26 11:35 UTC (permalink / raw)
To: Liu Bo, linux-btrfs
On 25.01.2018 20:02, Liu Bo wrote:
> This regression is introduced in
> commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction").
>
> There are two problems,
>
> a) it is ->destroy_inode() that does the final free on inode, not
> ->evict_inode(),
> b) clear_inode() must be called before ->evict_inode() returns.
>
> This could end up hitting BUG_ON(inode->i_state != (I_FREEING | I_CLEAR));
> in evict() because I_CLEAR is set in clear_inode().
>
Oops, It seems I've missed that when I wrote the original patch.
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> Fixes: commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction")
> Cc: <stable@vger.kernel.org> # v4.7-rc6+
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
> fs/btrfs/inode.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 281a250..bc6ef73 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -5286,7 +5286,7 @@ void btrfs_evict_inode(struct inode *inode)
> trace_btrfs_inode_evict(inode);
>
> if (!root) {
> - kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode));
> + clear_inode(inode);
> return;
> }
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly
2018-01-25 18:02 [PATCH] Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly Liu Bo
2018-01-26 11:35 ` Nikolay Borisov
@ 2018-01-26 14:05 ` Josef Bacik
1 sibling, 0 replies; 3+ messages in thread
From: Josef Bacik @ 2018-01-26 14:05 UTC (permalink / raw)
To: Liu Bo; +Cc: linux-btrfs
On Thu, Jan 25, 2018 at 11:02:53AM -0700, Liu Bo wrote:
> This regression is introduced in
> commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction").
>
> There are two problems,
>
> a) it is ->destroy_inode() that does the final free on inode, not
> ->evict_inode(),
> b) clear_inode() must be called before ->evict_inode() returns.
>
> This could end up hitting BUG_ON(inode->i_state != (I_FREEING | I_CLEAR));
> in evict() because I_CLEAR is set in clear_inode().
>
> Fixes: commit 3d48d9810de4 ("btrfs: Handle uninitialised inode eviction")
> Cc: <stable@vger.kernel.org> # v4.7-rc6+
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
> ---
Reviewed-by: Josef Bacik <jbacik@fb.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-26 14:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-25 18:02 [PATCH] Btrfs: fix btrfs_evict_inode to handle abnormal inodes correctly Liu Bo
2018-01-26 11:35 ` Nikolay Borisov
2018-01-26 14:05 ` Josef Bacik
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).