summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/util.c
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2017-06-21 14:28:36 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2017-07-04 22:03:17 +0200
commit02bcd1577400b0b2eab806ccb9f72d6b5ec7bcca (patch)
tree92c54e46aa6ae552eefac194f25d7faccdd00d5c /fs/overlayfs/util.c
parentovl: generalize ovl_create_workdir() (diff)
downloadlinux-02bcd1577400b0b2eab806ccb9f72d6b5ec7bcca.tar.xz
linux-02bcd1577400b0b2eab806ccb9f72d6b5ec7bcca.zip
ovl: introduce the inodes index dir feature
Create the index dir on mount. The index dir will contain hardlinks to upper inodes, named after the hex representation of their origin lower inodes. The index dir is going to be used to prevent breaking lower hardlinks on copy up and to implement overlayfs NFS export. Because the feature is not fully backward compat, enabling the feature is opt-in by config/module/mount option. Signed-off-by: Amir Goldstein <amir73il@gmail.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to '')
-rw-r--r--fs/overlayfs/util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index adccd74162d6..90b50b8e75ab 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -12,6 +12,8 @@
#include <linux/slab.h>
#include <linux/cred.h>
#include <linux/xattr.h>
+#include <linux/exportfs.h>
+#include <linux/uuid.h>
#include "overlayfs.h"
#include "ovl_entry.h"
@@ -47,6 +49,19 @@ struct super_block *ovl_same_sb(struct super_block *sb)
return ofs->same_sb;
}
+bool ovl_can_decode_fh(struct super_block *sb)
+{
+ return (sb->s_export_op && sb->s_export_op->fh_to_dentry &&
+ !uuid_is_null(&sb->s_uuid));
+}
+
+struct dentry *ovl_indexdir(struct super_block *sb)
+{
+ struct ovl_fs *ofs = sb->s_fs_info;
+
+ return ofs->indexdir;
+}
+
struct ovl_entry *ovl_alloc_entry(unsigned int numlower)
{
size_t size = offsetof(struct ovl_entry, lowerstack[numlower]);