linux/fs/ufs
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
..
balloc.c ufs: restore maintaining ->i_blocks 2017-09-15 18:30:08 +01:00
cylinder.c drop linux/ufs_fs.h from userspace export and relocate it to fs/ufs/ufs_fs.h 2008-02-08 09:22:39 -08:00
dir.c [readdir] simple local unixlike: switch to ->iterate() 2013-06-29 12:46:47 +04:00
file.c write_iter variants of {__,}generic_file_aio_write() 2014-05-06 17:38:00 -04:00
ialloc.c ufs: deal with nfsd/iget races 2018-10-21 08:46:02 +01:00
inode.c excessive checks in ufs_write_failed() and ufs_evict_inode() 2017-09-15 18:30:08 +01:00
Kconfig fs/ufs: remove depends on CONFIG_EXPERIMENTAL 2013-01-21 14:39:06 -08:00
Makefile Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
namei.c do d_instantiate/unlock_new_inode combinations safely 2018-10-21 08:46:03 +01:00
super.c ufs: set correct ->s_maxsize 2017-09-15 18:30:08 +01:00
swab.h ufs: replace __inline with inline 2008-04-28 08:58:45 -07:00
symlink.c ufs: add ufs speciffic ->setattr call 2010-05-21 19:30:40 +02:00
truncate.c excessive checks in ufs_write_failed() and ufs_evict_inode() 2017-09-15 18:30:08 +01:00
ufs.h fs/ufs: restore s_lock mutex 2015-07-15 10:00:37 +01:00
ufs_fs.h fs/ufs: get rid of write_super 2012-07-22 23:58:16 +04:00
util.c fs: ufs: remove cast for kmalloc return value 2013-03-18 14:15:58 +01:00
util.h fix ufs_isblockset() 2017-09-15 18:30:08 +01:00