linux + o_direct + stream backup = broken?
| Affects | Status | Importance | Assigned to | Milestone | |
|---|---|---|---|---|---|
| | Percona XtraBackup |
High
|
Alexey Kopytov | ||
Bug Description
I'm running mysql-5.0.90, xtrabackup 1.2, and have the following two options set relating to innodb flushing:
innodb_
innodb_
Every time we run a (streaming) backup, we see many instances of
[170371.562926] ------------[ cut here ]------------
[170371.562930] WARNING: at fs/xfs/
[170371.562931] Hardware name: PowerEdge R710
[170371.562932] Modules linked in: cifs iTCO_wdt iTCO_vendor_support
[170371.562936] Pid: 4322, comm: mysqld Tainted: G W 2.6.33-gentoo-r2 #1
[170371.562937] Call Trace:
[170371.562940] [<ffffffff8120d
[170371.562943] [<ffffffff81038
[170371.562945] [<ffffffff81038
[170371.562947] [<ffffffff8120d
[170371.562950] [<ffffffff81034
[170371.562953] [<ffffffff8120a
[170371.562955] [<ffffffff810d7
[170371.562959] [<ffffffff810d8
[170371.562962] [<ffffffff810d8
[170371.562966] [<ffffffff81002
[170371.562969] ---[ end trace 915525cd726ee99f ]---
in the logs.
The XFS guys say that this is a warning about bad O_DIRECT + not O_DIRECT interactions:
http://
Also, we had a filesystem hang, which was suggested to have been caused by this same problem:
http://
Basically they claim that xtrabackup/tar4ibd is doing something that can break on any linux filesystem. Perhaps tar4ibd isn't using O_DIRECT when it should be? [Or it could be xtrabackup, but the warnings never reference the xtrabackup program directly, and it wasn't in the list of stuck tasks in the hang, hence my conclusion that it's tar4ibd]
Related branches
- Vadim Tkachenko: Approve on 2011-02-24
-
Diff: 12 lines (+1/-1)1 file modifiedxtrabackup.c (+1/-1)
| Changed in percona-xtrabackup: | |
| assignee: | nobody → Yasufumi Kinoshita (yasufumi-kinoshita) |
| Andrew Platts (notwellknown) wrote : | #1 |
| Peter Zaitsev (pz-percona) wrote : Re: [Bug 606981] Re: linux + o_direct + stream backup = broken? | #2 |
Andrew,
Does it cause any problems for you (like crash) ? From the trace it looks
like it is warning on "slowpath"
I'm sure it does not look nice and it would be great if XFS guys fix it.
If it can cause kernel crash
it is even more issue as this means plain user could crash server by opening
same file with O_DIRECT and without
and stressing it with IO.
On Thu, Jul 29, 2010 at 4:33 PM, Andrew Platts <email address hidden>wrote:
> We also experience this bug
>
> Also using O_DIRECT with innodb_
>
> With the following command
> innobackupex-1.5.1 --slave-info --stream=tar . 2>
> /tmp/$source.
>
> Sample output from /var/log/messages
>
>
> [6896419.396214] ------------[ cut here ]------------
> [6896419.396214] WARNING: at fs/xfs/
> xfs_write+
> [6896419.396214] Modules linked in: ipv6 xfs loop snd_pcm snd_timer snd
> soundcore snd_page_alloc i2c_i801 psmouse pcspkr i2c_core serio_raw button
> joydev evdev ext3 jbd mbcache dm_mirror dm_log dm_snapshot dm_mod raid1
> raid0 md_mod sd_mod sg sr_mod cdrom usbhid hid ff_memless mptsas mptscsih
> mptbase ahci scsi_transport_sas libata scsi_mod dock ehci_hcd uhci_hcd igb
> thermal processor fan thermal_sys [last unloaded: scsi_wait_scan]
> [6896419.396214] Pid: 6909, comm: mysqld Tainted: G W 2.6.26-2-amd64
> #1
> [6896419.396214]
> [6896419.396214] Call Trace:
> [6896419.396214] [<ffffffff80234
> [6896419.396214] [<ffffffff80231
> [6896419.396214] [<ffffffff8022c
> [6896419.396214] [<ffffffff8031e
> [6896419.396214] [<ffffffffa022e
> [6896419.396214] [<ffffffffa0252
> [6896419.396214] [<ffffffff80248
> [6896419.396223] [<ffffffff8029a
> [6896419.396231] [<ffffffff80246
> [6896419.396236] [<ffffffff8029b
> [6896419.396236] [<ffffffff8029c
> [6896419.396236] [<ffffffff8029b
> [6896419.396236] [<ffffffff8020c
> [6896419.396236] [<ffffffff8020b
> [6896419.396236]
>
> --
> linux + o_direct + stream backup = broken?
> https:/
> You received this bug notification because you are a member of Percona
> developers, which is the registrant for Percona-XtraBackup.
>
> Status in Open source backup tool for InnoDB and XtraDB: New
>
> Bug description:
> I'm running mysql-5.0.90, xtrabackup 1.2, and have the following two
> options set relating to innodb flushing:
>
> innodb_
> innodb_
>
> Every time we run a (streaming) backup, we see many instances of
>
> [170371.562926] ------------[ cut here ]------------
> [170371.562930] WARNING: at fs/xfs/
> xfs_write+
> [170371.562931] Hardware name: PowerEdge R710
> [170371.56293...
| Andrew Platts (notwellknown) wrote : | #3 |
Well,
what we see is the slave lag exceeds our threshold during backups (causing MMM to take action) . So I believe we're getting a filesystem hang as the first bug reporter mentioned. This happens just prior to the call trace. Also very simple PK queries start taking over 30 secs.
This is debian 5.0.4 with xfs (Linux 2.6.26-2-amd64 #1 SMP Wed May 12 18:03:14 UTC 2010 x86_64 GNU/Linux)
I see from the link below that this is not something the file system guys think is their problem
http://
Dave Chinner says :
"Right now I'm not particularly inclined to dig into this further;
it's obvious the applications are doing something that is not
supported (by XFS or the generic page cache code), so this is the
first thing you really need to care about getting fixed if you value
your backups..."
The alternative right now for us might be to turn O_DIRECT off - we're using SSDs , not sure if O_DIRECT will have a hugh impact in this case ...
| Peter Zaitsev (pz-percona) wrote : | #4 |
Andrew,
Thanks. This is helpful information.
As I understand the XFS guys would rather get some test case which may be
helpful
We also should see what can be done with Xtrabackup so it uses DIRECT_IO for
copy
so things are consistent.
On Thu, Jul 29, 2010 at 5:52 PM, Andrew Platts <email address hidden>wrote:
> Well,
>
> what we see is the slave lag exceeds our threshold during backups
> (causing MMM to take action) . So I believe we're getting a
> filesystem hang as the first bug reporter mentioned. This happens
> just prior to the call trace. Also very simple PK queries start
> taking over 30 secs.
>
> This is debian 5.0.4 with xfs (Linux 2.6.26-2-amd64 #1 SMP Wed May 12
> 18:03:14 UTC 2010 x86_64 GNU/Linux)
>
> I see from the link below that this is not something the file
> system guys think is their problem
>
> http://
>
>
> Dave Chinner says :
> "Right now I'm not particularly inclined to dig into this further;
> it's obvious the applications are doing something that is not
> supported (by XFS or the generic page cache code), so this is the
> first thing you really need to care about getting fixed if you value
> your backups..."
>
> The alternative right now for us might be to turn O_DIRECT off - we're
> using SSDs , not sure if O_DIRECT will have a hugh impact in this case
> ...
>
> --
> linux + o_direct + stream backup = broken?
> https:/
> You received this bug notification because you are a member of Percona
> developers, which is the registrant for Percona-XtraBackup.
>
> Status in Open source backup tool for InnoDB and XtraDB: New
>
> Bug description:
> I'm running mysql-5.0.90, xtrabackup 1.2, and have the following two
> options set relating to innodb flushing:
>
> innodb_
> innodb_
>
> Every time we run a (streaming) backup, we see many instances of
>
> [170371.562926] ------------[ cut here ]------------
> [170371.562930] WARNING: at fs/xfs/
> xfs_write+
> [170371.562931] Hardware name: PowerEdge R710
> [170371.562932] Modules linked in: cifs iTCO_wdt iTCO_vendor_support
> [170371.562936] Pid: 4322, comm: mysqld Tainted: G W
> 2.6.33-gentoo-r2 #1
> [170371.562937] Call Trace:
> [170371.562940] [<ffffffff8120d
> [170371.562943] [<ffffffff81038
> [170371.562945] [<ffffffff81038
> [170371.562947] [<ffffffff8120d
> [170371.562950] [<ffffffff81034
> [170371.562953] [<ffffffff8120a
> [170371.562955] [<ffffffff810d7
> [170371.562959] [<ffffffff810d8
> [170371.562962] [<ffffffff810d8
> [170371.562966] [<ffffffff81002
> [170371.562969] ---[ end trace 915525cd726ee99f ]---
>
> in the logs.
>
> The XFS guys say that this is a warning about bad O_DIRECT + not O_DIRECT
> interactions:
>
> http://
| Jeremy Cole (jeremycole) wrote : | #5 |
We've also been seeing this exact same "BUG" message logged. After some hair pulling we were able to track it down to xtrabackup with --stream=tar mode. I think the tar-streaming mode is fundamentally broken due to this. Maybe it was the original cause of the corruption complaints which triggered the creation of tar4ibd as well? Mixing of direct (InnoDB) and buffered (tar) IO is always dangerous.
Peter: How hard would it be to add support to tar4ibd to use O_DIRECT if InnoDB is configured for it (which you already know from the rest of the configuration). It seems like this would be the best solution, and I don't think it would require much work.
| Peter Zaitsev (pz-percona) wrote : | #6 |
Jeremy,
Yes I think this is what we should look into doing. I also do not think it
will be hard work.
We want to work around this issue on our side - absolutely but It is also
good if this problem is fixed on XFS
side... as it is general issue which can be triggered by other apps.
On Fri, Jul 30, 2010 at 6:58 PM, Jeremy Cole <email address hidden>wrote:
> We've also been seeing this exact same "BUG" message logged. After some
> hair pulling we were able to track it down to xtrabackup with
> --stream=tar mode. I think the tar-streaming mode is fundamentally
> broken due to this. Maybe it was the original cause of the corruption
> complaints which triggered the creation of tar4ibd as well? Mixing of
> direct (InnoDB) and buffered (tar) IO is always dangerous.
>
> Peter: How hard would it be to add support to tar4ibd to use O_DIRECT if
> InnoDB is configured for it (which you already know from the rest of the
> configuration). It seems like this would be the best solution, and I
> don't think it would require much work.
>
> --
> linux + o_direct + stream backup = broken?
> https:/
> You received this bug notification because you are a member of Percona
> developers, which is the registrant for Percona-XtraBackup.
>
> Status in Open source backup tool for InnoDB and XtraDB: New
>
> Bug description:
> I'm running mysql-5.0.90, xtrabackup 1.2, and have the following two
> options set relating to innodb flushing:
>
> innodb_
> innodb_
>
> Every time we run a (streaming) backup, we see many instances of
>
> [170371.562926] ------------[ cut here ]------------
> [170371.562930] WARNING: at fs/xfs/
> xfs_write+
> [170371.562931] Hardware name: PowerEdge R710
> [170371.562932] Modules linked in: cifs iTCO_wdt iTCO_vendor_support
> [170371.562936] Pid: 4322, comm: mysqld Tainted: G W
> 2.6.33-gentoo-r2 #1
> [170371.562937] Call Trace:
> [170371.562940] [<ffffffff8120d
> [170371.562943] [<ffffffff81038
> [170371.562945] [<ffffffff81038
> [170371.562947] [<ffffffff8120d
> [170371.562950] [<ffffffff81034
> [170371.562953] [<ffffffff8120a
> [170371.562955] [<ffffffff810d7
> [170371.562959] [<ffffffff810d8
> [170371.562962] [<ffffffff810d8
> [170371.562966] [<ffffffff81002
> [170371.562969] ---[ end trace 915525cd726ee99f ]---
>
> in the logs.
>
> The XFS guys say that this is a warning about bad O_DIRECT + not O_DIRECT
> interactions:
>
> http://
> seeing the same warning, but I joined in later]
>
> Also, we had a filesystem hang, which was suggested to have been caused by
> this same problem:
>
> http://
>
> Basically they claim that xtrabackup/tar4ibd is doing something that can
> break on any linux filesy...
| Ilia Mirkin (imirkin) wrote : | #7 |
I'm pretty sure that all the XFS devs are in agreement that fixing the hang is something that needs to be done. I brought up removing the warning earlier on LKML, and at least Dave Chinner's position was that it was best left in. [Not sure if Andrew Platts's warning is the same as mine, as it comes from a considerably older kernel.]
However the claim that the XFS devs make is that mixing mysqld's O_DIRECT and the mechanism that tar4ibd uses to read the files in will result in inconsistent data being read in for any filesystem (and also exacerbates the XFS problem).
| Peter Zaitsev (pz-percona) wrote : | #8 |
Ilia,
Thanks. I just have not understood this is the outcome of the discussion
on the XFS developers list. We will see to change tar4ibd to use same
IO mode as the MySQL running on files which is probably right solution
What is about in consistence - what kind of inconsistency one would observe
in this case ? Xtrabackup in general should be rather tolerant to it
(re-reading on bad
checksums)
On Sun, Aug 1, 2010 at 11:00 PM, Ilia Mirkin <email address hidden>wrote:
> I'm pretty sure that all the XFS devs are in agreement that fixing the
> hang is something that needs to be done. I brought up removing the
> warning earlier on LKML, and at least Dave Chinner's position was that
> it was best left in. [Not sure if Andrew Platts's warning is the same as
> mine, as it comes from a considerably older kernel.]
>
> However the claim that the XFS devs make is that mixing mysqld's
> O_DIRECT and the mechanism that tar4ibd uses to read the files in will
> result in inconsistent data being read in for any filesystem (and also
> exacerbates the XFS problem).
>
> --
> linux + o_direct + stream backup = broken?
> https:/
> You received this bug notification because you are a member of Percona
> developers, which is the registrant for Percona-XtraBackup.
>
> Status in Open source backup tool for InnoDB and XtraDB: New
>
> Bug description:
> I'm running mysql-5.0.90, xtrabackup 1.2, and have the following two
> options set relating to innodb flushing:
>
> innodb_
> innodb_
>
> Every time we run a (streaming) backup, we see many instances of
>
> [170371.562926] ------------[ cut here ]------------
> [170371.562930] WARNING: at fs/xfs/
> xfs_write+
> [170371.562931] Hardware name: PowerEdge R710
> [170371.562932] Modules linked in: cifs iTCO_wdt iTCO_vendor_support
> [170371.562936] Pid: 4322, comm: mysqld Tainted: G W
> 2.6.33-gentoo-r2 #1
> [170371.562937] Call Trace:
> [170371.562940] [<ffffffff8120d
> [170371.562943] [<ffffffff81038
> [170371.562945] [<ffffffff81038
> [170371.562947] [<ffffffff8120d
> [170371.562950] [<ffffffff81034
> [170371.562953] [<ffffffff8120a
> [170371.562955] [<ffffffff810d7
> [170371.562959] [<ffffffff810d8
> [170371.562962] [<ffffffff810d8
> [170371.562966] [<ffffffff81002
> [170371.562969] ---[ end trace 915525cd726ee99f ]---
>
> in the logs.
>
> The XFS guys say that this is a warning about bad O_DIRECT + not O_DIRECT
> interactions:
>
> http://
> seeing the same warning, but I joined in later]
>
> Also, we had a filesystem hang, which was suggested to have been caused by
> this same problem:
>
> http://
>
> Basically they claim that xtrabackup/tar4ibd is doing something that ...
| Ilia Mirkin (imirkin) wrote : | #9 |
Honestly, I don't fully understand the implications myself. Dave Chinner semi-describes this at http://
| Percona (percona-team) wrote : | #10 |
not sure if there any actions needed. "Won't fix"
| Changed in percona-xtrabackup: | |
| status: | New → Won't Fix |
| Ilia Mirkin (imirkin) wrote : | #11 |
The action is to make tar4ibd read the ibd files with the same O_DIRECT'ness as the rest of the system.
Alternatively you could just mark xtrabackup to be incompatible with O_DIRECT.
The message from Dave Chinner (one of the XFS guys) is that simultaneous O_DIRECT + non-O_DIRECT access to a file on linux is disallowed (and XFS warns about it, most FS's don't). [Perhaps I can convince him to post something here as well that goes into more detail?]
| Percona (percona-team) wrote : | #12 |
ok, let's check if we can run tar4ibd with O_DIRECT
| Changed in percona-xtrabackup: | |
| assignee: | Yasufumi Kinoshita (yasufumi-kinoshita) → Alexey Kopytov (akopytov) |
| status: | Won't Fix → Confirmed |
| importance: | Undecided → Medium |
| importance: | Medium → Undecided |
| milestone: | none → 1.6 |
| Peter Zaitsev (pz-percona) wrote : | #13 |
I just wanted to highlight this seems to be going beyond warnings but causing kernel to hang for some our customers.
We will see what can be done on Xtrabackup side but it is serious security issue if one can cause kernel to hang as a unprivileged
user by mixing o_direct and non_odirect IO on the same files. It is good if we can report it as a bug to XFS team
| niyunjiu (niyunjiu) wrote : | #14 |
will it be fixed in 1.6? very good!! I hope it be fixed quickly
| Vadim Tkachenko (vadim-tk) wrote : | #15 |
Alexey,
We need to make sure that tar4ibd is run in O_DIRECT mode.
| Changed in percona-xtrabackup: | |
| importance: | Undecided → High |
| Changed in percona-xtrabackup: | |
| status: | Confirmed → In Progress |
| Changed in percona-xtrabackup: | |
| status: | In Progress → Fix Committed |
| Changed in percona-xtrabackup: | |
| status: | Fix Committed → Fix Released |

We also experience this bug
Also using O_DIRECT with innodb_ flush_log_ at_trx_ commit= 2
With the following command xtrabackup. log| gzip - | nc -vw60 $target $port
innobackupex-1.5.1 --slave-info --stream=tar . 2> /tmp/$source.
Sample output from /var/log/messages
[6896419.396214] ------------[ cut here ]------------ linux-2. 6/xfs_lrw. c:726 xfs_write+ 0x3f5/0x722 [xfs]() 930>] warn_on_ slowpath+ 0x51/0x7a 997>] check_preempt_ wakeup+ 0xc4/0xf0 157>] try_to_ wake_up+ 0x118/0x129 230>] __up_write+ 0x82/0x10e c68>] :xfs:xfs_ iunlock+ 0x42/0x7c 6cc>] :xfs:xfs_ write+0x3f5/ 0x722 3e0>] enqueue_ hrtimer+ 0xd7/0xe4 e83>] do_sync_ write+0xc9/ 0x10c 171>] autoremove_ wake_function+ 0x0/0x2e 62d>] vfs_write+ 0xad/0x156 2ee>] fget_light+ 0x4f/0x82 cb8>] sys_pwrite64+ 0x50/0x70 267>] ptregscall_ common+ 0x67/0xb0 eda>] system_ call_after_ swapgs+ 0x8a/0x8f
[6896419.396214] WARNING: at fs/xfs/
[6896419.396214] Modules linked in: ipv6 xfs loop snd_pcm snd_timer snd soundcore snd_page_alloc i2c_i801 psmouse pcspkr i2c_core serio_raw button joydev evdev ext3 jbd mbcache dm_mirror dm_log dm_snapshot dm_mod raid1 raid0 md_mod sd_mod sg sr_mod cdrom usbhid hid ff_memless mptsas mptscsih mptbase ahci scsi_transport_sas libata scsi_mod dock ehci_hcd uhci_hcd igb thermal processor fan thermal_sys [last unloaded: scsi_wait_scan]
[6896419.396214] Pid: 6909, comm: mysqld Tainted: G W 2.6.26-2-amd64 #1
[6896419.396214]
[6896419.396214] Call Trace:
[6896419.396214] [<ffffffff80234
[6896419.396214] [<ffffffff80231
[6896419.396214] [<ffffffff8022c
[6896419.396214] [<ffffffff8031e
[6896419.396214] [<ffffffffa022e
[6896419.396214] [<ffffffffa0252
[6896419.396214] [<ffffffff80248
[6896419.396223] [<ffffffff8029a
[6896419.396231] [<ffffffff80246
[6896419.396236] [<ffffffff8029b
[6896419.396236] [<ffffffff8029c
[6896419.396236] [<ffffffff8029b
[6896419.396236] [<ffffffff8020c
[6896419.396236] [<ffffffff8020b
[6896419.396236]