Skip to contentSkip to conversation

xfs: preserve i_rdev when recycling a reclaimable inode

RFC PATCH Superseded Amir Goldstein 2 participants 5 messages Jan 25, 2018 – Jan 26, 2018

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 xfs: preserve i_rdev when recycling a reclaimable inode

---

Darrick,

This patch fixes a problem I am hitting consistenty with xfstest overlay/017 with certain overlay mount options (index=on,nfs_export=off).

I see that overlayfs looks up in underlying xfs and gets a chardev or blockdev inode with non initialized i_rdev (these are not whiteout inodes).

It takes a certain timing which happens in this test that does lookup immediately after drop caches. The test causes a permanent error in inode cache of xfs that is only fixed after another drop caches or cycle mount.

So I am certain there is a problem and that this patch fixes the problem, I'm just not sure this is the right fix and if it is, which is the commit that it "Fixes".

Thanks,
Amir.

 fs/xfs/xfs_icache.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_icache.c +2 -0
index 3861d61fb265..3ce946063ffe 100644
@@ -295,6 +295,7 @@ xfs_reinit_inode(
 	uint32_t	generation = inode->i_generation;
 	uint64_t	version = inode->i_version;
 	umode_t		mode = inode->i_mode;
+	dev_t		dev = inode->i_rdev;
 
 	error = inode_init_always(mp->m_super, inode);
 
@@ -302,6 +303,7 @@ xfs_reinit_inode(
 	inode->i_generation = generation;
 	inode->i_version = version;
 	inode->i_mode = mode;
+	inode->i_rdev = dev;
 	return error;
 }
 
Signature · 1 line
2.7.4
#1 lore raw
Quoted 12 lines · Amir Goldstein

---

Darrick,

This patch fixes a problem I am hitting consistenty with xfstest overlay/017 with certain overlay mount options (index=on,nfs_export=off).

I see that overlayfs looks up in underlying xfs and gets a chardev or blockdev inode with non initialized i_rdev (these are not whiteout inodes).

Quoted 8 lines

It takes a certain timing which happens in this test that does lookup immediately after drop caches. The test causes a permanent error in inode cache of xfs that is only fixed after another drop caches or cycle mount.

So I am certain there is a problem and that this patch fixes the problem, I'm just not sure this is the right fix and if it is, which is the commit that it "Fixes".

We're basically reinitializing a VFS inode that was on its way to being reclaimed, which means that we don't xfs_iread. We still have to reinitialize the vfs inode state (because we'd already torn that down), so we have to preserve all the vfs inode state that the xfs inode stores in the vfs inode.

Oh, right, hch moved if_rdev to i_rdev in 66f364649d870 ("xfs: remove if_rdev") but forgot the xfs_reinit_inode usage. so that would be the commit that this fixes. Doh.

--D

Quoted 34 lines

Thanks,
Amir.

 fs/xfs/xfs_icache.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_icache.c +2 -0
index 3861d61fb265..3ce946063ffe 100644
@@ -295,6 +295,7 @@ xfs_reinit_inode(
 	uint32_t	generation = inode->i_generation;
 	uint64_t	version = inode->i_version;
 	umode_t		mode = inode->i_mode;
+	dev_t		dev = inode->i_rdev;
 
 	error = inode_init_always(mp->m_super, inode);
 
@@ -302,6 +303,7 @@ xfs_reinit_inode(
 	inode->i_generation = generation;
 	inode->i_version = version;
 	inode->i_mode = mode;
+	inode->i_rdev = dev;
 	return error;
 }
 
Signature · 6 lines
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw
Quoted 28 lines · Darrick J. Wong
Quoted 12 lines · Amir Goldstein

---

Darrick,

This patch fixes a problem I am hitting consistenty with xfstest overlay/017 with certain overlay mount options (index=on,nfs_export=off).

I see that overlayfs looks up in underlying xfs and gets a chardev or blockdev inode with non initialized i_rdev (these are not whiteout inodes).

Quoted 8 lines

It takes a certain timing which happens in this test that does lookup immediately after drop caches. The test causes a permanent error in inode cache of xfs that is only fixed after another drop caches or cycle mount.

So I am certain there is a problem and that this patch fixes the problem, I'm just not sure this is the right fix and if it is, which is the commit that it "Fixes".

We're basically reinitializing a VFS inode that was on its way to being reclaimed, which means that we don't xfs_iread. We still have to reinitialize the vfs inode state (because we'd already torn that down), so we have to preserve all the vfs inode state that the xfs inode stores in the vfs inode.

Quoted 4 lines

Oh, right, hch moved if_rdev to i_rdev in 66f364649d870 ("xfs: remove if_rdev") but forgot the xfs_reinit_inode usage. so that would be the commit that this fixes. Doh.

Then this is a v4.15 regression fix and worth a last minute pull request IMO. Devices may become unavailable under memory pressure... weird things can happen.

Quoted 35 lines
Quoted 35 lines

Thanks,
Amir.

 fs/xfs/xfs_icache.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_icache.c +2 -1
index 3861d61fb265..3ce946063ffe 100644
@@ -295,6 +295,7 @@ xfs_reinit_inode(
      uint32_t        generation = inode->i_generation;
      uint64_t        version = inode->i_version;
      umode_t         mode = inode->i_mode;
+     dev_t           dev = inode->i_rdev;
 
      error = inode_init_always(mp->m_super, inode);
 
@@ -302,6 +303,7 @@ xfs_reinit_inode(
      inode->i_generation = generation;
      inode->i_version = version;
      inode->i_mode = mode;
+     inode->i_rdev = dev;
      return error;
 }
 
--

2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 30 lines · Amir Goldstein
Quoted 28 lines · Darrick J. Wong
Quoted 12 lines · Amir Goldstein

---

Darrick,

This patch fixes a problem I am hitting consistenty with xfstest overlay/017 with certain overlay mount options (index=on,nfs_export=off).

I see that overlayfs looks up in underlying xfs and gets a chardev or blockdev inode with non initialized i_rdev (these are not whiteout inodes).

Quoted 8 lines

It takes a certain timing which happens in this test that does lookup immediately after drop caches. The test causes a permanent error in inode cache of xfs that is only fixed after another drop caches or cycle mount.

So I am certain there is a problem and that this patch fixes the problem, I'm just not sure this is the right fix and if it is, which is the commit that it "Fixes".

We're basically reinitializing a VFS inode that was on its way to being reclaimed, which means that we don't xfs_iread. We still have to reinitialize the vfs inode state (because we'd already torn that down), so we have to preserve all the vfs inode state that the xfs inode stores in the vfs inode.

Quoted 7 lines
Quoted 4 lines

Oh, right, hch moved if_rdev to i_rdev in 66f364649d870 ("xfs: remove if_rdev") but forgot the xfs_reinit_inode usage. so that would be the commit that this fixes. Doh.

Then this is a v4.15 regression fix and worth a last minute pull request IMO. Devices may become unavailable under memory pressure... weird things can happen.

It probably ought to have a proper changelog & Fixes: tag then.

--D

Quoted 36 lines
Quoted 36 lines
Quoted 36 lines

Thanks,
Amir.

 fs/xfs/xfs_icache.c | 2 ++
 1 file changed, 2 insertions(+)
fs/xfs/xfs_icache.c +2 -1
index 3861d61fb265..3ce946063ffe 100644
@@ -295,6 +295,7 @@ xfs_reinit_inode(
      uint32_t        generation = inode->i_generation;
      uint64_t        version = inode->i_version;
      umode_t         mode = inode->i_mode;
+     dev_t           dev = inode->i_rdev;
 
      error = inode_init_always(mp->m_super, inode);
 
@@ -302,6 +303,7 @@ xfs_reinit_inode(
      inode->i_generation = generation;
      inode->i_version = version;
      inode->i_mode = mode;
+     inode->i_rdev = dev;
      return error;
 }
 
--

2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html