Skip to contentSkip to conversation

reiser4: missed patch in porting to 3.15

PATCH New Ivan Shapovalov 2 participants 8 messages Sep 30, 2016 – Oct 4, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reiser4: missed patch in porting to 3.15

A patch was missed in the days of 3.15...

Ivan Shapovalov (1):
Adjust reiser4 for 3.15: replace truncate_inode_pages(..., 0) with truncate_inode_pages_final(...).

 plugin/file/cryptcompress.c | 2 --
 super_ops.c                 | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
Signature · 1 line
2.10.0
#1 lore raw

PATCH 1/1 Adjust reiser4 for 3.15: replace truncate_inode_pages(..., 0) with truncate_inode_pages_final(...).

Upstream commit 91b0abe36a7b2b3b02d7500925a5f8455334f0e5 "mm + fs: store shadow entries in page cache".

Moreover, the truncate_inode_pages(..., 0) in delete_object_cryptcompress() is not needed at all.

---
 plugin/file/cryptcompress.c | 2 --
 super_ops.c                 | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
plugin/file/cryptcompress.c +0 -2
index 59d8df8..5433de9 100644
@@ -3595,8 +3595,6 @@ int delete_object_cryptcompress(struct inode *inode)
 			(unsigned long long)get_inode_oid(inode),
 			result);
 	}
-	truncate_inode_pages(inode->i_mapping, 0);
-	assert("edward-1487", pages_truncate_ok(inode, 0));
 	/* and remove stat data */
 	return reiser4_delete_object_common(inode);
 }
super_ops.c +1 -1
index 73c18f2..697580c 100644
@@ -215,7 +215,7 @@ static void reiser4_evict_inode(struct inode *inode)
 			fplug->delete_object(inode);
 	}
 
-	truncate_inode_pages(&inode->i_data, 0);
+	truncate_inode_pages_final(&inode->i_data);
 	inode->i_blocks = 0;
 	clear_inode(inode);
 	reiser4_exit_context(ctx);
Signature · 1 line
2.10.0
#2 lore raw

Re: [PATCH] Adjust reiser4 for 3.15: replace truncate_inode_pages(..., 0) with truncate_inode_pages_final(...).

Quoted 39 lines · Ivan Shapovalov

Upstream commit 91b0abe36a7b2b3b02d7500925a5f8455334f0e5 "mm + fs: store shadow entries in page cache".

Moreover, the truncate_inode_pages(..., 0) in
delete_object_cryptcompress()
is not needed at all.

---
 plugin/file/cryptcompress.c | 2 --
 super_ops.c                 | 2 +-

 2 files changed, 1 insertion(+), 3 deletions(-)
plugin/file/cryptcompress.c +0 -2
index 59d8df8..5433de9 100644
@@ -3595,8 +3595,6 @@ int delete_object_cryptcompress(struct inode
 *inode)
  			(unsigned long long)get_inode_oid(inode),
  			result);
  	}
-	truncate_inode_pages(inode->i_mapping, 0);
-	assert("edward-1487", pages_truncate_ok(inode, 0));
  	/* and remove stat data */
  	return reiser4_delete_object_common(inode);

 }

super_ops.c +0 -0
index 73c18f2..697580c 100644
@@ -215,7 +215,7 @@ static void reiser4_evict_inode(struct inode
 *inode)
  			fplug->delete_object(inode);
  	}

super_ops.c +1 -1
-	truncate_inode_pages(&inode->i_data, 0);
+	truncate_inode_pages_final(&inode->i_data);
Quoted 3 lines

  inode->i_blocks = 0;
  clear_inode(inode);
  reiser4_exit_context(ctx);

BTW, this raises a question: in the ->evict_inode path, are we ever allowed to call plain truncate_inode_pages() (i. e. not *_final())?

The ->delete_object plugin methods do this as part of their logic, actually. At least the cryptcompress plugin calls truncate_inode_pages(..., new_size) at the end of prune_cryptcompress(), however I suspect that the regular file plugin also does this deep inside reiser4's guts.

--
Ivan Shapovalov / intelfx /

#3 lore raw

Re: [PATCH] Adjust reiser4 for 3.15: replace truncate_inode_pages(..., 0) with truncate_inode_pages_final(...).

Quoted 38 lines · Ivan Shapovalov
Quoted 37 lines · Ivan Shapovalov

Upstream commit 91b0abe36a7b2b3b02d7500925a5f8455334f0e5 "mm + fs: store shadow entries in page cache".

Moreover, the truncate_inode_pages(..., 0) in
delete_object_cryptcompress()
is not needed at all.

---
  plugin/file/cryptcompress.c | 2 --
  super_ops.c                 | 2 +-
  2 files changed, 1 insertion(+), 3 deletions(-)
plugin/file/cryptcompress.c +0 -2
index 59d8df8..5433de9 100644
@@ -3595,8 +3595,6 @@ int delete_object_cryptcompress(struct inode
 *inode)
  			(unsigned long long)get_inode_oid(inode),
  			result);
  	}
-	truncate_inode_pages(inode->i_mapping, 0);
-	assert("edward-1487", pages_truncate_ok(inode, 0));
  	/* and remove stat data */
  	return reiser4_delete_object_common(inode);
  }
super_ops.c +0 -0
index 73c18f2..697580c 100644
@@ -215,7 +215,7 @@ static void reiser4_evict_inode(struct inode
 *inode)
  			fplug->delete_object(inode);
  	}
 
Quoted 7 lines
Quoted 5 lines
super_ops.c +1 -1
-	truncate_inode_pages(&inode->i_data, 0);
+	truncate_inode_pages_final(&inode->i_data);
  	inode->i_blocks = 0;
  	clear_inode(inode);
  	reiser4_exit_context(ctx);

BTW, this raises a question: in the ->evict_inode path, are we ever allowed to call plain truncate_inode_pages() (i. e. not *_final())?

Actually, I would like to see a kind of assertion 1487 instead:
everything should be already truncated at that point.

Quoted 6 lines

The ->delete_object plugin methods do this as part of their logic, actually. At least the cryptcompress plugin calls truncate_inode_pages(..., new_size) at the end of prune_cryptcompress(), however I suspect that the regular file plugin also does this deep inside reiser4's guts.

File body is truncated item-by-item from right to left. For each item its ->kill_hook() method is called. It is responsible for truncating attached pages. Bodies of cryptcompress files are not connected:
there can be pages without "parent" items (in the case of holes), so in addition we call truncate_inode_pages() in prune_cryptcompress() to kill those pages.

Edward.

#4 lore raw

Re: [PATCH] Adjust reiser4 for 3.15: replace truncate_inode_pages(..., 0) with truncate_inode_pages_final(...).

Quoted 50 lines · Edward Shishkin
Quoted 40 lines · Ivan Shapovalov
Quoted 39 lines · Ivan Shapovalov

Upstream commit 91b0abe36a7b2b3b02d7500925a5f8455334f0e5 "mm + fs: store shadow entries in page cache".

Moreover, the truncate_inode_pages(..., 0) in
delete_object_cryptcompress()
is not needed at all.

---
  plugin/file/cryptcompress.c | 2 --
  super_ops.c                 | 2 +-

  2 files changed, 1 insertion(+), 3 deletions(-)
plugin/file/cryptcompress.c +0 -0
index 59d8df8..5433de9 100644
@@ -3595,8 +3595,6 @@ int delete_object_cryptcompress(struct

inode
*inode)
   (unsigned long
long)get_inode_oid(inode),
   result);
   }

plugin/file/cryptcompress.c +0 -2
-	truncate_inode_pages(inode->i_mapping, 0);
-	assert("edward-1487", pages_truncate_ok(inode, 0));

   /* and remove stat data */
   return reiser4_delete_object_common(inode); }

super_ops.c +0 -0
index 73c18f2..697580c 100644
@@ -215,7 +215,7 @@ static void reiser4_evict_inode(struct inode
 *inode)
   			fplug->delete_object(inode);
   	}

Quoted 8 lines
Quoted 5 lines
super_ops.c +1 -1
-	truncate_inode_pages(&inode->i_data, 0);
+	truncate_inode_pages_final(&inode->i_data);

   inode->i_blocks = 0;
   clear_inode(inode);
   reiser4_exit_context(ctx);

BTW, this raises a question: in the ->evict_inode path, are we ever allowed to call plain truncate_inode_pages() (i. e. not *_final())?

Quoted 2 lines

Actually, I would like to see a kind of assertion 1487 instead:
everything should be already truncated at that point.

Do you mean that the assertion should go instead of truncate_inode_pages_final()? Doesn't that function contain extra logic, beyond removing pages?

Moreover, that function seems to contain extra logic _before_ actually going off and truncating pages. This makes me wonder: doesn't this mean that we _must not ever_ call regular truncate_inode_pages() from inside ->evict_inode()?

I do not know VFS enough to answer these kinds of stupid questions...

Quoted 9 lines
Quoted 8 lines

The ->delete_object plugin methods do this as part of their logic, actually. At least the cryptcompress plugin calls truncate_inode_pages(..., new_size) at the end of prune_cryptcompress(), however I suspect that the regular file plugin
also does this deep inside reiser4's guts.

Quoted 7 lines

File body is truncated item-by-item from right to left. For each item its ->kill_hook() method is called. It is responsible for truncating attached pages. Bodies of cryptcompress files are not connected:
there can be pages without "parent" items (in the case of holes), so in addition we call truncate_inode_pages() in prune_cryptcompress() to kill those pages.

Understood. Thanks for explanation!
(the above question is still in effect...)

--
Ivan Shapovalov / intelfx /

#5 lore raw

Re: [PATCH] Adjust reiser4 for 3.15: replace truncate_inode_pages(..., 0) with truncate_inode_pages_final(...).

Quoted 17 lines · Ivan Shapovalov
Quoted 11 lines · Edward Shishkin
Quoted 7 lines · Ivan Shapovalov
Quoted 1 line · Ivan Shapovalov

[...]

BTW, this raises a question: in the ->evict_inode path, are we ever
allowed to call plain truncate_inode_pages() (i. e. not *_final())?

Actually, I would like to see a kind of assertion 1487 instead:
everything should be already truncated at that point.

Do you mean that the assertion should go instead of truncate_inode_pages_final()? Doesn't that function contain extra logic, beyond removing pages?

Quoted 8 lines

Moreover, that function seems to contain extra logic _before_ actually
going off and truncating pages. This makes me wonder: doesn't this mean
that we _must not ever_ call regular truncate_inode_pages() from inside ->evict_inode()?

I do not know VFS enough to answer these kinds of stupid questions...

Looks like the answer is "no, everything is OK". If ->evict_inode() races with remove_mapping() and shadow entries are installed into the radix tree, the *_final() call will still catch them. By association this means that this call is still needed.

(However, now I wonder how does this work with regular truncate and whether the radix tree can hold shadow entries for already truncated pages during an inode's lifetime, but this is a purely VFS/mm question.)

Signature · 1 line
Ivan Shapovalov / intelfx /
#6 lore raw

Re: [PATCH] Adjust reiser4 for 3.15: replace truncate_inode_pages(..., 0) with truncate_inode_pages_final(...).

Agreed,
we have to call *_final()

Thanks,
Edward.

Quoted 33 lines · Ivan Shapovalov
Quoted 14 lines · Ivan Shapovalov
Quoted 9 lines · Edward Shishkin
Quoted 6 lines · Ivan Shapovalov
Quoted 1 line · Ivan Shapovalov

[...]

BTW, this raises a question: in the ->evict_inode path, are we ever
allowed to call plain truncate_inode_pages() (i. e. not *_final())?

Actually, I would like to see a kind of assertion 1487 instead:
everything should be already truncated at that point.

Do you mean that the assertion should go instead of truncate_inode_pages_final()? Doesn't that function contain extra logic, beyond removing pages?

Quoted 8 lines

Moreover, that function seems to contain extra logic _before_ actually
going off and truncating pages. This makes me wonder: doesn't this mean
that we _must not ever_ call regular truncate_inode_pages() from inside ->evict_inode()?

I do not know VFS enough to answer these kinds of stupid questions...

Looks like the answer is "no, everything is OK". If ->evict_inode() races with remove_mapping() and shadow entries are installed into the radix tree, the *_final() call will still catch them. By association this means that this call is still needed.

(However, now I wonder how does this work with regular truncate and whether the radix tree can hold shadow entries for already truncated pages during an inode's lifetime, but this is a purely VFS/mm question.)

#7 lore raw

Re: [PATCH] Adjust reiser4 for 3.15: replace truncate_inode_pages(..., 0) with truncate_inode_pages_final(...).

In reply to Ivan Shapovalov

OK

Quoted 38 lines · Ivan Shapovalov

Upstream commit 91b0abe36a7b2b3b02d7500925a5f8455334f0e5 "mm + fs: store shadow entries in page cache".

Moreover, the truncate_inode_pages(..., 0) in delete_object_cryptcompress() is not needed at all.

---
  plugin/file/cryptcompress.c | 2 --
  super_ops.c                 | 2 +-
  2 files changed, 1 insertion(+), 3 deletions(-)
plugin/file/cryptcompress.c +0 -2
index 59d8df8..5433de9 100644
@@ -3595,8 +3595,6 @@ int delete_object_cryptcompress(struct inode *inode)
  			(unsigned long long)get_inode_oid(inode),
  			result);
  	}
-	truncate_inode_pages(inode->i_mapping, 0);
-	assert("edward-1487", pages_truncate_ok(inode, 0));
  	/* and remove stat data */
  	return reiser4_delete_object_common(inode);
  }
super_ops.c +1 -1
index 73c18f2..697580c 100644
@@ -215,7 +215,7 @@ static void reiser4_evict_inode(struct inode *inode)
  			fplug->delete_object(inode);
  	}
 
-	truncate_inode_pages(&inode->i_data, 0);
+	truncate_inode_pages_final(&inode->i_data);
  	inode->i_blocks = 0;
  	clear_inode(inode);
  	reiser4_exit_context(ctx);