ecryptfs
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
***DO NOT ACCEPT THIS PATCH***
Quoted 3 lines · Michael Halcrow
I have a couple more bogus patches I would like feedback on; they're bogus at this stage because I am struggling to get them to work right. I'll send them as a follow-on to this message.
***DO NOT ACCEPT THIS PATCH***
This code is for commentary only at this stage. Note that it applies on top of a patch that associates the vfsmount with the dentry rather than the superblock.
Here is where I am thinking about going with crossing lower mount points. This patch makes sure that there is a 1-to-1 mapping in inode numbers between the stacked inodes and the lower inodes. It maintains the association by modifying the struct inode to include a back pointer from the lower inode to the stacked inode. Note that Unionfs has a persistent inode approach that is much more heavy-weight than this approach, but it does not need to modify anything in the VFS.
I would like the CONFIG_STACK_FS to govern VFS modifications that make stackable filesystems more functional. My approach is to allow the kernel to be built without any such modifications, but certain features will be disabled/degraded in the stacked filesystem.
Unfortunately, with this patch, things blow up on umount; I'll have to investigate what's going on.
fs/Kconfig +11 -0
@@ -443,6 +443,14 @@ config QUOTA with the quota tools. Probably the quota support is only useful for multi user systems. If unsure, say N. +config STACK_FS + bool "Stacked filesystem support" + default y + help + Select Y to enable all features in stacked filesystems (such + as eCryptfs and Unionfs). Slightly increases the size of + inodes in memory. If unsure, say Y. + config QFMT_V1 tristate "Old quota format support" depends on QUOTA
@@ -984,6 +992,9 @@ config ECRYPT_FS Encrypted filesystem that operates on the VFS layer. See Documentation/ecryptfs.txt to learn more about eCryptfs. + It is strongly recommended that you also enable ``Stacked + filesystem support'' (CONFIG_STACK_FS) if you build eCryptfs. + To compile this file system support as a module, choose M here: the module will be called ecryptfs.
fs/ecryptfs/ecryptfs_kernel.h +45 -0
51 lines not on this page · raw message
fs/ecryptfs/main.c +5 -11
@@ -77,22 +77,16 @@ int ecryptfs_interpose(struct dentry *lo struct super_block *sb, int flag) {struct inode *lower_inode; -int rc =0 ;struct inode *inode; +int rc =0 ; lower_inode = lower_dentry->d_inode; -if (lower_inode->i_sb !=ecryptfs_superblock_to_lower (sb)) { - rc = -EXDEV ; - goto out; - } - inode =iget (sb, lower_inode->i_ino); -if (!inode) { - rc = -EACCES ; + rc =ecryptfs_get_inode (&inode, lower_inode, sb); +if (rc) { +printk (KERN_ERR "Error getting inode\n" ); goto out; } -/* This check is required here because if we failed to allocated the -* required space for an inode_info_cache struct, then the only way -* we know we failed, is by the pointer being NULL */ +/* Did we succeed in allocating ecryptfs_inode_info? */ if (!ecryptfs_inode_to_private (inode)) {ecryptfs_printk (KERN_ERR ,"Out of memory. Failure to " "allocate memory in ecryptfs_read_inode.\n" );
fs/ecryptfs/super.c +1 -0
@@ -138,6 +138,7 @@ static int ecryptfs_statfs(struct dentry*/ static void ecryptfs_clear_inode (struct inode *inode) { +ecryptfs_clear_inode_stacking (inode);iput (ecryptfs_inode_to_lower (inode)); }
fs/inode.c +4 -1
@@ -163,7 +163,10 @@ #endif bdi = sb->s_bdev->bd_inode->i_mapping->backing_dev_info; mapping->backing_dev_info = bdi; } - inode->i_private =0 ; + inode->i_private =NULL ; +#ifdef CONFIG_STACK_FS + inode->i_stacked_inode =NULL ; +#endif inode->i_mapping = mapping; }return inode;
include/linux/fs.h +3 -0
@@ -578,6 +578,9 @@ #endifatomic_t i_writecount;void *i_security;void *i_private;/* fs or device private pointer */ +#ifdef CONFIG_STACK_FS +struct inode *i_stacked_inode;/* stackable fs support */ +#endif #ifdef __NEED_I_SIZE_ORDEREDseqcount_t i_size_seqcount;#endif
On Mon, Aug 07, 2006 at 11:31:15AM -0500, Michael Halcrow wrote:
...
Quoted 5 lines
Here is where I am thinking about going with crossing lower mount points. This patch makes sure that there is a 1-to-1 mapping in inode numbers between the stacked inodes and the lower inodes. It maintains the association by modifying the struct inode to include a back pointer from the lower inode to the stacked inode.
Do you maintain the inode numbers across mounts (of ecryptfs)? The patch doesn't look like it does.
Quoted 3 lines
Note that Unionfs
has a persistent inode approach that is much more heavy-weight than this approach, but it does not need to modify anything in the VFS.
I'd just like to point out, that we'd (Unionfs folks) love to see a solution at the VFS level.
Quoted 4 lines
I would like the
CONFIG_STACK_FSto govern VFS modifications that make stackable filesystems more functional. My approach is to allow the kernel to be built without any such modifications, but certain features will be disabled/degraded in the stacked filesystem.
Makes sense.
fs/inode.c #endif · line 170
Quoted 5 lines
fs/inode.c +4
-0+ inode->i_private =NULL ; +#ifdef CONFIG_STACK_FS + inode->i_stacked_inode =NULL ; +#endif inode->i_mapping = mapping;
Hrm. Looking at this made me think...This patch introduces pointers up the stack in the VFS. Would it make sense to introduce the down pointers as well, and make ecryptfs, et. al., depend on STACK_FS? This would clean up some of the use of private data. Of course these pointers (the up & down) make struct inode grow 8 bytes (on 32-bit systems).
Josef "Jeff" Sipek.
Signature · 2 lines
Intellectuals solve problems; geniuses prevent them - Albert Einstein
Quoted 10 lines · Josef Sipek
On Mon, Aug 07, 2006 at 11:31:15AM -0500, Michael Halcrow wrote:
...Quoted 5 lines
Here is where I am thinking about going with crossing lower mount points. This patch makes sure that there is a 1-to-1 mapping in inode numbers between the stacked inodes and the lower inodes. It maintains the association by modifying the struct inode to include a back pointer from the lower inode to the stacked inode.
Do you maintain the inode numbers across mounts (of ecryptfs)? The patch doesn't look like it does.
Nope; this patch just aims to make sure that stacked and lower inodes maintain a 1-to-1 relationship.
Quoted 4 lines
Quoted 4 lines
fs/inode.c +4
-0+ inode->i_private =NULL ; +#ifdef CONFIG_STACK_FS + inode->i_stacked_inode =NULL ; +#endif
Quoted 8 lines
Quoted 1 line
inode->i_mapping= mapping;Hrm. Looking at this made me think...This patch introduces pointers up the stack in the VFS. Would it make sense to introduce the down pointers as well, and make ecryptfs, et. al., depend on
STACK_FS? This would clean up some of the use of private data. Of course these pointers (the up & down) make struct inode grow 8 bytes (on 32-bit systems).
I would say that using the existing private data pointer is a better option than consuming more space in each and every inode struct.
Mike
Quoted 9 lines · Michael Halcrow
Quoted 8 lines · Josef Sipek
On Mon, Aug 07, 2006 at 11:31:15AM -0500, Michael Halcrow wrote:
...Quoted 5 lines
Here is where I am thinking about going with crossing lower mount points. This patch makes sure that there is a 1-to-1 mapping in inode numbers between the stacked inodes and the lower inodes. It maintains the association by modifying the struct inode to include a back pointer from the lower inode to the stacked inode.
Quoted 5 lines
Quoted 2 lines
Do you maintain the inode numbers across mounts (of ecryptfs)? The patch doesn't look like it does.
Nope; this patch just aims to make sure that stacked and lower inodes maintain a 1-to-1 relationship.
so that won't let your cross mount points.... i.e. the 2 underlying mountpoints can have the same inode numbers, couldn't they?
Quoted 10 lines · Shaya Potter
Quoted 9 lines · Michael Halcrow
Quoted 8 lines · Josef Sipek
On Mon, Aug 07, 2006 at 11:31:15AM -0500, Michael Halcrow wrote:
...Quoted 5 lines
Here is where I am thinking about going with crossing lower mount points. This patch makes sure that there is a 1-to-1 mapping in inode numbers between the stacked inodes and the lower inodes. It maintains the association by modifying the struct inode to include a back pointer from the lower inode to the stacked inode.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Do you maintain the inode numbers across mounts (of ecryptfs)? The patch doesn't look like it does.
Nope; this patch just aims to make sure that stacked and lower inodes maintain a 1-to-1 relationship.
so that won't let your cross mount points.... i.e. the 2 underlying mountpoints can have the same inode numbers, couldn't they?
Two underlying mountpoints can have the sane inode number. This patch will assign a unique inode number to each stacked inode while linking to the stacked inode from the lower inode to keep a 1-to-1 mapping of stacked and lower inodes. Something like this is necessary for crossing mount points in the lower filesystem while handling hard links right. There are other issues with regard to namespaces and what not that still need to be addressed.
Mike
Quoted 17 lines · Michael Halcrow
Quoted 9 lines · Shaya Potter
Quoted 8 lines · Michael Halcrow
Quoted 7 lines · Josef Sipek
On Mon, Aug 07, 2006 at 11:31:15AM -0500, Michael Halcrow wrote:
...Quoted 5 lines
Here is where I am thinking about going with crossing lower mount points. This patch makes sure that there is a 1-to-1 mapping in inode numbers between the stacked inodes and the lower inodes. It maintains the association by modifying the struct inode to include a back pointer from the lower inode to the stacked inode.
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Do you maintain the inode numbers across mounts (of ecryptfs)? The patch doesn't look like it does.
Nope; this patch just aims to make sure that stacked and lower inodes maintain a 1-to-1 relationship.
so that won't let your cross mount points.... i.e. the 2 underlying mountpoints can have the same inode numbers, couldn't they?
Quoted 7 lines
Two underlying mountpoints can have the sane inode number. This patch will assign a unique inode number to each stacked inode while linking to the stacked inode from the lower inode to keep a 1-to-1 mapping of stacked and lower inodes. Something like this is necessary for crossing mount points in the lower filesystem while handling hard links right. There are other issues with regard to namespaces and what not that still need to be addressed.
ok, I understand, your mention of unionfs's persistent inodes confused me.