diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-05-13 17:09:29 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-07-21 13:10:00 -0400 |
commit | 80c298105bf80e33ae494eaeba51f00352b5373c (patch) | |
tree | 173d2fa47f6a58fec963d859ab6dfcd553c62ff8 /fs/kernfs/inode.c | |
parent | a2020b02c1ec4fffddb77785773dff533428f814 (diff) |
kernfs: Add support for always empty directories.
commit ea015218f2f7ace2dad9cedd21ed95bdba2886d7 upstream.
Add a new function kernfs_create_empty_dir that can be used to create
directory that can not be modified.
Update the code to use make_empty_dir_inode when reporting a
permanently empty directory to the vfs.
Update the code to not allow adding to permanently empty directories.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/kernfs/inode.c')
-rw-r--r-- | fs/kernfs/inode.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c index 2da8493a380b..756dd56aaf60 100644 --- a/fs/kernfs/inode.c +++ b/fs/kernfs/inode.c | |||
@@ -296,6 +296,8 @@ static void kernfs_init_inode(struct kernfs_node *kn, struct inode *inode) | |||
296 | case KERNFS_DIR: | 296 | case KERNFS_DIR: |
297 | inode->i_op = &kernfs_dir_iops; | 297 | inode->i_op = &kernfs_dir_iops; |
298 | inode->i_fop = &kernfs_dir_fops; | 298 | inode->i_fop = &kernfs_dir_fops; |
299 | if (kn->flags & KERNFS_EMPTY_DIR) | ||
300 | make_empty_dir_inode(inode); | ||
299 | break; | 301 | break; |
300 | case KERNFS_FILE: | 302 | case KERNFS_FILE: |
301 | inode->i_size = kn->attr.size; | 303 | inode->i_size = kn->attr.size; |