lkml.org 
[lkml]   [2018]   [Mar]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: xfs: list corruption in xfs_setup_inode()
On Mon, Oct 30, 2017 at 2:55 PM, Cong Wang <xiyou.wangcong@gmail.com> wrote:
> Hello,
>
> We triggered a list corruption (double add) warning below on our 4.9
> kernel (the 4.9 kernel we use is based on -stable release, with only a
> few unrelated networking backports):

We still keep getting this warning on 4.9 kernel. Looking into this again,
it seems xfs_setup_inode() could be called twice if an XFS inode is gotten
from disk? Once in xfs_iget() => xfs_setup_existing_inode(), and once
in xfs_ialloc().

Does the following patch (compile-only) make any sense? Again, I don't
want to pretend to understand XFS...


diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 604ee384a00a..6761b1f8fa2f 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -775,6 +775,7 @@ xfs_ialloc(
int error;
struct timespec tv;
struct inode *inode;
+ bool had_imode;

/*
* Call the space management code to pick
@@ -801,6 +802,7 @@ xfs_ialloc(
return error;
ASSERT(ip != NULL);
inode = VFS_I(ip);
+ had_imode = !!inode->i_mode;

/*
* We always convert v1 inodes to v2 now - we only support filesystems
@@ -946,7 +948,8 @@ xfs_ialloc(
xfs_trans_log_inode(tp, ip, flags);

/* now that we have an i_mode we can setup the inode structure */
- xfs_setup_inode(ip);
+ if (!had_imode)
+ xfs_setup_inode(ip);

*ipp = ip;
return 0;
\
 
 \ /
  Last update: 2018-03-19 22:38    [W:1.501 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site