Skip to contentSkip to conversation

reiser4: another batch of fixes for 4.2.

PATCH In review Ivan Shapovalov 3 participants 12 messages Oct 24, 2015 – Dec 4, 2015

lore
Share & tools
lore
#0 lore raw

v2 cover reiser4: another batch of fixes for 4.2.

These are the fixes for issues I've discovered during migration to 4.2. Last one is a real issue causing a reproducible oops in my configuration, first two are byproducts.

v2: The 3/3 is now a real fix instead of a blind duct-tape fixup.

Ivan Shapovalov (3):
reiser4: remove last traces of JNODE_NEW in the debugging code.
reiser4: call account_page_redirty() on re-dirtying pages before giving them to entd.
reiser4: mark pages created during tail2extent conversion as dirty.

 fs/reiser4/entd.c                        | 1 +
 fs/reiser4/jnode.c                       | 3 +--
 fs/reiser4/plugin/file/tail_conversion.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.6.2
#1 lore raw

PATCH v2 1/3 reiser4: remove last traces of JNODE_NEW in the debugging code.

---
 fs/reiser4/jnode.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/reiser4/jnode.c +1 -2
index e0c9e0c..43af7e9 100644
@@ -1846,7 +1846,7 @@ static void info_jnode(const char *prefix /* prefix to print */ ,
 	}
 
 	printk
-	    ("%s: %p: state: %lx: [%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s], level: %i,"
+	    ("%s: %p: state: %lx: [%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s], level: %i,"
 	     " block: %s, d_count: %d, x_count: %d, "
 	     "pg: %p, atom: %p, lock: %i:%i, type: %s, ", prefix, node,
 	     node->state,
@@ -1863,7 +1863,6 @@ static void info_jnode(const char *prefix /* prefix to print */ ,
 	     jnode_state_name(node, JNODE_RIP),
 	     jnode_state_name(node, JNODE_MISSED_IN_CAPTURE),
 	     jnode_state_name(node, JNODE_WRITEBACK),
-	     jnode_state_name(node, JNODE_NEW),
 	     jnode_state_name(node, JNODE_DKSET),
 	     jnode_state_name(node, JNODE_REPACK),
 	     jnode_state_name(node, JNODE_CLUSTER_PAGE),
Signature · 1 line
2.6.2
#2 lore raw

Re: [PATCHv2 1/3] reiser4: remove last traces of JNODE_NEW in the debugging code.

OK

Quoted 26 lines · Ivan Shapovalov
---
  fs/reiser4/jnode.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
fs/reiser4/jnode.c +1 -2
index e0c9e0c..43af7e9 100644
@@ -1846,7 +1846,7 @@ static void info_jnode(const char *prefix /* prefix to print */ ,
  	}
 
  	printk
-	    ("%s: %p: state: %lx: [%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s], level: %i,"
+	    ("%s: %p: state: %lx: [%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s], level: %i,"
  	     " block: %s, d_count: %d, x_count: %d, "
  	     "pg: %p, atom: %p, lock: %i:%i, type: %s, ", prefix, node,
  	     node->state,
@@ -1863,7 +1863,6 @@ static void info_jnode(const char *prefix /* prefix to print */ ,
  	     jnode_state_name(node, JNODE_RIP),
  	     jnode_state_name(node, JNODE_MISSED_IN_CAPTURE),
  	     jnode_state_name(node, JNODE_WRITEBACK),
-	     jnode_state_name(node, JNODE_NEW),
  	     jnode_state_name(node, JNODE_DKSET),
  	     jnode_state_name(node, JNODE_REPACK),
  	     jnode_state_name(node, JNODE_CLUSTER_PAGE),
#3 lore raw

PATCH v2 2/3 reiser4: call account_page_redirty() on re-dirtying pages before giving them to entd.

In reply to Ivan Shapovalov

I guess we want that to rollback effects of account_page_dirtied() in set_page_dirty_notag().

---
 fs/reiser4/entd.c | 1 +
 1 file changed, 1 insertion(+)
fs/reiser4/entd.c +1 -0
index bff4bfa..c254e71 100644
@@ -303,6 +303,7 @@ int write_page_by_ent(struct page *page, struct writeback_control *wbc)
 	 * write it - it will remain dirty
 	 */
 	set_page_dirty_notag(page);
+	account_page_redirty(page);
 
 	/*
 	 * pin inode in memory, unlock page, entd_flush will iput. We can not
Signature · 1 line
2.6.2
#4 lore raw

Re: [PATCHv2 2/3] reiser4: call account_page_redirty() on re-dirtying pages before giving them to entd.

OK.

Quoted 20 lines · Ivan Shapovalov

I guess we want that to rollback effects of account_page_dirtied() in set_page_dirty_notag().

---
  fs/reiser4/entd.c | 1 +
  1 file changed, 1 insertion(+)
fs/reiser4/entd.c +1 -0
index bff4bfa..c254e71 100644
@@ -303,6 +303,7 @@ int write_page_by_ent(struct page *page, struct writeback_control *wbc)
  	 * write it - it will remain dirty
  	 */
  	set_page_dirty_notag(page);
+	account_page_redirty(page);
 
  	/*
  	 * pin inode in memory, unlock page, entd_flush will iput. We can not
#5 lore raw

PATCH v2 3/3 reiser4: mark pages created during tail2extent conversion as dirty.

In reply to Ivan Shapovalov

This is responsible for an oops in v4.2 in write_jnodes_to_disk_extent() -> set_page_writeback().

The pages needs to be marked dirty before marked writeback.

From a similar problem in f2fs:
"The cgroup attaches inode->i_wb via mark_inode_dirty and when set_page_writeback is called, __inc_wb_stat() updates i_wb's stat.

So, we need to explicitly call set_page_dirty->__mark_inode_dirty in prior to any writebacking pages."

---
 fs/reiser4/plugin/file/tail_conversion.c | 1 +
 1 file changed, 1 insertion(+)
fs/reiser4/plugin/file/tail_conversion.c +1 -0
index 7542c03..c856b73 100644
@@ -175,6 +175,7 @@ static int replace(struct inode *inode, struct page **pages, unsigned nr_pages,
 								i_mapping));
 		if (result)
 			break;
+		set_page_dirty_notag(pages[i]);
 		unlock_page(pages[i]);
 		result = find_or_create_extent(pages[i]);
 		if (result) {
Signature · 1 line
2.6.2
#6 lore raw

Re: [PATCHv2 3/3] reiser4: mark pages created during tail2extent conversion as dirty.

Quoted 22 lines · Ivan Shapovalov

This is responsible for an oops in v4.2 in write_jnodes_to_disk_extent() -> set_page_writeback().

The pages needs to be marked dirty before marked writeback.

From a similar problem in f2fs:
"The cgroup attaches inode->i_wb via mark_inode_dirty and when set_page_writeback is called, __inc_wb_stat() updates i_wb's stat.

So, we need to explicitly call set_page_dirty->__mark_inode_dirty in prior to any writebacking pages."

---
  fs/reiser4/plugin/file/tail_conversion.c | 1 +
  1 file changed, 1 insertion(+)
fs/reiser4/plugin/file/tail_conversion.c +0 -0
index 7542c03..c856b73 100644

fs/reiser4/plugin/file/tail_conversion.c static int replace(struct inode *inode, struct page **pages, unsigned nr_pages, · line 178

Quoted 4 lines
fs/reiser4/plugin/file/tail_conversion.c +1 -0
@@ -175,6 +175,7 @@ static int replace(struct inode *inode, struct page **pages, unsigned nr_pages,
  								i_mapping));
  		if (result)
  			break;
+		set_page_dirty_notag(pages[i]);

So, at this point the page is dirty but not uptodate. I am confused with this. Why not to set the page uptodate right before setting it dirty? At this point everything has been copied already, so the page is in fact uptodate. Could you please try this?

Thanks,
Edward.

Quoted 3 lines
fs/reiser4/plugin/file/tail_conversion.c +0 -0
  		unlock_page(pages[i]);
  		result = find_or_create_extent(pages[i]);
  		if (result) {
#7 lore raw

Re: [PATCHv2 3/3] reiser4: mark pages created during tail2extent conversion as dirty.

Quoted 3 lines · Edward Shishkin
Quoted 2 lines · Ivan Shapovalov

This is responsible for an oops in v4.2 in write_jnodes_to_disk_extent() -> set_page_writeback().

As to me, this patch doesn't prevent the oops,
so someone else forgets to set pages dirty...

Thanks,
Edward.

Quoted 41 lines
Quoted 20 lines

The pages needs to be marked dirty before marked writeback.

From a similar problem in f2fs:
"The cgroup attaches inode->i_wb via mark_inode_dirty and when set_page_writeback is called, __inc_wb_stat() updates i_wb's stat.

So, we need to explicitly call set_page_dirty->__mark_inode_dirty in prior to any writebacking pages."

---
  fs/reiser4/plugin/file/tail_conversion.c | 1 +
  1 file changed, 1 insertion(+)
fs/reiser4/plugin/file/tail_conversion.c +0 -0
index 7542c03..c856b73 100644

fs/reiser4/plugin/file/tail_conversion.c static int replace(struct inode *inode, struct · line 179

Quoted 5 lines
fs/reiser4/plugin/file/tail_conversion.c +1 -0
@@ -175,6 +175,7 @@ static int replace(struct inode *inode, struct 
 page **pages, unsigned nr_pages,
                                  i_mapping));
          if (result)
              break;
+        set_page_dirty_notag(pages[i]);

So, at this point the page is dirty but not uptodate. I am confused with this. Why not to set the page uptodate right before setting it dirty? At this point everything has been copied already, so the page is in fact uptodate. Could you please try this?

Thanks,
Edward.

Quoted 3 lines
fs/reiser4/plugin/file/tail_conversion.c +0 -0
          unlock_page(pages[i]);
          result = find_or_create_extent(pages[i]);
          if (result) {
#8 lore raw

Re: [PATCHv2 3/3] reiser4: mark pages created during tail2extent conversion as dirty.

Quoted 10 lines · Edward Shishkin
Quoted 3 lines · Edward Shishkin
Quoted 2 lines · Ivan Shapovalov

This is responsible for an oops in v4.2 in write_jnodes_to_disk_extent() -> set_page_writeback().

As to me, this patch doesn't prevent the oops,
so someone else forgets to set pages dirty...

False alarm: I applied to the old stuff..
Everything woks without the hack in
write_jnodes_to_disk_extent().
Good work! Merged to reiser4-for-4.2.3.

Thanks,
Edward.

Quoted 44 lines
Quoted 43 lines
Quoted 22 lines

The pages needs to be marked dirty before marked writeback.

From a similar problem in f2fs:
"The cgroup attaches inode->i_wb via mark_inode_dirty and when set_page_writeback is called, __inc_wb_stat() updates i_wb's stat.

So, we need to explicitly call set_page_dirty->__mark_inode_dirty in prior to any writebacking pages."

---
  fs/reiser4/plugin/file/tail_conversion.c | 1 +
  1 file changed, 1 insertion(+)
fs/reiser4/plugin/file/tail_conversion.c +0 -0
index 7542c03..c856b73 100644

fs/reiser4/plugin/file/tail_conversion.c static int replace(struct inode *inode, struct · line 179

Quoted 5 lines
fs/reiser4/plugin/file/tail_conversion.c +1 -0
@@ -175,6 +175,7 @@ static int replace(struct inode *inode, struct 
 page **pages, unsigned nr_pages,
                                  i_mapping));
          if (result)
              break;
+        set_page_dirty_notag(pages[i]);

So, at this point the page is dirty but not uptodate. I am confused with this. Why not to set the page uptodate right before setting it dirty? At this point everything has been copied already, so the page is in fact uptodate. Could you please try this?

Thanks,
Edward.

Quoted 3 lines
fs/reiser4/plugin/file/tail_conversion.c +0 -0
          unlock_page(pages[i]);
          result = find_or_create_extent(pages[i]);
          if (result) {
#9 lore raw

Re: [PATCHv2 3/3] reiser4: mark pages created during tail2extent conversion as dirty.

Quoted 9 lines · Edward Shishkin
Quoted 8 lines · Edward Shishkin
Quoted 3 lines · Edward Shishkin
Quoted 2 lines · Ivan Shapovalov

This is responsible for an oops in v4.2 in write_jnodes_to_disk_extent() -> set_page_writeback().

Quoted 8 lines
Quoted 2 lines

As to me, this patch doesn't prevent the oops,
so someone else forgets to set pages dirty...

False alarm: I applied to the old stuff..
Everything woks without the hack in
write_jnodes_to_disk_extent().
Good work! Merged to reiser4-for-4.2.3.

Hi Edward,

Glad to hear that. I was already halfway recovering my debug patches for collecting stacktraces and related information and was going to ask you to reproduce :)

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines

The pages needs to be marked dirty before marked writeback.

 From a similar problem in f2fs:
"The cgroup attaches inode->i_wb via mark_inode_dirty and when set_page_writeback is called, __inc_wb_stat() updates i_wb's stat.

So, we need to explicitly call set_page_dirty-

Quoted 1 line

__mark_inode_dirty in

prior to any writebacking pages."

---
  fs/reiser4/plugin/file/tail_conversion.c | 1 +

  1 file changed, 1 insertion(+)
fs/reiser4/plugin/file/tail_conversion.c +0 -0
index 7542c03..c856b73 100644
@@ -175,6 +175,7 @@ static int replace(struct inode *inode,

struct
page **pages, unsigned nr_pages,
                                  i_mapping));
          if (result)
              break;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 1 line

+        set_page_dirty_notag(pages[i]);

So, at this point the page is dirty but not uptodate. I am confused with this. Why not to set the page uptodate right before setting it dirty? At this point everything has been copied already, so the page is in fact uptodate. Could you please try this?

Have you made this correction in the merged patch?
Anyway, could you
please explain why it should be done one way and not another? What will happen if the ordering is left as is?

Is it about marking page uptodate _before unlocking_, so that no one will see it dirty && !uptodate?

Thanks,

Signature · 1 line
Ivan Shapovalov / intelfx /
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

          unlock_page(pages[i]);
          result = find_or_create_extent(pages[i]); if (result) {

#10 lore raw

Re: [PATCHv2 3/3] reiser4: mark pages created during tail2extent conversion as dirty.

Quoted 55 lines · Ivan Shapovalov
Quoted 7 lines · Edward Shishkin
Quoted 6 lines · Edward Shishkin
Quoted 3 lines · Edward Shishkin
Quoted 2 lines · Ivan Shapovalov

This is responsible for an oops in v4.2 in write_jnodes_to_disk_extent() -> set_page_writeback().

Quoted 7 lines
Quoted 2 lines

As to me, this patch doesn't prevent the oops,
so someone else forgets to set pages dirty...

False alarm: I applied to the old stuff..
Everything woks without the hack in
write_jnodes_to_disk_extent().
Good work! Merged to reiser4-for-4.2.3.

Hi Edward,

Glad to hear that. I was already halfway recovering my debug patches for collecting stacktraces and related information and was going to ask you to reproduce :)

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines

The pages needs to be marked dirty before marked writeback.

From a similar problem in f2fs:
"The cgroup attaches inode->i_wb via mark_inode_dirty and when set_page_writeback is called, __inc_wb_stat() updates i_wb's stat.

So, we need to explicitly call set_page_dirty-

Quoted 1 line

__mark_inode_dirty in

prior to any writebacking pages."

---
   fs/reiser4/plugin/file/tail_conversion.c | 1 +
   1 file changed, 1 insertion(+)
fs/reiser4/plugin/file/tail_conversion.c +0 -0
index 7542c03..c856b73 100644
@@ -175,6 +175,7 @@ static int replace(struct inode *inode,

struct
page **pages, unsigned nr_pages,

                                   i_mapping));
           if (result)
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 2 lines
               break;

+ set_page_dirty_notag(pages[i]);

So, at this point the page is dirty but not uptodate. I am confused with this. Why not to set the page uptodate right before setting it dirty? At this point everything has been copied already, so the page is in fact uptodate. Could you please try this?

Quoted 1 line

Have you made this correction in the merged patch?

Yes I have.

Quoted 5 lines

Anyway, could you
please explain why it should be done one way and not another? What will happen if the ordering is left as is?

Is it about marking page uptodate _before unlocking_, so that no one will see it dirty && !uptodate?

Just let's set all the flags in timely fashion.
Otherwise it would mean a bad style.

Thanks,
Edward.

#11 lore raw
In reply to Ivan Shapovalov
Quoted 2 lines · Ivan Shapovalov

These are the fixes for issues I've discovered during migration to 4.2. Last one is a real issue causing a reproducible oops in my

configuration,

Quoted 7 lines

first two are byproducts.

v2: The 3/3 is now a real fix instead of a blind duct-tape fixup.

Ivan Shapovalov (3):
reiser4: remove last traces of JNODE_NEW in the debugging code.
reiser4: call account_page_redirty() on re-dirtying pages before

giving

Quoted 7 lines

them to entd.
reiser4: mark pages created during tail2extent conversion as dirty.

 fs/reiser4/entd.c                        | 1 +
 fs/reiser4/jnode.c                       | 3 +--
 fs/reiser4/plugin/file/tail_conversion.c | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)

#

Question.
Are these included in reiser4-for-4.3.0.patch ?
If not, can they be included in next patchset ?

--Glenn