linux/fs/f2fs
Al Viro d6fc6d7915 do d_instantiate/unlock_new_inode combinations safely
commit 1e2e547a93 upstream.

For anything NFS-exported we do _not_ want to unlock new inode
before it has grown an alias; original set of fixes got the
ordering right, but missed the nasty complication in case of
lockdep being enabled - unlock_new_inode() does
	lockdep_annotate_inode_mutex_key(inode)
which can only be done before anyone gets a chance to touch
->i_mutex.  Unfortunately, flipping the order and doing
unlock_new_inode() before d_instantiate() opens a window when
mkdir can race with open-by-fhandle on a guessed fhandle, leading
to multiple aliases for a directory inode and all the breakage
that follows from that.

	Correct solution: a new primitive (d_instantiate_new())
combining these two in the right order - lockdep annotate, then
d_instantiate(), then the rest of unlock_new_inode().  All
combinations of d_instantiate() with unlock_new_inode() should
be converted to that.

Tested-by: Mike Marshall <hubcap@omnibond.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
[bwh: Backported to 3.16:
 - Drop changes in orangefs
 - Apply similar change to ext3
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2018-10-21 08:46:03 +01:00
..
acl.c f2fs: preserve i_mode if __f2fs_set_acl() fails 2017-10-12 15:28:09 +01:00
acl.h f2fs: use generic posix ACL infrastructure 2014-01-25 23:58:19 -05:00
checkpoint.c f2fs updates for v3.16 2014-06-09 19:11:44 -07:00
data.c f2fs: fix to report newly allocate region as extent 2014-06-23 10:05:07 +09:00
debug.c f2fs: set ->owner for debugfs status file's file_operations 2017-03-16 02:26:25 +00:00
dir.c f2fs: fix error path in init_inode_metadata 2014-07-09 05:58:50 -07:00
f2fs.h f2fs: call f2fs_unlock_op after error was handled 2018-10-21 08:46:01 +01:00
file.c mm: drop vm_ops->remap_pages and generic_file_remap_pages() stub 2018-10-03 04:09:51 +01:00
gc.c f2fs: reposition unlock_new_inode to prevent accessing invalid inode 2018-10-21 08:46:00 +01:00
gc.h f2fs: add a sysfs entry to control max_victim_search 2014-01-08 13:45:08 +09:00
hash.c f2fs: unify string length declarations and usage 2012-12-28 11:27:53 +09:00
inline.c f2fs: avoid grab_cache_page_write_begin for data pages 2014-05-07 10:21:58 +09:00
inode.c f2fs: call f2fs_unlock_op after error was handled 2018-10-21 08:46:01 +01:00
Kconfig f2fs: introduce CONFIG_F2FS_CHECK_FS for BUG_ON control 2013-10-29 15:43:01 +09:00
Makefile f2fs: key functions to handle inline data 2013-12-26 20:40:09 +09:00
namei.c do d_instantiate/unlock_new_inode combinations safely 2018-10-21 08:46:03 +01:00
node.c f2fs: check bdi->dirty_exceeded when trying to skip data writes 2014-07-09 05:59:45 -07:00
node.h f2fs: fix checkpatch warning 2014-05-07 10:21:59 +09:00
recovery.c f2fs: check hot_data for roll-forward recovery 2017-11-26 13:50:23 +00:00
segment.c f2fs: fix a panic caused by NULL flush_cmd_control 2018-06-16 22:21:30 +01:00
segment.h f2fs: add ovp valid_blocks check for bg gc victim to fg_gc 2017-06-05 21:17:15 +01:00
super.c f2fs: check lower bound nid value in check_nid_range 2014-07-09 05:58:08 -07:00
xattr.c f2fs: fix recursive lock by f2fs_setxattr 2014-06-02 22:13:16 +09:00
xattr.h f2fs: pass flags field to setxattr functions 2014-05-07 10:21:56 +09:00