original_kernel/fs/ocfs2
Changwei Ge 783fda856e ocfs2: no need try to truncate file beyond i_size
Linux fallocate(2) with FALLOC_FL_PUNCH_HOLE mode set, its offset can
exceed the inode size.  Ocfs2 now doesn't allow that offset beyond inode
size.  This restriction is not necessary and violates fallocate(2)
semantics.

If fallocate(2) offset is beyond inode size, just return success and do
nothing further.

Otherwise, ocfs2 will crash the kernel.

  kernel BUG at fs/ocfs2//alloc.c:7264!
   ocfs2_truncate_inline+0x20f/0x360 [ocfs2]
   ocfs2_remove_inode_range+0x23c/0xcb0 [ocfs2]
   __ocfs2_change_file_space+0x4a5/0x650 [ocfs2]
   ocfs2_fallocate+0x83/0xa0 [ocfs2]
   vfs_fallocate+0x148/0x230
   SyS_fallocate+0x48/0x80
   do_syscall_64+0x79/0x170

Signed-off-by: Changwei Ge <chge@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
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>
Link: http://lkml.kernel.org/r/20200407082754.17565-1-chge@linux.alibaba.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-04-10 15:36:21 -07:00
..
cluster ocfs2: use memalloc_nofs_save instead of memalloc_noio_save 2020-04-02 09:35:26 -07:00
dlm ocfs2: use scnprintf() for avoiding potential buffer overflow 2020-04-02 09:35:26 -07:00
dlmfs ocfs2: make local header paths relative to C files 2020-01-31 10:30:36 -08:00
Kconfig
Makefile
acl.c
acl.h
alloc.c ocfs2: no need try to truncate file beyond i_size 2020-04-10 15:36:21 -07:00
alloc.h
aops.c
aops.h
blockcheck.c
blockcheck.h
buffer_head_io.c
buffer_head_io.h
dcache.c
dcache.h
dir.c ocfs2: remove useless err 2020-04-02 09:35:25 -07:00
dir.h
dlmglue.c ocfs2: use OCFS2_SEC_BITS in macro 2020-04-02 09:35:25 -07:00
dlmglue.h
export.c
export.h
extent_map.c
extent_map.h
file.c ocfs2: fix oops when writing cloned file 2020-02-04 03:05:23 +00:00
file.h
filecheck.c
filecheck.h
heartbeat.c
heartbeat.h
inode.c
inode.h
ioctl.c compat_ioctl: remove most of fs/compat_ioctl.c 2019-12-01 13:46:15 -08:00
ioctl.h
journal.c ocfs2: replace zero-length array with flexible-array member 2020-04-02 09:35:25 -07:00
journal.h ocfs2: fix a NULL pointer dereference when call ocfs2_update_inode_fsync_trans() 2020-01-31 10:30:36 -08:00
localalloc.c
localalloc.h
locks.c
locks.h
mmap.c
mmap.h
move_extents.c
move_extents.h
namei.c ocfs2: roll back the reference count modification of the parent directory if an error occurs 2020-04-02 09:35:26 -07:00
namei.h
ocfs1_fs_compat.h
ocfs2.h
ocfs2_fs.h ocfs2: ocfs2_fs.h: replace zero-length array with flexible-array member 2020-04-02 09:35:26 -07:00
ocfs2_ioctl.h
ocfs2_lockid.h
ocfs2_lockingver.h
ocfs2_trace.h
quota.h
quota_global.c
quota_local.c
refcounttree.c ocfs2: add missing annotations for ocfs2_refcount_cache_lock() and ocfs2_refcount_cache_unlock() 2020-04-02 09:35:25 -07:00
refcounttree.h
reservations.c ocfs2: remove unused macros 2020-04-02 09:35:25 -07:00
reservations.h
resize.c
resize.h
slot_map.c
slot_map.h
stack_o2cb.c
stack_user.c
stackglue.c ocfs2: remove FS_OCFS2_NM 2020-04-02 09:35:25 -07:00
stackglue.h
suballoc.c ocfs2: there is no need to log twice in several functions 2020-04-02 09:35:25 -07:00
suballoc.h
super.c ocfs2: use scnprintf() for avoiding potential buffer overflow 2020-04-02 09:35:26 -07:00
super.h
symlink.c
symlink.h
sysfile.c
sysfile.h
uptodate.c
uptodate.h
xattr.c
xattr.h