* [PATCH 0/2] overlayfs: module and statfs fixes
@ 2010-10-01 17:48 Andy Whitcroft
2010-10-01 17:48 ` [PATCH 1/2] overlayfs: export security_inode_permission to allow overlayfs to be modular Andy Whitcroft
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andy Whitcroft @ 2010-10-01 17:48 UTC (permalink / raw)
To: Miklos Szeredi
Cc: linux-fsdevel, linux-kernel, vaurora, neilb, viro, Andy Whitcroft
Just been playing with overlayfs and hit a couple of issues. First I
was not able to build this filesystem as a module. Second statfs support
was missing. Following this email are a couple of patches which I used to
fix these up. I am not 100% sure the statfs approach is quite right, but
its not clear the semantics can ever be correct in the face of an overlay.
With these applied I was able to drop an overlay over the top of a very
out of date Ubuntu chroot and upgrade it to the latest and greatest;
all without incident.
Nice.
-apw
Andy Whitcroft (2):
overlayfs: export security_inode_permission to allow overlayfs to be
modular
overlayfs: add statfs support
fs/overlayfs/overlayfs.c | 20 ++++++++++++++++++++
security/security.c | 1 +
2 files changed, 21 insertions(+), 0 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] overlayfs: export security_inode_permission to allow overlayfs to be modular
2010-10-01 17:48 [PATCH 0/2] overlayfs: module and statfs fixes Andy Whitcroft
@ 2010-10-01 17:48 ` Andy Whitcroft
2010-10-01 17:48 ` [PATCH 2/2] overlayfs: add statfs support Andy Whitcroft
2010-10-04 9:49 ` [PATCH 0/2] overlayfs: module and statfs fixes Miklos Szeredi
2 siblings, 0 replies; 4+ messages in thread
From: Andy Whitcroft @ 2010-10-01 17:48 UTC (permalink / raw)
To: Miklos Szeredi
Cc: linux-fsdevel, linux-kernel, vaurora, neilb, viro, Andy Whitcroft
When compiling overlayfs as a module we end up with an unknown symbol
'security_inode_permission'. Export it.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
security/security.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/security/security.c b/security/security.c
index ca39940..b8329cc 100644
--- a/security/security.c
+++ b/security/security.c
@@ -556,6 +556,7 @@ int security_inode_permission(struct inode *inode, int mask)
return 0;
return security_ops->inode_permission(inode, mask);
}
+EXPORT_SYMBOL_GPL(security_inode_permission);
int security_inode_setattr(struct dentry *dentry, struct iattr *attr)
{
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] overlayfs: add statfs support
2010-10-01 17:48 [PATCH 0/2] overlayfs: module and statfs fixes Andy Whitcroft
2010-10-01 17:48 ` [PATCH 1/2] overlayfs: export security_inode_permission to allow overlayfs to be modular Andy Whitcroft
@ 2010-10-01 17:48 ` Andy Whitcroft
2010-10-04 9:49 ` [PATCH 0/2] overlayfs: module and statfs fixes Miklos Szeredi
2 siblings, 0 replies; 4+ messages in thread
From: Andy Whitcroft @ 2010-10-01 17:48 UTC (permalink / raw)
To: Miklos Szeredi
Cc: linux-fsdevel, linux-kernel, vaurora, neilb, viro, Andy Whitcroft
Add support for statfs to the overlayfs filesystem. As the upper layer
is the target of all write operations assume that the space in that
filesystem is the space in the overlayfs. There will be some inaccuracy as
overwriting a file will copy it up and consume space we were not expecting,
but it is better than nothing.
Use the upper layer dentry and mount from the overlayfs root inode,
passing the statfs call to that filesystem.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
---
fs/overlayfs/overlayfs.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/fs/overlayfs/overlayfs.c b/fs/overlayfs/overlayfs.c
index 61139fa..2bef9c1 100644
--- a/fs/overlayfs/overlayfs.c
+++ b/fs/overlayfs/overlayfs.c
@@ -1943,9 +1943,29 @@ static int ovl_remount_fs(struct super_block *sb, int *flagsp, char *data)
return mnt_want_write(ufs->upper_mnt);
}
+/**
+ * ovl_statfs
+ * @sb: The overlayfs super block
+ * @buf: The struct kstatfs to fill in with stats
+ *
+ * Get the filesystem statistics. As writes always target the upper layer
+ * filesystem pass the statfs to the same filesystem.
+ */
+static int ovl_statfs(struct dentry *dentry, struct kstatfs *buf)
+{
+ struct dentry *root_dentry = dentry->d_sb->s_root;
+ struct path path;
+ ovl_path_upper(root_dentry, &path);
+
+ if (!path.dentry->d_sb->s_op->statfs)
+ return -ENOSYS;
+ return path.dentry->d_sb->s_op->statfs(path.dentry, buf);
+}
+
static const struct super_operations ovl_super_operations = {
.put_super = ovl_put_super,
.remount_fs = ovl_remount_fs,
+ .statfs = ovl_statfs,
};
struct ovl_config {
--
1.7.0.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] overlayfs: module and statfs fixes
2010-10-01 17:48 [PATCH 0/2] overlayfs: module and statfs fixes Andy Whitcroft
2010-10-01 17:48 ` [PATCH 1/2] overlayfs: export security_inode_permission to allow overlayfs to be modular Andy Whitcroft
2010-10-01 17:48 ` [PATCH 2/2] overlayfs: add statfs support Andy Whitcroft
@ 2010-10-04 9:49 ` Miklos Szeredi
2 siblings, 0 replies; 4+ messages in thread
From: Miklos Szeredi @ 2010-10-04 9:49 UTC (permalink / raw)
To: Andy Whitcroft
Cc: miklos, linux-fsdevel, linux-kernel, vaurora, neilb, viro, apw
On Fri, 1 Oct 2010, Andy Whitcroft wrote:
> Just been playing with overlayfs and hit a couple of issues. First I
> was not able to build this filesystem as a module. Second statfs support
> was missing. Following this email are a couple of patches which I used to
> fix these up. I am not 100% sure the statfs approach is quite right, but
> its not clear the semantics can ever be correct in the face of an overlay.
Applied both patches and pused to the overlayfs.v3 branch. Also
pushed a patch changing two BUG_ONs to WARN_ON.
>
> With these applied I was able to drop an overlay over the top of a very
> out of date Ubuntu chroot and upgrade it to the latest and greatest;
> all without incident.
Great, thanks for testing.
Miklos
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-04 9:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-01 17:48 [PATCH 0/2] overlayfs: module and statfs fixes Andy Whitcroft
2010-10-01 17:48 ` [PATCH 1/2] overlayfs: export security_inode_permission to allow overlayfs to be modular Andy Whitcroft
2010-10-01 17:48 ` [PATCH 2/2] overlayfs: add statfs support Andy Whitcroft
2010-10-04 9:49 ` [PATCH 0/2] overlayfs: module and statfs fixes Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).