Files
linux/include/linux
Miklos Szeredi d101a12595 fs: add file_dentry()
This series fixes bugs in nfs and ext4 due to 4bacc9c923 ("overlayfs:
Make f_path always point to the overlay and f_inode to the underlay").

Regular files opened on overlayfs will result in the file being opened on
the underlying filesystem, while f_path points to the overlayfs
mount/dentry.

This confuses filesystems which get the dentry from struct file and assume
it's theirs.

Add a new helper, file_dentry() [*], to get the filesystem's own dentry
from the file.  This checks file->f_path.dentry->d_flags against
DCACHE_OP_REAL, and returns file->f_path.dentry if DCACHE_OP_REAL is not
set (this is the common, non-overlayfs case).

In the uncommon case it will call into overlayfs's ->d_real() to get the
underlying dentry, matching file_inode(file).

The reason we need to check against the inode is that if the file is copied
up while being open, d_real() would return the upper dentry, while the open
file comes from the lower dentry.

[*] If possible, it's better simply to use file_inode() instead.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Tested-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Reviewed-by: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: <stable@vger.kernel.org> # v4.2
Cc: David Howells <dhowells@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Daniel Axtens <dja@axtens.net>
2016-03-26 16:14:37 -04:00
..
2016-02-17 17:53:03 +01:00
2015-10-17 21:22:08 -07:00
2015-10-07 18:08:15 +01:00
2016-03-04 23:50:27 -06:00
2015-05-13 12:04:55 -05:00
2015-12-23 08:37:10 -07:00
2015-03-25 20:28:11 -04:00
2016-02-11 10:07:18 -05:00
2016-03-15 16:55:16 -07:00
2015-12-22 09:38:34 -07:00
2016-02-09 12:42:17 -07:00
2015-12-06 12:46:31 +01:00
2016-03-08 15:28:31 -05:00
2016-03-11 21:19:16 +08:00
2016-02-16 13:04:58 -05:00
2015-09-04 16:54:41 -07:00
2016-03-26 16:14:37 -04:00
2016-02-09 09:25:22 +01:00
2016-02-26 13:28:35 +02:00
2016-02-07 17:34:58 -08:00
2015-06-24 17:49:45 -07:00
2016-03-26 16:14:37 -04:00
2015-12-28 13:41:50 +01:00
2016-01-15 17:56:32 -08:00
2015-03-16 21:45:54 +11:00
2015-05-05 13:40:42 -06:00
2015-11-25 09:22:00 -07:00
2016-03-11 14:58:58 -05:00
2015-10-23 05:44:28 -07:00
2016-02-11 09:59:22 -05:00
2016-01-20 17:09:18 -08:00
2015-10-01 15:06:43 +02:00
2015-12-14 10:03:46 +01:00
2015-06-25 12:06:45 +02:00
2016-01-28 14:19:12 -08:00
2016-02-16 13:04:58 -05:00
2015-07-28 08:50:42 +01:00
2016-01-15 17:56:32 -08:00
2015-04-29 17:17:17 -05:00
2016-03-09 15:43:42 -08:00
2016-01-15 17:56:32 -08:00
2015-10-27 18:55:31 -07:00
2015-06-24 17:49:41 -07:00
2015-10-20 22:10:45 +08:00
2015-07-21 10:39:05 -07:00
2016-03-05 12:24:06 -08:00
2016-03-09 16:36:13 -05:00
2016-02-08 15:20:01 -05:00
2016-02-16 13:04:58 -05:00
2015-09-10 13:29:01 -07:00
2015-04-12 21:03:31 +02:00
2016-02-11 18:35:48 -08:00
2016-02-11 18:35:48 -08:00
2016-03-14 15:43:11 -04:00
2016-02-10 01:11:54 +01:00
2016-03-09 15:15:32 -08:00
2015-10-06 17:08:19 +02:00
2016-02-16 13:04:58 -05:00
2015-10-22 08:59:18 -07:00
2016-03-17 15:09:34 -07:00
2016-03-09 16:36:13 -05:00
2015-11-16 09:23:47 +01:00
2015-05-26 15:23:23 +02:00
2016-01-10 22:13:15 -05:00
2016-01-04 16:11:11 -05:00
2016-03-15 16:55:16 -07:00
2016-03-17 15:09:34 -07:00
2015-06-25 17:00:39 -07:00
2015-08-17 11:25:28 -07:00
2015-10-01 09:57:59 -07:00
2015-10-19 01:01:21 +02:00
2016-01-28 14:13:44 -08:00
2015-11-23 09:44:58 +01:00
2016-02-22 16:10:08 -07:00
2016-01-14 16:00:49 -08:00
2015-12-03 07:24:29 -08:00
2015-03-24 09:48:14 -07:00
2015-09-08 15:35:28 -07:00