linux-stable/fs/ocfs2
Jan Kara via Ocfs2-devel 205759c6c1 ocfs2: fix data corruption after failed write
commit 90410bcf87 upstream.

When buffered write fails to copy data into underlying page cache page,
ocfs2_write_end_nolock() just zeroes out and dirties the page.  This can
leave dirty page beyond EOF and if page writeback tries to write this page
before write succeeds and expands i_size, page gets into inconsistent
state where page dirty bit is clear but buffer dirty bits stay set
resulting in page data never getting written and so data copied to the
page is lost.  Fix the problem by invalidating page beyond EOF after
failed write.

Link: https://lkml.kernel.org/r/20230302153843.18499-1-jack@suse.cz
Fixes: 6dbf7bb555 ("fs: Don't invalidate page buffers in block_write_full_page()")
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-22 13:38:06 +01:00
..
cluster Treewide: Stop corrupting socket's task_frag 2022-12-19 17:28:49 -08:00
dlm ocfs2/dlm: use bitmap API instead of hand-writing it 2022-11-18 13:55:06 -08:00
dlmfs ocfs2: kill EBUSY from dlmfs_evict_inode 2022-06-16 19:58:20 -07:00
Kconfig
Makefile
acl.c fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
acl.h fs: pass dentry to set acl method 2022-10-19 12:55:42 +02:00
alloc.c ocfs2: Convert ocfs2 to read_folio 2022-05-09 16:21:46 -04:00
alloc.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
aops.c ocfs2: fix data corruption after failed write 2023-03-22 13:38:06 +01:00
aops.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
blockcheck.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
blockcheck.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
buffer_head_io.c fs/buffer: Combine two submit_bh() and ll_rw_block() arguments 2022-07-14 12:14:32 -06:00
buffer_head_io.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
dcache.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
dcache.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
dir.c Change calling conventions for filldir_t 2022-08-17 17:25:04 -04:00
dir.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
dlmglue.c ocfs2: fix freeing uninitialized resource on ocfs2_dlm_shutdown 2022-08-28 14:02:45 -07:00
dlmglue.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
export.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
export.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
extent_map.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
extent_map.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
file.c fs.ovl.setgid.v6.2 2022-12-12 19:03:10 -08:00
file.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
filecheck.c ocfs2: use default_groups in kobj_type 2022-01-15 16:30:24 +02:00
filecheck.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
heartbeat.c ocfs2: fix a typo in a comment 2022-07-29 18:12:36 -07:00
heartbeat.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
inode.c ocfs2: fix mounting crash if journal is not alloced 2022-04-29 14:37:58 -07:00
inode.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ioctl.c block: add a bdev_discard_granularity helper 2022-04-17 19:49:59 -06:00
ioctl.h ocfs2: convert to fileattr 2021-04-12 15:04:30 +02:00
journal.c ocfs2: fix memory leak in ocfs2_mount_volume() 2022-11-30 16:13:17 -08:00
journal.h ocfs2: fix memory leak in ocfs2_mount_volume() 2022-11-30 16:13:17 -08:00
localalloc.c fs/ocfs2: fix comments mentioning i_mutex 2022-03-22 15:57:00 -07:00
localalloc.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
locks.c fs: remove mandatory file locking support 2021-08-23 06:15:36 -04:00
locks.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
mmap.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
mmap.h
move_extents.c ocfs2: fix non-auto defrag path not working issue 2023-03-10 09:29:31 +01:00
move_extents.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
namei.c fs.acl.rework.v6.2 2022-12-12 18:46:39 -08:00
namei.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs1_fs_compat.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2.h ocfs2: always read both high and low parts of dinode link count 2022-12-11 19:30:19 -08:00
ocfs2_fs.h ocfs2: replace zero-length arrays with DECLARE_FLEX_ARRAY() helper 2022-10-03 14:21:42 -07:00
ocfs2_ioctl.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_lockid.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_lockingver.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
ocfs2_trace.h
quota.h
quota_global.c fs/ocfs2: Fix spelling typo in comment 2022-07-17 17:31:43 -07:00
quota_local.c ocfs2: replace usage of found with dedicated list iterator variable 2022-04-29 14:37:57 -07:00
refcounttree.c fs/ocfs2: fix repeated words in comments 2022-10-03 14:21:43 -07:00
refcounttree.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
reservations.c ocfs2: change return type of ocfs2_resmap_init 2022-04-29 14:37:58 -07:00
reservations.h ocfs2: change return type of ocfs2_resmap_init 2022-04-29 14:37:58 -07:00
resize.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
resize.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
slot_map.c Revert "ocfs2: mount shared volume without ha stack" 2022-07-18 15:09:15 -07:00
slot_map.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
stack_o2cb.c ocfs2: use bitmap API in fill_node_map 2022-11-18 13:55:06 -08:00
stack_user.c fs: dlm: remove DLM_LSFL_FS from uapi 2022-08-23 14:54:54 -05:00
stackglue.c ocfs2: fix memory leak in ocfs2_stack_glue_init() 2022-11-18 13:55:09 -08:00
stackglue.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
suballoc.c ocfs2: fix a deadlock when commit trans 2022-01-30 09:56:58 +02:00
suballoc.h fs/ocfs2/suballoc.h: fix spelling typo in comment 2022-10-03 14:21:42 -07:00
super.c ocfs2: fix memory leak in ocfs2_mount_volume() 2022-11-30 16:13:17 -08:00
super.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
symlink.c ocfs2: Convert ocfs2 to read_folio 2022-05-09 16:21:46 -04:00
symlink.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
sysfile.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
sysfile.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
uptodate.c treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
uptodate.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
xattr.c fs/ocfs2: fix comments mentioning i_mutex 2022-03-22 15:57:00 -07:00
xattr.h treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00