]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
UBUNTU: SAUCE: shiftfs: rework how shiftfs opens files
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 2 Oct 2019 07:57:14 +0000 (09:57 +0200)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 25 Nov 2019 13:56:56 +0000 (14:56 +0100)
commitd73a8b3dda1e52a1776847e259717a11d44ebdf7
treef14ce8efa19e57e4e710585d3941ae18794a9e1a
parent21208889cbd37e0c5e3d753f92754e703715338c
UBUNTU: SAUCE: shiftfs: rework how shiftfs opens files

BugLink: https://bugs.launchpad.net/bugs/1846265
This commit simplifies how shiftfs open files, both regular files an
directories.

In the first iteration, we implemented a kmem cache for struct
shiftfs_file_info which stashed away a struct path and the struct file
for the underlay. The path however was never used anywhere so the struct
shiftfs_file_info and therefore the whole kmem cache can go away.
Instead we move to the same model as overlayfs and just stash away the
struct file for the underlay in file->private_data of the shiftfs struct
file.
Addtionally, we split the .open method for files and directories.
Similar to overlayfs .open for regular files uses open_with_fake_path()
which ensures that it doesn't contribute to the open file count (since
this would mean we'd count double). The .open method for directories
however used dentry_open() which contributes to the open file count.

The basic logic for opening files is unchanged. The main point is to
ensure that a reference to the underlay's dentry is kept through struct
path.

Various bits and pieces of this were cooked up in discussions Seth and I
had in Paris.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/shiftfs.c