Skip to contentSkip to conversation

xfs: undo block reservation correctly in xfs_trans_reserve()

PATCH In review Eryu Guan 2 participants 4 messages Sep 6, 2016 XFS filesystem

lore
Share & tools
lore

Eryu Guan

author
#0 lore raw

PATCH 1/1 xfs: undo block reservation correctly in xfs_trans_reserve()

"blocks" should be added back to fdblocks at undo time, not taken away, i.e. the minus sign should not be used.

Fixes 0d485ada404b ("xfs: use generic percpu counters for free block counter")
---
 fs/xfs/xfs_trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_trans.c +1 -1
index 5f3d33d..011dace 100644
@@ -217,7 +217,7 @@ undo_log:
 
 undo_blocks:
 	if (blocks > 0) {
-		xfs_mod_fdblocks(tp->t_mountp, -((int64_t)blocks), rsvd);
+		xfs_mod_fdblocks(tp->t_mountp, ((int64_t)blocks), rsvd);
 		tp->t_blk_res = 0;
 	}
 
Signature · 6 lines
2.7.4

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
#1 lore raw
Quoted 2 lines · Eryu Guan

"blocks" should be added back to fdblocks at undo time, not taken away, i.e. the minus sign should not be used.

You've described the code change you made, not about the problem you hit and are fixing.

i.e. I've got no idea how you found this, or even how to identify a system that is tripping over this problem. By describing how you found it and the symptoms being displayed, I'll learn from you how to identify the problem and hence, in future, be able to identify systems that are tripping over the problem, too.

Quoted 1 line
Fixes 0d485ada404b ("xfs: use generic percpu counters for free block counter")

I really don't like this sort of "annotation". It wrongly implies the commit was broken (it wasn't) and there's no scope for stating the problem context. i.e. that the problem is a minor regression in a rarely travelled corner case that is unlikely to affect production machines in any significant way. It's better to describe things with all the relevant context:

"This is a regression introduced in commit ... and only occurs when .... "

Quoted 1 line

Not @redhat?

Quoted 9 lines
---
 fs/xfs/xfs_trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_trans.c +0 -0
index 5f3d33d..011dace 100644

fs/xfs/xfs_trans.c undo_log: · line 220

Quoted 5 lines
fs/xfs/xfs_trans.c +1 -1
@@ -217,7 +217,7 @@ undo_log:
 
 undo_blocks:
 	if (blocks > 0) {
-		xfs_mod_fdblocks(tp->t_mountp, -((int64_t)blocks), rsvd);
+		xfs_mod_fdblocks(tp->t_mountp, ((int64_t)blocks), rsvd);

Outer () can be dropped, too.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
author
#2 lore raw
Quoted 4 lines · Dave Chinner
Quoted 2 lines · Eryu Guan

"blocks" should be added back to fdblocks at undo time, not taken away, i.e. the minus sign should not be used.

Quoted 8 lines

You've described the code change you made, not about the problem you hit and are fixing.

i.e. I've got no idea how you found this, or even how to identify a system that is tripping over this problem. By describing how you found it and the symptoms being displayed, I'll learn from you how to identify the problem and hence, in future, be able to identify systems that are tripping over the problem, too.

Usually I will describe the symptoms, how I hit the problem and the reproducer in commit log in details, but this time I found this bug by code inspection, I don't have these information. I should have mentioned this info too.

Quoted 10 lines
Quoted 2 lines
Fixes 0d485ada404b ("xfs: use generic percpu counters for free block counter")

I really don't like this sort of "annotation". It wrongly implies the commit was broken (it wasn't) and there's no scope for stating the problem context. i.e. that the problem is a minor regression in a rarely travelled corner case that is unlikely to affect production machines in any significant way. It's better to describe things with all the relevant context:

Quoted 2 lines

"This is a regression introduced in commit ... and only occurs when .... "

Makes sense, will do so.

Quoted 4 lines
Quoted 2 lines

Not @redhat?

I thought that I'm employed by Red Hat as a QE not a filesystem developer, all filesystem patches I send reflect my own opinions not my employer's, so all silly mistakes I made in the patches are under my personal email too :)

Quoted 11 lines
Quoted 11 lines
---
 fs/xfs/xfs_trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_trans.c +0 -0
index 5f3d33d..011dace 100644
@@ -217,7 +217,7 @@ undo_log:
 
Quoted 6 lines

fs/xfs/xfs_trans.c undo_log: · line 220

Quoted 4 lines
fs/xfs/xfs_trans.c +1 -1
 undo_blocks:
 	if (blocks > 0) {
-		xfs_mod_fdblocks(tp->t_mountp, -((int64_t)blocks), rsvd);
+		xfs_mod_fdblocks(tp->t_mountp, ((int64_t)blocks), rsvd);

Outer () can be dropped, too.

OK.

Thanks for the review!

Eryu

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs

#3 lore raw
Quoted 17 lines · Eryu Guan
Quoted 10 lines · Dave Chinner
Quoted 1 line · Eryu Guan
Fixes 0d485ada404b ("xfs: use generic percpu counters for free block counter")

I really don't like this sort of "annotation". It wrongly implies the commit was broken (it wasn't) and there's no scope for stating the problem context. i.e. that the problem is a minor regression in a rarely travelled corner case that is unlikely to affect production machines in any significant way. It's better to describe things with all the relevant context:

Quoted 2 lines

"This is a regression introduced in commit ... and only occurs when .... "

Makes sense, will do so.

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

Not @redhat?

I thought that I'm employed by Red Hat as a QE not a filesystem developer, all filesystem patches I send reflect my own opinions not my employer's, so all silly mistakes I made in the patches are under my personal email too :)

Copyright assignments rarely work like that. It's a big grey area, though, so I think you should check with your legal department as to what you should use here.

Cheers,

Dave.

Signature · 7 lines
Dave Chinner
[email protected]

_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs