linux/fs
piaojun d984187e3a ocfs2: return error when we attempt to access a dirty bh in jbd2
We should not reuse the dirty bh in jbd2 directly due to the following
situation:

1. When removing extent rec, we will dirty the bhs of extent rec and
   truncate log at the same time, and hand them over to jbd2.

2. The bhs are submitted to jbd2 area successfully.

3. The write-back thread of device help flush the bhs to disk but
   encounter write error due to abnormal storage link.

4. After a while the storage link become normal. Truncate log flush
   worker triggered by the next space reclaiming found the dirty bh of
   truncate log and clear its 'BH_Write_EIO' and then set it uptodate in
   __ocfs2_journal_access():

   ocfs2_truncate_log_worker
     ocfs2_flush_truncate_log
       __ocfs2_flush_truncate_log
         ocfs2_replay_truncate_records
           ocfs2_journal_access_di
             __ocfs2_journal_access // here we clear io_error and set 'tl_bh' uptodata.

5. Then jbd2 will flush the bh of truncate log to disk, but the bh of
   extent rec is still in error state, and unfortunately nobody will
   take care of it.

6. At last the space of extent rec was not reduced, but truncate log
   flush worker have given it back to globalalloc. That will cause
   duplicate cluster problem which could be identified by fsck.ocfs2.

Sadly we can hardly revert this but set fs read-only in case of ruining
atomicity and consistency of space reclaim.

Link: http://lkml.kernel.org/r/5A6E8092.8090701@huawei.com
Fixes: acf8fdbe6a ("ocfs2: do not BUG if buffer not uptodate in __ocfs2_journal_access")
Signed-off-by: Jun Piao <piaojun@huawei.com>
Reviewed-by: Yiwen Jiang <jiangyiwen@huawei.com>
Reviewed-by: Changwei Ge <ge.changwei@h3c.com>
Cc: Mark Fasheh <mfasheh@versity.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <jiangqi903@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-01-31 17:18:35 -08:00
..
9p Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
adfs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
affs affs: convert to new i_version API 2018-01-29 06:42:20 -05:00
afs inode->i_version rework for v4.16 2018-01-29 13:33:53 -08:00
autofs4 Merge branch 'userns-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace 2018-01-30 14:43:12 -08:00
befs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
bfs
btrfs for-4.16-tag 2018-01-29 14:04:23 -08:00
cachefiles fs: annotate ->poll() instances 2017-11-27 16:20:05 -05:00
ceph ceph: drop negative child dentries before try pruning inode's alias 2017-12-08 11:07:12 +01:00
cifs fs/cifs/cifsacl.c Fixes typo in a comment 2018-01-28 09:19:45 -06:00
coda Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
configfs
cramfs cramfs: fix MTD dependency 2017-12-17 12:20:58 -08:00
crypto
debugfs fs: annotate ->poll() instances 2017-11-27 16:20:05 -05:00
devpts devpts: fix error handling in devpts_mntget() 2018-01-31 08:48:37 -08:00
dlm Merge branch 'work.sock_recvmsg' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 18:59:03 -08:00
ecryptfs Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
efivarfs
efs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
exofs exofs: switch to new i_version API 2018-01-29 06:42:20 -05:00
exportfs
ext2 ext2: convert to new i_version API 2018-01-29 06:42:20 -05:00
ext4 inode->i_version rework for v4.16 2018-01-29 13:33:53 -08:00
f2fs f2fs-for-4.16-rc1 2018-01-30 19:07:32 -08:00
fat fat: convert to new i_version API 2018-01-29 06:42:20 -05:00
freevxfs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
fscache
fuse Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
gfs2 gfs2: Add a few missing newlines in messages 2018-01-30 10:32:30 -07:00
hfs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
hfsplus Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
hostfs
hpfs hpfs: don't bother with the i_version counter or f_version 2017-12-10 12:58:18 -08:00
hugetlbfs fs/hugetlbfs/inode.c: change put_page/unlock_page order in hugetlbfs_fallocate() 2017-11-29 18:40:43 -08:00
isofs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
jbd2
jffs2 Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
jfs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
kernfs Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
lockd lockd: Fix server refcounting 2018-01-24 17:33:57 -05:00
minix Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
ncpfs Merge branch 'work.sock_recvmsg' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 18:59:03 -08:00
nfs Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
nfs_common lockd: fix "list_add double add" caused by legacy signal interface 2017-11-27 16:45:11 -05:00
nfsd inode->i_version rework for v4.16 2018-01-29 13:33:53 -08:00
nilfs2 Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
nls
notify Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
ntfs ntfs: remove i_version handling 2018-01-01 10:09:33 -05:00
ocfs2 ocfs2: return error when we attempt to access a dirty bh in jbd2 2018-01-31 17:18:35 -08:00
omfs
openpromfs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
orangefs Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
overlayfs ovl: fix overlay: warning prefix 2017-12-14 11:14:52 +01:00
proc Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
pstore treewide: Switch DEFINE_TIMER callbacks to struct timer_list * 2017-11-21 15:57:05 -08:00
qnx4 Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
qnx6 Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
quota quota: Check for register_shrinker() failure. 2017-11-29 16:46:48 +01:00
ramfs
reiserfs Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jack/linux-fs 2017-11-30 18:38:47 -05:00
romfs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
squashfs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
sysfs Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
sysv Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
tracefs
ubifs ubifs: remove error message in ubifs_xattr_get 2018-01-18 00:18:49 +01:00
udf Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
ufs ufs: use new i_version API 2018-01-29 06:42:21 -05:00
xfs New in this version: 2018-01-31 10:18:00 -08:00
Kconfig
Kconfig.binfmt
Makefile
aio.c
anon_inodes.c
attr.c
bad_inode.c
binfmt_aout.c
binfmt_elf.c
binfmt_elf_fdpic.c
binfmt_em86.c
binfmt_flat.c
binfmt_misc.c
binfmt_script.c
block_dev.c
buffer.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
char_dev.c
compat.c
compat_binfmt_elf.c
compat_ioctl.c
coredump.c
dax.c fs/dax.c: release PMD lock even when there is no PMD support in DAX 2018-01-31 17:18:34 -08:00
dcache.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
dcookies.c
direct-io.c iomap: report collisions between directio and buffered writes to userspace 2018-01-08 10:41:39 -08:00
drop_caches.c
eventfd.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
eventpoll.c eventpoll: no need to mask the result of epi_item_poll() again 2017-11-28 19:56:15 -05:00
exec.c exec: Weaken dumpability for secureexec 2018-01-03 10:13:36 -08:00
fcntl.c Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
fhandle.c
file.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
file_table.c vfs: remove unused hardirq.h 2017-12-07 14:23:30 -05:00
filesystems.c
fs-writeback.c writeback: update comment in inode_io_list_move_locked 2018-01-06 09:18:00 -07:00
fs_pin.c
fs_struct.c
inode.c fs: only set S_VERSION when updating times if necessary 2018-01-29 06:42:21 -05:00
internal.h
ioctl.c
iomap.c iomap: warn on zero-length mappings 2018-01-29 07:27:24 -08:00
libfs.c Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
locks.c Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
mbcache.c fs/mbcache.c: make count_objects() more robust 2017-11-29 18:40:43 -08:00
mount.h
mpage.c
namei.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
namespace.c VFS: Handle lazytime in do_mount() 2017-12-09 20:16:33 -05:00
no-block.c
nsfs.c Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
open.c
pipe.c fs: annotate ->poll() instances 2017-11-27 16:20:05 -05:00
pnode.c
pnode.h
posix_acl.c posix_acl: convert posix_acl.a_refcount from atomic_t to refcount_t 2018-01-02 19:27:28 -08:00
proc_namespace.c Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
read_write.c
readdir.c
select.c make kernel-side POLL... arch-independent 2017-11-29 19:00:41 -05:00
seq_file.c
signalfd.c fs: annotate ->poll() instances 2017-11-27 16:20:05 -05:00
splice.c
stack.c
stat.c
statfs.c Rename superblock flags (MS_xyz -> SB_xyz) 2017-11-27 13:05:09 -08:00
super.c Merge branch 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-31 09:25:20 -08:00
sync.c
timerfd.c fs: annotate ->poll() instances 2017-11-27 16:20:05 -05:00
userfaultfd.c Merge branch 'misc.poll' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2018-01-30 17:58:07 -08:00
utimes.c
xattr.c