summaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/overlayfs/util.c')
-rw-r--r--fs/overlayfs/util.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/overlayfs/util.c b/fs/overlayfs/util.c
index 9dfec74ec77d..6f1078028c66 100644
--- a/fs/overlayfs/util.c
+++ b/fs/overlayfs/util.c
@@ -55,10 +55,21 @@ struct super_block *ovl_same_sb(struct super_block *sb)
55 return NULL; 55 return NULL;
56} 56}
57 57
58bool ovl_can_decode_fh(struct super_block *sb) 58/*
59 * Check if underlying fs supports file handles and try to determine encoding
60 * type, in order to deduce maximum inode number used by fs.
61 *
62 * Return 0 if file handles are not supported.
63 * Return 1 (FILEID_INO32_GEN) if fs uses the default 32bit inode encoding.
64 * Return -1 if fs uses a non default encoding with unknown inode size.
65 */
66int ovl_can_decode_fh(struct super_block *sb)
59{ 67{
60 return (sb->s_export_op && sb->s_export_op->fh_to_dentry && 68 if (!sb->s_export_op || !sb->s_export_op->fh_to_dentry ||
61 !uuid_is_null(&sb->s_uuid)); 69 uuid_is_null(&sb->s_uuid))
70 return 0;
71
72 return sb->s_export_op->encode_fh ? -1 : FILEID_INO32_GEN;
62} 73}
63 74
64struct dentry *ovl_indexdir(struct super_block *sb) 75struct dentry *ovl_indexdir(struct super_block *sb)