summaryrefslogtreecommitdiff
path: root/fs/kernfs/inode.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2015-05-14 00:09:29 +0300
committerEric W. Biederman <ebiederm@xmission.com>2015-07-01 18:36:43 +0300
commitea015218f2f7ace2dad9cedd21ed95bdba2886d7 (patch)
tree9ab4dc58398a5ef08b174871a9cc587680261b65 /fs/kernfs/inode.c
parenteb6d38d5427b3ad42f5268da0f1dd31bb0af1264 (diff)
downloadlinux-ea015218f2f7ace2dad9cedd21ed95bdba2886d7.tar.xz
kernfs: Add support for always empty directories.
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. Cc: stable@vger.kernel.org Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/kernfs/inode.c')
-rw-r--r--fs/kernfs/inode.c2
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)
case KERNFS_DIR:
inode->i_op = &kernfs_dir_iops;
inode->i_fop = &kernfs_dir_fops;
+ if (kn->flags & KERNFS_EMPTY_DIR)
+ make_empty_dir_inode(inode);
break;
case KERNFS_FILE:
inode->i_size = kn->attr.size;