Amir Goldstein 12ba780d64 tmpfs: allow decoding a file handle of an unlinked file
tmpfs uses the helper d_find_alias() to find a dentry from a decoded
inode, but d_find_alias() skips unhashed dentries, so unlinked files
cannot be decoded from a file handle.

This can be reproduced using xfstests test program open_by_handle:

  $ open_by handle -c /tmp/testdir
  $ open_by_handle -dk /tmp/testdir
  open_by_handle(/tmp/testdir/file000000) returned 116 incorrectly on an unlinked open file!

To fix this, if d_find_alias() can't find a hashed alias, call
d_find_any_alias() to return an unhashed one.

Link: http://lkml.kernel.org/r/CAOQ4uxg+qSLP0KwdW+h1tcPqOCQd+_pGZVXiePQB1TXCMBMctQ@mail.gmail.com
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: NeilBrown <neilb@suse.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jeff Layton <jlayton@poochiereds.net>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-06-07 17:34:36 -07:00
..
2017-02-27 18:43:47 -08:00
2018-04-16 14:25:08 -06:00
2018-04-16 14:25:08 -06:00
2018-06-05 13:24:20 -07:00
2018-06-07 17:34:35 -07:00
2017-11-15 18:21:05 -08:00
2018-04-11 10:28:39 -07:00
2018-06-07 17:34:35 -07:00
2018-06-07 17:34:35 -07:00
2018-06-07 17:34:35 -07:00
2018-04-11 10:28:32 -07:00
2018-04-20 17:18:35 -07:00
2018-04-27 17:13:20 -06:00
2018-06-07 17:34:34 -07:00
2018-04-11 10:28:39 -07:00
2018-04-16 14:25:08 -06:00
2018-06-07 17:34:35 -07:00
2018-04-11 10:28:39 -07:00
2018-05-11 17:28:45 -07:00
2018-02-06 18:32:48 -08:00