alistair23-linux/fs/ocfs2
Ashish Samant e438302920 ocfs2: take inode cluster lock before moving reflinked inode from orphan dir
While reflinking an inode, we create a new inode in orphan directory,
then take EX lock on it, reflink the original inode to orphan inode and
release EX lock.  Once the lock is released another node could request
it in EX mode from ocfs2_recover_orphans() which causes downconvert of
the lock, on this node, to NL mode.

Later we attempt to initialize security acl for the orphan inode and
move it to the reflink destination.  However, while doing this we dont
take EX lock on the inode.  This could potentially cause problems
because we could be starting transaction, accessing journal and
modifying metadata of the inode while holding NL lock and with another
node holding EX lock on the inode.

Fix this by taking orphan inode cluster lock in EX mode before
initializing security and moving orphan inode to reflink destination.
Use the __tracker variant while taking inode lock to avoid recursive
locking in the ocfs2_init_security_and_acl() call chain.

Link: http://lkml.kernel.org/r/1523475107-7639-1-git-send-email-ashish.samant@oracle.com
Signed-off-by: Ashish Samant <ashish.samant@oracle.com>
Reviewed-by: Joseph Qi <jiangqi903@gmail.com>
Reviewed-by: Junxiao Bi <junxiao.bi@oracle.com>
Acked-by: Jun Piao <piaojun@huawei.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Changwei Ge <ge.changwei@h3c.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-05-11 17:28:45 -07:00
..
cluster ocfs2/o2hb: check len for bio_add_page() to avoid getting incorrect bio 2018-04-05 21:36:22 -07:00
dlm ocfs2/dlm: clean up unused variable in dlm_process_recovery_data 2018-04-05 21:36:22 -07:00
dlmfs vfs: do bulk POLL* -> EPOLL* replacement 2018-02-11 14:34:03 -08:00
acl.c ocfs2/acl: use 'ip_xattr_sem' to protect getting extended attribute 2018-01-31 17:18:35 -08:00
acl.h
alloc.c ocfs2: use 'oi' instead of 'OCFS2_I()' 2018-04-05 21:36:21 -07:00
alloc.h ocfs2: try to reuse extent block in dealloc without meta_alloc 2018-01-31 17:18:35 -08:00
aops.c ocfs2: use 'oi' instead of 'OCFS2_I()' 2018-04-05 21:36:21 -07:00
aops.h ocfs2: keep the trace point consistent with the function name 2018-04-05 21:36:21 -07:00
blockcheck.c
blockcheck.h
buffer_head_io.c
buffer_head_io.h ocfs2: clean up some unused function declarations 2017-11-15 18:21:01 -08:00
dcache.c
dcache.h
dir.c ocfs2: use 'osb' instead of 'OCFS2_SB()' 2018-04-05 21:36:21 -07:00
dir.h
dlmglue.c Merge branch 'akpm' (patches from Andrew) 2018-04-06 14:19:26 -07:00
dlmglue.h ocfs2: nowait aio support 2018-01-31 17:18:35 -08:00
export.c
export.h
extent_map.c ocfs2: add ocfs2_overwrite_io() 2018-01-31 17:18:35 -08:00
extent_map.h ocfs2: add ocfs2_overwrite_io() 2018-01-31 17:18:35 -08:00
file.c ocfs2: keep the trace point consistent with the function name 2018-04-05 21:36:21 -07:00
file.h
filecheck.c ocfs2: add duplicated ino number check 2018-04-05 21:36:22 -07:00
filecheck.h ocfs2: add kobject for online file check 2018-04-05 21:36:22 -07:00
heartbeat.c
heartbeat.h
inode.c ocfs2: use 'oi' instead of 'OCFS2_I()' 2018-04-05 21:36:21 -07:00
inode.h
ioctl.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ioctl.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
journal.c ocfs2: return error when we attempt to access a dirty bh in jbd2 2018-01-31 17:18:35 -08:00
journal.h
Kconfig
localalloc.c
localalloc.h
locks.c
locks.h
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mmap.c ocfs2: nowait aio support 2018-01-31 17:18:35 -08:00
mmap.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
move_extents.c
move_extents.h
namei.c ocfs2: use 'oi' instead of 'OCFS2_I()' 2018-04-05 21:36:21 -07:00
namei.h
ocfs1_fs_compat.h
ocfs2.h ocfs2: add kobject for online file check 2018-04-05 21:36:22 -07:00
ocfs2_fs.h
ocfs2_ioctl.h
ocfs2_lockid.h ocfs2: add trimfs dlm lock resource 2018-01-31 17:18:35 -08:00
ocfs2_lockingver.h
ocfs2_trace.h ocfs2: keep the trace point consistent with the function name 2018-04-05 21:36:21 -07:00
quota.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
quota_global.c ocfs2: convert to new i_version API 2018-01-29 06:42:21 -05:00
quota_local.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
refcounttree.c ocfs2: take inode cluster lock before moving reflinked inode from orphan dir 2018-05-11 17:28:45 -07:00
refcounttree.h
reservations.c
reservations.h
resize.c
resize.h
slot_map.c
slot_map.h
stack_o2cb.c
stack_user.c treewide: Align function definition open/close braces 2018-03-26 11:13:09 +02:00
stackglue.c
stackglue.h
suballoc.c ocfs2: remove two unused functions from suballoc.c 2018-04-05 21:36:22 -07:00
suballoc.h
super.c ocfs2: add kobject for online file check 2018-04-05 21:36:22 -07:00
super.h ocfs2: remove unused declaration ocfs2_publish_get_mount_state() 2017-11-15 18:21:01 -08:00
symlink.c
symlink.h
sysfile.c
sysfile.h
uptodate.c ocfs2: remove unnecessary null pointer check before kmem_cache_destroy() 2018-04-05 21:36:22 -07:00
uptodate.h
xattr.c ocfs2: use 'osb' instead of 'OCFS2_SB()' 2018-04-05 21:36:21 -07:00
xattr.h