ovl: during copy up, switch to mounter's creds early
authorVivek Goyal <vgoyal@redhat.com>
Tue, 6 Sep 2016 17:40:32 +0000 (13:40 -0400)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 19 Sep 2016 14:50:59 +0000 (16:50 +0200)
commit8eac98b8beb4711c4ab61822cac077fd6660e820
tree00f99d86265b7bae9c622c90fa4b72f0c1f6e788
parent2b6bc7f48d34a6043915beddbf53b981603737c8
ovl: during copy up, switch to mounter's creds early

Now, we have the notion that copy up of a file is done with the creds
of mounter of overlay filesystem (as opposed to task). Right now before
we switch creds, we do some vfs_getattr() operations in the context of
task and that itself can fail. We should do that getattr() using the
creds of mounter instead.

So this patch switches to mounter's creds early during copy up process so
that even vfs_getattr() is done with mounter's creds.

Do not call revert_creds() unless we have already called
ovl_override_creds(). [Reported by Arnd Bergmann]

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/copy_up.c
fs/overlayfs/inode.c