Skip to contentSkip to conversation

EXT4 regression caused 4eec7

DISCUSSION EUNBONG SONG 5 participants 12 messages May 12, 2013 – May 13, 2013

lore
Share & tools
lore
#0 lore raw
Quoted 10 lines
Quoted 7 lines

Since at this point it's safer to rollback the change and we can investigate more deeply how to fix it correctly for the next development cycle, this is the patch which I'm testing.

- Ted

Hello, I've tested with your patch. But the same problem was reproduced. Currently, I'm trying to git bisect. If i done git bisect, i will let you know.

Hi, I've done git bisect. and panic at jbd2_journal_put_journal_head() is caused by ae4647fb7654676fc44a97e86eb35f9f06b99f66: "jbd2: reduce journal_head size." I write just code patch which revert ae4647fb7654676fc44a97e86eb35f9f06b99f66 because I don't know the root cause.

---
 include/linux/journal-head.h |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
include/linux/journal-head.h +9 -2
index 13a3da2..c18b46f 100644
@@ -31,14 +31,21 @@ struct journal_head {
 	/*
 	 * Journalling list for this buffer [jbd_lock_bh_state()]
 	 */
-	unsigned b_jlist:4;
+	unsigned b_jlist;
 
 	/*
 	 * This flag signals the buffer has been modified by
 	 * the currently running transaction
 	 * [jbd_lock_bh_state()]
 	 */
-	unsigned b_modified:1;
+	unsigned b_modified;
+
+	/*
+	 * This feild tracks the last transaction id in which this buffer
+	 * has been cowed
+	 * [jbd_lock_bh_state()]
+	 */
+	tid_t b_cow_tid;
 
 	/*
 	 * Copy of the buffer data frozen for writing to the log.
Signature · 4 lines
1.7.0.4


Thanks. 
#1 lore raw
Quoted 6 lines · EUNBONG SONG
Quoted 5 lines
Quoted 5 lines

Since at this point it's safer to rollback the change and we can investigate more deeply how to fix it correctly for the next development cycle, this is the patch which I'm testing.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

- Ted

Hello, I've tested with your patch. But the same problem was reproduced. Currently, I'm trying to git bisect. If i done git bisect, i will let you know.

Hi, I've done git bisect. and panic at jbd2_journal_put_journal_head() is caused by ae4647fb7654676fc44a97e86eb35f9f06b99f66: "jbd2: reduce journal_head size."

OK that explains both regressions ext4/jbd2 and ext3/jbd(https://lkml.org/lkml/2013/5/10/434) Probably some race because b_jlist accessed w/o lock some places.
BUT i still can not reproduce original issue :(
I've tried all types of disks near me (ssd,hdd,usb-dongle),
What disk type you use? Is it reproducible on x86?
Please post following info:
#fdisk -l $HDD
#hdparm -t $HDD
#df -h
#cat /proc/mounts

Quoted 42 lines

I write just code patch which revert ae4647fb7654676fc44a97e86eb35f9f06b99f66 because I don't know the root cause.

---
 include/linux/journal-head.h |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
include/linux/journal-head.h +9 -2
index 13a3da2..c18b46f 100644
@@ -31,14 +31,21 @@ struct journal_head {
 	/*
 	 * Journalling list for this buffer [jbd_lock_bh_state()]
 	 */
-	unsigned b_jlist:4;
+	unsigned b_jlist;
 
 	/*
 	 * This flag signals the buffer has been modified by
 	 * the currently running transaction
 	 * [jbd_lock_bh_state()]
 	 */
-	unsigned b_modified:1;
+	unsigned b_modified;
+
+	/*
+	 * This feild tracks the last transaction id in which this buffer
+	 * has been cowed
+	 * [jbd_lock_bh_state()]
+	 */
+	tid_t b_cow_tid;
 
 	/*
 	 * Copy of the buffer data frozen for writing to the log.
Signature · 4 lines
1.7.0.4


Thanks. N‹㎠咽r›y鉉šbXФ푤v^–)頻{.n+‰램Š{‘喩zX㎍›●}ž꼿z&j:+v‰㉭‘喩zZ+€+zf"hšˆ~††i鎬zwⅱ?™②&)刪f”^j푹ym…@Aa뛴0띠h’i
#2 lore raw
In reply to EUNBONG SONG
Quoted 8 lines · EUNBONG SONG
Quoted 7 lines
Quoted 7 lines

Since at this point it's safer to rollback the change and we can investigate more deeply how to fix it correctly for the next development cycle, this is the patch which I'm testing.

- Ted

Quoted 7 lines
Quoted 2 lines

Hello, I've tested with your patch. But the same problem was reproduced. Currently, I'm trying to git bisect. If i done git bisect, i will let you know.

Hi, I've done git bisect. and panic at jbd2_journal_put_journal_head() is caused by ae4647fb7654676fc44a97e86eb35f9f06b99f66: "jbd2: reduce journal_head size." I write just code patch which revert ae4647fb7654676fc44a97e86eb35f9f06b99f66 because I don't know the root cause.

This is really strange. I've verified the code and all the places
modifying b_jlist or b_modified are holding bh_state lock so we should be safe...

Hum, but I remember I was debugging similar problems with bit fields in btrfs on ia64 as well (see http://lwn.net/Articles/478657/). So I think what has happened is that your compiler compiled bitfield access as 64-bit and updates to b_jcount and b_jlist / b_modified crashed into one another. I didn't hit it because my compiler was not so "clever".

Grumble. In this case I think bitfields are not worth the trouble with gcc. It's a pitty we have to spend additional 8 bytes for every journal_head but we'll survive... I'll send Ted a partial revert and add a comment so that we won't repeat this mistake in future.

Honza

Quoted 38 lines
---
 include/linux/journal-head.h |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
include/linux/journal-head.h +9 -2
index 13a3da2..c18b46f 100644
@@ -31,14 +31,21 @@ struct journal_head {
 	/*
 	 * Journalling list for this buffer [jbd_lock_bh_state()]
 	 */
-	unsigned b_jlist:4;
+	unsigned b_jlist;
 
 	/*
 	 * This flag signals the buffer has been modified by
 	 * the currently running transaction
 	 * [jbd_lock_bh_state()]
 	 */
-	unsigned b_modified:1;
+	unsigned b_modified;
+
+	/*
+	 * This feild tracks the last transaction id in which this buffer
+	 * has been cowed
+	 * [jbd_lock_bh_state()]
+	 */
+	tid_t b_cow_tid;
 
 	/*
 	 * Copy of the buffer data frozen for writing to the log.
Signature · 4 lines
1.7.0.4


Thanks. 
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#3 lore raw
Quoted 4 lines · Jan Kara

Grumble. In this case I think bitfields are not worth the trouble with gcc. It's a pitty we have to spend additional 8 bytes for every journal_head but we'll survive... I'll send Ted a partial revert and add a comment so that we won't repeat this mistake in future.

Or just switch things to use explicit 32-bit boolean operations. Sounds the safest way to go is to simply not trust bitfields to be something gcc is competent to compile correctly, and just open code it in standard C. (Large portions of ext4 and e2fsprogs do this manually, for historical reasons, and it sounds like we have a good reason to do it going forward.)

Jan, Dmitry --- I still have in my tree a revert for commit 4eec708d2:
ext4: use io_end for multiple bios, since I belive Dmitry still bisected a regression for xfstests 299. Dmitry, can you confirm that you are definitely seeing a regression here? Jan, do you mind if we try to figure out how to fix this during the next development cycle, since it was part of your much longer, extensive patch series anyway?

I've determined that the reason why I didn't see a problem was because xfstests 299 was failing earlier on the baseline, and crashing my regression tests. So I simply commented it out just so I could complete the testing. It seems that xfstests 299 is problematic for me, and I need to focus on how to make it pass successfully. (Dmitry, when I revert the commit which you identified, xfstests 299 is *still* failing for me....)

- Ted

#4 lore raw
Quoted 6 lines · Ted Tso
Quoted 4 lines · Jan Kara

Grumble. In this case I think bitfields are not worth the trouble with gcc. It's a pitty we have to spend additional 8 bytes for every journal_head but we'll survive... I'll send Ted a partial revert and add a comment so that we won't repeat this mistake in future.

Quoted 6 lines

Or just switch things to use explicit 32-bit boolean operations. Sounds the safest way to go is to simply not trust bitfields to be something gcc is competent to compile correctly, and just open code it in standard C. (Large portions of ext4 and e2fsprogs do this manually, for historical reasons, and it sounds like we have a good reason to do it going forward.)

Yeah, but in this case b_jlist testing / setting would require accessor
functions which is slightly ugly. For now I just submitted a revert of the bitfield part and if someone feels like saving 8 bytes in struct journal_head is worth the hassle, then we can later go that route.

Quoted 6 lines

Jan, Dmitry --- I still have in my tree a revert for commit 4eec708d2:
ext4: use io_end for multiple bios, since I belive Dmitry still bisected a regression for xfstests 299. Dmitry, can you confirm that you are definitely seeing a regression here? Jan, do you mind if we try to figure out how to fix this during the next development cycle, since it was part of your much longer, extensive patch series anyway?

Yeah, for now just send a revert to Linus. I'll look into that failure
now but since I didn't hit the problem in my testing it may take a while.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#9 lore raw
In reply to Jan Kara
Quoted 12 lines · Jan Kara
Quoted 11 lines · EUNBONG SONG
Quoted 10 lines
Quoted 7 lines

Since at this point it's safer to rollback the change and we can investigate more deeply how to fix it correctly for the next development cycle, this is the patch which I'm testing.

- Ted

Hello, I've tested with your patch. But the same problem was reproduced. Currently, I'm trying to git bisect. If i done git bisect, i will let you know.

Quoted 7 lines
Quoted 4 lines

Hi, I've done git bisect. and panic at jbd2_journal_put_journal_head() is caused by ae4647fb7654676fc44a97e86eb35f9f06b99f66: "jbd2: reduce journal_head size." I write just code patch which revert ae4647fb7654676fc44a97e86eb35f9f06b99f66 because I don't know the root cause.

This is really strange. I've verified the code and all the places
modifying b_jlist or b_modified are holding bh_state lock so we should be safe...

Hi Jan,

Could you please take a look at this mail [1]. I don't think we hold bh_state lock there.

1. http://www.spinics.net/lists/linux-ext4/msg38205.html

Thanks,
- Zheng

#5 lore raw
In reply to Theodore Ts'o
Quoted 13 lines · Theodore Ts'o
Quoted 4 lines · Jan Kara

Grumble. In this case I think bitfields are not worth the trouble with gcc. It's a pitty we have to spend additional 8 bytes for every journal_head but we'll survive... I'll send Ted a partial revert and add a comment so that we won't repeat this mistake in future.

Or just switch things to use explicit 32-bit boolean operations. Sounds the safest way to go is to simply not trust bitfields to be something gcc is competent to compile correctly, and just open code it in standard C. (Large portions of ext4 and e2fsprogs do this manually, for historical reasons, and it sounds like we have a good reason to do it going forward.)

Quoted 4 lines

Jan, Dmitry --- I still have in my tree a revert for commit 4eec708d2:
ext4: use io_end for multiple bios, since I belive Dmitry still bisected a regression for xfstests 299. Dmitry, can you confirm that you are definitely seeing a regression here?

Yes, this patch provoke use-after-free which detected by slab sanity checks.

Quoted 11 lines

Jan, do you mind if we
try to figure out how to fix this during the next development cycle, since it was part of your much longer, extensive patch series anyway?

I've determined that the reason why I didn't see a problem was because xfstests 299 was failing earlier on the baseline, and crashing my regression tests. So I simply commented it out just so I could complete the testing. It seems that xfstests 299 is problematic for me, and I need to focus on how to make it pass successfully. (Dmitry, when I revert the commit which you identified, xfstests 299 is *still* failing for me....)

In fact generic/299 always succeed for me, but it produce warning

WARNING: at fs/ext4/inode.c:3218 ext4_ext_direct_IO

and complains from slab debug. But it was missed because i've missed this error in the logs and forget to check /proc/sys/kernel/tained.

Quoted 7 lines

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

#6 lore raw
Quoted 4 lines · Dmitry Monakhov

In fact generic/299 always succeed for me, but it produce warning

WARNING: at fs/ext4/inode.c:3218 ext4_ext_direct_IO

and complains from slab debug. But it was missed because i've missed this error in the logs and forget to check /proc/sys/kernel/tained.

This is how it's failing for me....

generic/299 [23:06:27][ 109.243220] fio (3376) used greatest stack depth: 5240 bytes left

[  109.252757] fio (3380) used greatest stack depth: 5140 bytes left
[  109.307227] fio (3374) used greatest stack depth: 4944 bytes left
 [23:08:10] [failed, exit status 1] - output mismatch (see /root/xfstests/results/generic/299.out.bad)
    --- tests/generic/299.out	2013-04-05 21:41:17.000000000 -0400
    +++ /root/xfstests/results/generic/299.out.bad	2013-05-11 23:08:10.835356876 -0400
    @@ -3,3 +3,6 @@
     Run fio with random aio-dio pattern

Start fallocate/truncate loop
+./common/rc: line 2055: 3335 Segmentation fault "$@" >> $seqres.full 2>&1
+failed: '/root/xfstests/bin/fio /tmp/3135-299.fio'
+(see /root/xfstests/results/generic/299.full for details)
...
(Run 'diff -u tests/generic/299.out /root/xfstests/results/generic/299.out.bad' to see the entire diff)

I haven't had a chance to investigate the core dump yet....

- Ted

#7 lore raw
Quoted 7 lines · Theodore Ts'o
Quoted 4 lines · Dmitry Monakhov

In fact generic/299 always succeed for me, but it produce warning

WARNING: at fs/ext4/inode.c:3218 ext4_ext_direct_IO

and complains from slab debug. But it was missed because i've missed this error in the logs and forget to check /proc/sys/kernel/tained.

This is how it's failing for me....

Because you ask questions, but do not read answers :)
http://marc.info/?l=linux-ext4&m=136580060822252&w=2
http://marc.info/?l=linux-ext4&m=136610044500931&w=2

Quoted 24 lines

generic/299 [23:06:27][ 109.243220] fio (3376) used greatest stack depth: 5240 bytes left

[  109.252757] fio (3380) used greatest stack depth: 5140 bytes left
[  109.307227] fio (3374) used greatest stack depth: 4944 bytes left
 [23:08:10] [failed, exit status 1] - output mismatch (see /root/xfstests/results/generic/299.out.bad)
    --- tests/generic/299.out	2013-04-05 21:41:17.000000000 -0400
    +++ /root/xfstests/results/generic/299.out.bad	2013-05-11 23:08:10.835356876 -0400
    @@ -3,3 +3,6 @@
     Run fio with random aio-dio pattern

Start fallocate/truncate loop
+./common/rc: line 2055: 3335 Segmentation fault "$@" >> $seqres.full 2>&1
+failed: '/root/xfstests/bin/fio /tmp/3135-299.fio'
+(see /root/xfstests/results/generic/299.full for details)
...
(Run 'diff -u tests/generic/299.out /root/xfstests/results/generic/299.out.bad' to see the entire diff)

I haven't had a chance to investigate the core dump yet....

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

#10 lore raw
In reply to Zheng Liu
Quoted 21 lines · Zheng Liu
Quoted 12 lines · Jan Kara
Quoted 11 lines · EUNBONG SONG
Quoted 10 lines
Quoted 7 lines

Since at this point it's safer to rollback the change and we can investigate more deeply how to fix it correctly for the next development cycle, this is the patch which I'm testing.

- Ted

Hello, I've tested with your patch. But the same problem was reproduced. Currently, I'm trying to git bisect. If i done git bisect, i will let you know.

Quoted 7 lines
Quoted 4 lines

Hi, I've done git bisect. and panic at jbd2_journal_put_journal_head() is caused by ae4647fb7654676fc44a97e86eb35f9f06b99f66: "jbd2: reduce journal_head size." I write just code patch which revert ae4647fb7654676fc44a97e86eb35f9f06b99f66 because I don't know the root cause.

This is really strange. I've verified the code and all the places
modifying b_jlist or b_modified are holding bh_state lock so we should be safe...

Quoted 6 lines

Hi Jan,

Could you please take a look at this mail [1]. I don't think we hold bh_state lock there.

1. http://www.spinics.net/lists/linux-ext4/msg38205.html

I'll also reply to that thread but: Yes, we don't hold bh_state lock when
reading b_jlist in that one case (that's why I wrote 'modify' and not just 'access' in my previous email). But that's really harmless since we don't do any complex operations with b_jlist (only get & set) so we either see an old value or a new one. And that particular use is going away anyway later in my series.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#11 lore raw
Quoted 27 lines · Jan Kara
Quoted 26 lines · Zheng Liu
Quoted 12 lines · Jan Kara
Quoted 11 lines · EUNBONG SONG
Quoted 10 lines
Quoted 7 lines

Since at this point it's safer to rollback the change and we can investigate more deeply how to fix it correctly for the next development cycle, this is the patch which I'm testing.

- Ted

Hello, I've tested with your patch. But the same problem was reproduced. Currently, I'm trying to git bisect. If i done git bisect, i will let you know.

Quoted 7 lines
Quoted 4 lines

Hi, I've done git bisect. and panic at jbd2_journal_put_journal_head() is caused by ae4647fb7654676fc44a97e86eb35f9f06b99f66: "jbd2: reduce journal_head size." I write just code patch which revert ae4647fb7654676fc44a97e86eb35f9f06b99f66 because I don't know the root cause.

This is really strange. I've verified the code and all the places
modifying b_jlist or b_modified are holding bh_state lock so we should be safe...

Hi Jan,

Could you please take a look at this mail [1]. I don't think we hold bh_state lock there.

Quoted 7 lines
Quoted 1 line

1. http://www.spinics.net/lists/linux-ext4/msg38205.html

I'll also reply to that thread but: Yes, we don't hold bh_state lock when
reading b_jlist in that one case (that's why I wrote 'modify' and not just 'access' in my previous email). But that's really harmless since we don't do any complex operations with b_jlist (only get & set) so we either see an old value or a new one. And that particular use is going away anyway later in my series.

I see. Thanks for your explanation.

- Zheng