]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix skipped error handle when log sync failed
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 20 Feb 2014 10:08:58 +0000 (18:08 +0800)
committerJosef Bacik <jbacik@fb.com>
Mon, 10 Mar 2014 19:16:43 +0000 (15:16 -0400)
commit71b1de9c92cf2718cb65da14363d848bd2cd7741
tree3e756c4aeefc74fafa7db71293e92dac20832ed3
parentfd6b42e3c2fdcbf3959fd6f8ee8b7e3de39dfd92
Btrfs: fix skipped error handle when log sync failed

It is possible that many tasks sync the log tree at the same time, but
only one task can do the sync work, the others will wait for it. But those
wait tasks didn't get the result of the log sync, and returned 0 when they
ended the wait. It caused those tasks skipped the error handle, and the
serious problem was they told the users the file sync succeeded but in
fact they failed.

This patch fixes this problem by introducing a log context structure,
we insert it into the a global list. When the sync fails, we will set
the error number of every log context in the list, then the waiting tasks
get the error number of the log context and handle the error if need.

Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/file.c
fs/btrfs/tree-log.c
fs/btrfs/tree-log.h