Whamcloud - gitweb
LU-16958 llite: call truncate_inode_pages() in inode lock
authorBobi Jam <bobijam@whamcloud.com>
Wed, 2 Aug 2023 11:30:09 +0000 (19:30 +0800)
committerAndreas Dilger <adilger@whamcloud.com>
Mon, 28 Aug 2023 15:29:22 +0000 (15:29 +0000)
commit3797f7201fdd6b6589d775149821ad6aac3d5c15
treec12d29d0bb48d99f66026b826fa6f7a9b2f4be04
parentf54b63621f3d48bf171b2e5e9c75d21b2a23a127
LU-16958 llite: call truncate_inode_pages() in inode lock

In some cases vvp_prune()->truncate_inode_pages() is get called
without IO context, we need protect it with inode lock as well.

So we add ll_inode_info::lli_inode_lock_owner and set it according to
vfs lock rules (Documentation/filesystems/Locking or
Documentation/filesystems/locking.rst), so before calling
truncate_inode_pages(), we'd lock the inode if it's not locked in
vfs.

And in lov_conf_set(), when it requires inode lock, we'd take heed of
the possible inode size lock, inode layout lock and lov conf lock that
have been taken by itself, and it also need to take these locks in
order lest deadlock being ensued.

Lustre-commit: 51d62f2122fee14fbb3ff8333b5a830e1181e4e5
Lustre-change: https://review.whamcloud.com/50857
Lustre-commit: 8f2c1592c3bbd0351ab3984a88a3eed7075690c8
Lustre-change: https://review.whamcloud.com/51641

Fixes: ef9be34478 ("LU-16637 llite: call truncate_inode_pages() under inode lock")
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Change-Id: I7ee58039a6d31daefc625ac571a52baf112f8151
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51644
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
16 files changed:
lustre/include/cl_object.h
lustre/llite/dir.c
lustre/llite/file.c
lustre/llite/llite_internal.h
lustre/llite/llite_lib.c
lustre/llite/llite_mmap.c
lustre/llite/llite_nfs.c
lustre/llite/namei.c
lustre/llite/pcc.c
lustre/llite/statahead.c
lustre/llite/vvp_io.c
lustre/llite/vvp_object.c
lustre/llite/xattr.c
lustre/llite/xattr_cache.c
lustre/lov/lov_object.c
lustre/obdclass/cl_object.c