ovl: add helper to return real file
authorMiklos Szeredi <mszeredi@redhat.com>
Wed, 18 Jul 2018 13:44:41 +0000 (15:44 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Wed, 18 Jul 2018 13:44:41 +0000 (15:44 +0200)
commit2ef66b8a03c02c4cef71bf1e8661317c7b9aa071
treebd973408b1d27670a142b4215b581d8a45d294a0
parentd1d04ef8572bc8c22265057bd3d5a79f223f8f52
ovl: add helper to return real file

In the common case we can just use the real file cached in
file->private_data.  There are two exceptions:

1) File has been copied up since open: in this unlikely corner case just
use a throwaway real file for the operation.  If ever this becomes a
perfomance problem (very unlikely, since overlayfs has been doing most fine
without correctly handling this case at all), then we can deal with that by
updating the cached real file.

2) File's f_flags have changed since open: no need to reopen the cached
real file, we can just change the flags there as well.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/file.c