Skip to contentSkip to conversation

ext3 default journal mode

PATCH Ric Wheeler 6 participants 12 messages Jul 20, 2009 – Jul 23, 2009

lore
Share & tools
lore
#0 lore raw

Now that we have put some some distance between us and the mega-thread, I think that it is time to put some sanity back into the ext3 journal mode options.

My preference is to revert the default back to ordered mode or (if Chris is ready) back to guarded mode.

As I mentioned in an earlier email, I think *every* distribution undid this default back to ordered mode.

Do any of us who deal in file systems really think that writeback is a reasonable default for unsophisticated users or non-FS experts (like those in the embedded space) who rely on KCONFIG to get a sense of a debate that they missed?

Failing that, I would like to at very least put sane text in the KCONFIG option.

Something like the following:

fs/ext3/Kconfig +11 -8
index fb3c1a2..4057730 100644
@@ -36,16 +36,19 @@ config EXT3_DEFAULTS_TO_ORDERED
          mode, and the journal capability allowed it, ext3 used to
          historically default to 'data=ordered'.
 
-         That was a rather unfortunate choice, because it leads to all
-         kinds of latency problems, and the 'data=writeback' mode is more
-         appropriate these days.
+         Data ordered mode is the mode used by most distributions, but can
+         introduce latency problems in some workloads, especially if you have
+         a very low latency device.
 
-         You should probably always answer 'n' here, and if you really
-         want to use 'data=ordered' mode, set it in the filesystem itself
-         with 'tune2fs -o journal_data_ordered'.
+         The current default mode is data writeback mode which favors latency but
+         is more prone to corruption after crashes and power failures and will
+         expose deleted data after a crash to newly allocated files.
 
-         But if you really want to enable the legacy default, you can do
-         so by answering 'y' to this question.
+         If you have been historically happy with ext3's performance, data ordered
+         mode will be a safe choice and you should answer "y" here.
+
+         If you understand the reliability and data privacy issues of data writeback
+         mode and are willing to make that trade off, answer "n".
 
 
#1 lore raw
Quoted 7 lines · Ric Wheeler

Now that we have put some some distance between us and the mega-thread, I think that it is time to put some sanity back into the ext3 journal mode options.

My preference is to revert the default back to ordered mode or (if Chris is ready) back to guarded mode.

My plan was to get guarded into .30, but that clearly didn't happen. So, I'll resend this week and try to have it ready for .31, unless people would rather avoid the changes to the tried and true ext3.

-chris

#2 lore raw
Quoted 10 lines · Chris Mason
Quoted 7 lines · Ric Wheeler

Now that we have put some some distance between us and the mega-thread, I think that it is time to put some sanity back into the ext3 journal mode options.

My preference is to revert the default back to ordered mode or (if Chris is ready) back to guarded mode.

Quoted 6 lines

My plan was to get guarded into .30, but that clearly didn't happen. So, I'll resend this week and try to have it ready for .31, unless people would rather avoid the changes to the tried and true ext3.

-chris

I have been thinking that guarded mode might make for a full replacement for writeback mode over time - the more I think about writeback mode, the less I like letting casual users hurt themselves with it.

I would be very happy to see guarded mode get resent :-)

Any idea how many distros actually ship today with writeback mode as their default?

ric

#3 lore raw
In reply to Ric Wheeler

Here's a revised proposal for the KCONFIG text.

Hopefully this is balanced about the two sides of the issue, without explicitly advocating for one choice versus another.

What do people think?

- Ted

P.S. Note that date=writeback does not make the filesystem more "prone to corruption after crashes".

config EXT3_DEFAULTS_TO_ORDERED
bool "Default to 'data=ordered' in ext3"
depends on EXT3_FS
help
If a filesystem does not explicitly specify a data ordering mode, and the journal capability allowed it, ext3 used to historically default to 'data=ordered'.

Data=ordered mode is the mode used by most distributions, but can introduce latency problems in some workloads, especially if there is a combination of high bandwidth background writes and foreground
processes calling fsync() and waiting for the result. In worst
case scenarios, the fsync() call can 500ms to multiple seconds to return.

The problem with using a default of data=writeback, however, is that is that after a system crash or a power failure, files that were written right before the system went down could contain previously written data or other garbage. With data=ordered mode, any blocks in the file will have been data written by the application, avoiding a possibility of a security breach, which is especially problematic on a multi-user system. Note, however, that data=ordered does not guarantee that the file will be consistent at an application level; the application must use fsync() at appropriate commit points in order to guarantee application-level consistency.

If you have been historically happy with ext3's performance, data=ordered mode will be a safe choice and you should answer "y" here. If you understand the reliability and data privacy issues of data=writeback and are willing to make that trade off, answer "n".

#4 lore raw
Quoted 8 lines · Theodore Tso

Here's a revised proposal for the KCONFIG text.

Hopefully this is balanced about the two sides of the issue, without explicitly advocating for one choice versus another.

What do people think?

- Ted

Hi Ted,

I think that this is a huge improvement - thanks!

Ric

Quoted 39 lines

P.S. Note that date=writeback does not make the filesystem more "prone to corruption after crashes".

config EXT3_DEFAULTS_TO_ORDERED
bool "Default to 'data=ordered' in ext3"
depends on EXT3_FS
help
If a filesystem does not explicitly specify a data ordering mode, and the journal capability allowed it, ext3 used to historically default to 'data=ordered'.

Data=ordered mode is the mode used by most distributions, but can introduce latency problems in some workloads, especially if there
is a combination of high bandwidth background writes and foreground
processes calling fsync() and waiting for the result. In worst
case scenarios, the fsync() call can 500ms to multiple seconds to return.

The problem with using a default of data=writeback, however, is that is that after a system crash or a power failure, files that were written right before the system went down could contain previously written data or other garbage. With data=ordered mode, any blocks in the file will have been data written by the application, avoiding a possibility of a security breach, which is especially problematic on a multi-user system. Note, however, that data=ordered does not guarantee that the file will be consistent at an application level; the application must use fsync() at appropriate commit points in order to guarantee application-level consistency.

If you have been historically happy with ext3's performance,
data=ordered mode will be a safe choice and you should answer "y" here. If you understand the reliability and data privacy issues of data=writeback and are willing to make that trade off, answer "n".

#5 lore raw
In reply to Theodore Tso
Quoted 6 lines · Theodore Tso

Here's a revised proposal for the KCONFIG text.

Hopefully this is balanced about the two sides of the issue, without explicitly advocating for one choice versus another.

What do people think?

I think it's extremely accurate and detailed, but too long - people's brains turn off after about the 15th line or so. Here's an attempt to distill your description down and refer out to another document (which one?) for people who want to learn more.

(Sorry for the whitespace damage.)

-VAL

config EXT3_DEFAULTS_TO_ORDERED
bool "Default to 'data=ordered' in ext3"
depends on EXT3_FS
help

If the mount options for an ext3 filesystem do not include a journal mode, mount it in "data=ordered" mode.

The journal mode options for ext3 have different tradeoffs between when data is guaranteed to be on disk and performance. Many applications assume "data=ordered" semantics and may lose, destroy, or reveal other user's data in other journal modes. However, "data=ordered" mode can also result in major performance problems, including long delays before an fsync() call returns. For details, see:

XXX some document

Use "data=ordered" mode unless you know it is causing a performance problem for your workload.

If you are unsure, say 'Y'.

#6 lore raw
Quoted 7 lines · Valerie Aurora

I think it's extremely accurate and detailed, but too long - people's brains turn off after about the 15th line or so. Here's an attempt to distill your description down and refer out to another document (which one?) for people who want to learn more.

(Sorry for the whitespace damage.)

Review

Quoted 9 lines
(quoted diff) +0 -1
-VAL
 
 config EXT3_DEFAULTS_TO_ORDERED
 	bool "Default to 'data=ordered' in ext3"
 	depends on EXT3_FS
 	help
 
          If the mount options for an ext3 filesystem do not
          include a journal mode, mount it in "data=ordered" mode.

I would make this a bit more clear:

This option sets the default journal mode for ext3 filesystems which do not explicitly specify it in /etc/fstab or at mount time. It is always possible to set the journal mode for each filesystem independently with "data=writeback", "data=ordered", or "data=journal" mount options.

Quoted 7 lines

The journal mode options for ext3 have different tradeoffs between when data is guaranteed to be on disk and performance. Many applications assume "data=ordered" semantics and may lose, destroy, or reveal other user's data in other journal modes. However, "data=ordered" mode can also result in major performance problems, including long delays before an fsync() call returns. For details, see:

I think the "... lose, destroy, ..." part is confusing, as it mentions "data=ordered" first and it isn't until the end of the sentence that it is clear that "lose, destroy, ..." does not apply to data=ordered. Also "data=journal" also does not apply in this case, only "data=writeback" so we may as well call that out explicitly.

... Many applications do not explicitly sync data and assume "data=ordered" mode. Saying 'N' here will use "data=writeback" as the default for all ext3 filesystems, and may result in files with no data, or garbage data from deleted files, which is a security risk on a multi-user system. However, ...

Quoted 6 lines

XXX some document

Use "data=ordered" mode unless you know it is causing a performance problem for your workload.

If you are unsure, say 'Y'.

Cheers, Andreas
--
Andreas Dilger
Sr. Staff Engineer, Lustre Group
Sun Microsystems of Canada, Inc.

#7 lore raw
Quoted 40 lines · Andreas Dilger
Quoted 7 lines · Valerie Aurora

I think it's extremely accurate and detailed, but too long - people's brains turn off after about the 15th line or so. Here's an attempt to distill your description down and refer out to another document (which one?) for people who want to learn more.

(Sorry for the whitespace damage.)

Review

Quoted 9 lines
(quoted diff) +0 -1
-VAL
 
 config EXT3_DEFAULTS_TO_ORDERED
 	bool "Default to 'data=ordered' in ext3"
 	depends on EXT3_FS
 	help
 
          If the mount options for an ext3 filesystem do not
          include a journal mode, mount it in "data=ordered" mode.

I would make this a bit more clear:

This option sets the default journal mode for ext3 filesystems which do not explicitly specify it in /etc/fstab or at mount time. It is always possible to set the journal mode for each filesystem independently with "data=writeback", "data=ordered", or "data=journal" mount options.

Quoted 7 lines

The journal mode options for ext3 have different tradeoffs between when data is guaranteed to be on disk and performance. Many applications assume "data=ordered" semantics and may lose, destroy, or reveal other user's data in other journal modes. However, "data=ordered" mode can also result in major performance problems, including long delays before an fsync() call returns. For details, see:

I think the "... lose, destroy, ..." part is confusing, as it mentions "data=ordered" first and it isn't until the end of the sentence that it is clear that "lose, destroy, ..." does not apply to data=ordered. Also "data=journal" also does not apply in this case, only "data=writeback" so we may as well call that out explicitly.

Quoted 5 lines

... Many applications do not explicitly sync data and assume "data=ordered" mode. Saying 'N' here will use "data=writeback" as the default for all ext3 filesystems, and may result in files with no data, or garbage data from deleted files, which is a security risk on a multi-user system. However, ...

Good points. I think Ted's rewrite addresses most of them, what do you think?

-VAL

#8 lore raw
In reply to Valerie Aurora
Quoted 6 lines · Valerie Aurora
Quoted 5 lines · Theodore Tso

Here's a revised proposal for the KCONFIG text.

Hopefully this is balanced about the two sides of the issue, without explicitly advocating for one choice versus another.

Quoted 6 lines
Quoted 1 line

What do people think?

I think it's extremely accurate and detailed, but too long - people's brains turn off after about the 15th line or so. Here's an attempt to distill your description down and refer out to another document (which one?) for people who want to learn more.

Fair enough; I've created an external document here:

http://ext4.wiki.kernel.org/index.php/Ext3_Data%3DOrdered_vs_Data%3DWriteback_mode

Comments?

Review

Quoted 7 lines

config EXT3_DEFAULTS_TO_ORDERED

(quoted diff) +0 -0
 	bool "Default to 'data=ordered' in ext3"
 	depends on EXT3_FS
 	help
 
          If the mount options for an ext3 filesystem do not
          include a journal mode, mount it in "data=ordered" mode.

Let me give a try at this:

The journal mode options for ext3 have different tradeoffs between when data is guaranteed to be on disk and performance. The use of "data=writeback" can cause unwritten data to appear in files after an system crash or power failure, which can be a security issue. However, "data=ordered" mode can also result in major performance problems, including seconds-long delays before an fsync() call returns. For details, see:

http://ext4.wiki.kernel.org/index.php/Ext3_Data%3DOrdered_vs_Data%3DWriteback_mode

If you have been historically happy with ext3's performance, data=ordered mode will be a safe choice and you should answer "y" here. If you understand the reliability and data privacy issues of data=writeback and are willing to make that trade off, answer "n".

- Ted

#9 lore raw
Quoted 7 lines · Theodore Tso
Quoted 5 lines · Valerie Aurora

I think it's extremely accurate and detailed, but too long - people's brains turn off after about the 15th line or so. Here's an attempt to distill your description down and refer out to another document (which one?) for people who want to learn more.

Quoted 5 lines

Fair enough; I've created an external document here:

http://ext4.wiki.kernel.org/index.php/Ext3_Data%3DOrdered_vs_Data%3DWriteback_mode

Comments?

Nice!

Quoted 19 lines

Review

Quoted 7 lines

config EXT3_DEFAULTS_TO_ORDERED

(quoted diff) +0 -0
 	bool "Default to 'data=ordered' in ext3"
 	depends on EXT3_FS
 	help
 
          If the mount options for an ext3 filesystem do not
          include a journal mode, mount it in "data=ordered" mode.

Let me give a try at this:

The journal mode options for ext3 have different tradeoffs between when data is guaranteed to be on disk and performance. The use of "data=writeback" can cause unwritten data to appear in files after an system crash or power failure, which can be a security issue. However, "data=ordered" mode can also result in major performance problems, including seconds-long delays before an fsync() call returns. For details, see:

Quoted 7 lines

http://ext4.wiki.kernel.org/index.php/Ext3_Data%3DOrdered_vs_Data%3DWriteback_mode

If you have been historically happy with ext3's performance, data=ordered mode will be a safe choice and you should answer "y" here. If you understand the reliability and data privacy issues of data=writeback and are willing to make that trade off, answer "n".

This is great. Ship it!

-VAL

#10 lore raw
Quoted 47 lines · Valerie Aurora
Quoted 7 lines · Theodore Tso
Quoted 5 lines · Valerie Aurora

I think it's extremely accurate and detailed, but too long - people's brains turn off after about the 15th line or so. Here's an attempt to distill your description down and refer out to another document (which one?) for people who want to learn more.

Quoted 6 lines

Fair enough; I've created an external document here:

http://ext4.wiki.kernel.org/index.php/Ext3_Data%3DOrdered_vs_Data%3DWriteback_mode

Comments?

Nice!

Quoted 19 lines
Quoted 8 lines

config EXT3_DEFAULTS_TO_ORDERED
bool "Default to 'data=ordered' in ext3"
depends on EXT3_FS
help

If the mount options for an ext3 filesystem do not include a journal mode, mount it in "data=ordered" mode.

Let me give a try at this:

The journal mode options for ext3 have different tradeoffs between when data is guaranteed to be on disk and performance. The use of "data=writeback" can cause unwritten data to appear in files after an system crash or power failure, which can be a security issue. However, "data=ordered" mode can also result in major performance problems, including seconds-long delays before an fsync() call returns. For details, see:

Quoted 8 lines

http://ext4.wiki.kernel.org/index.php/Ext3_Data%3DOrdered_vs_Data%3DWriteback_mode

If you have been historically happy with ext3's performance, data=ordered mode will be a safe choice and you should answer "y" here. If you understand the reliability and data privacy issues of data=writeback and are willing to make that trade off, answer "n".

Quoted 4 lines

This is great. Ship it!

-VAL

I certainly agree - this is a vast improvement over what we have today, thanks!

Ric

#11 lore raw
In reply to Ric Wheeler
Quoted 3 lines · Ric Wheeler

As I mentioned in an earlier email, I think *every* distribution undid this default back to ordered mode.

I would agree too that the default should be changed again.

Shortly after the default was changed to writeback
I had a (unrelated crash) and afterwards had to fix up several files in the file system manually that contained junk. Never has happened before with ordered.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.