dazuko-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Dazuko-devel] DazukoFS 3.0.0-rc2 posted


From: Ann Davis
Subject: Re: [Dazuko-devel] DazukoFS 3.0.0-rc2 posted
Date: Tue, 04 Nov 2008 12:35:22 -0700
User-agent: Thunderbird 2.0.0.17 (X11/20080914)

John Ogness wrote:
On 2008-11-03, jim burns <address@hidden> wrote:
John - had any luck deciphering the fs/ecryptfs/inode.c file you had
me post yet?

As stated by Ann in a follow-up post, most of the vfs functions take
an additional vfsmount argument. I've created a patch against
dazukofs-3.0.0-rc3 that should work for you. I couldn't actually test
it, so hopefully I didn't miss any careless mistakes. Let me know if
this works for you.

John, thanks for the patch; I tried it on openSUSE 11.0. It compiles with warnings but the resulting dazukofs module does not load (segmentation error). The following patch incorporates your patch and makes a few other changes to address the compile warnings. Using this patch does create a dazukofs.ko that will load, but I haven't done any functional testing. I assume that we can't really test w/ AntiVir until Avira supports dazukofs, right?

Ann

diff -Nurp a//ctrl_dev.c c//ctrl_dev.c
--- a//ctrl_dev.c    2008-11-04 11:36:52.000000000 -0700
+++ c//ctrl_dev.c    2008-11-04 11:48:34.000000000 -0700
@@ -178,7 +178,7 @@ int dazukofs_ctrl_dev_init(int dev_major

    /* create control device */
    dev = device_create(dazukofs_class, NULL, MKDEV(dev_major, dev_minor),
-                NULL, "%s.ctrl", DEVICE_NAME);
+                "%s.ctrl", DEVICE_NAME);
    if (IS_ERR(dev)) {
        err = PTR_ERR(dev);
        goto error_out2;
diff -Nurp a//group_dev.c c//group_dev.c
--- a//group_dev.c    2008-11-04 11:36:53.000000000 -0700
+++ c//group_dev.c    2008-11-04 11:47:55.000000000 -0700
@@ -210,7 +210,7 @@ int dazukofs_group_dev_init(int dev_majo
    /* create group devices */
    for (i = 0; i < GROUP_COUNT; i++) {
        dev = device_create(dazukofs_class, NULL,
-                    MKDEV(dev_major, dev_minor_end), NULL,
+                    MKDEV(dev_major, dev_minor_end),
                    "%s.%d", DEVICE_NAME, i);
        if (IS_ERR(dev)) {
            err = PTR_ERR(dev);
diff -Nurp a//inode.c c//inode.c
--- a//inode.c    2008-11-04 11:36:53.000000000 -0700
+++ c//inode.c    2008-11-04 08:51:26.000000000 -0700
@@ -284,6 +284,7 @@ static int dazukofs_mknod(struct inode *
              dev_t dev)
{
    struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
    struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
    struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
    int err = -ENOENT;
@@ -291,7 +292,8 @@ static int dazukofs_mknod(struct inode *
    mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
              I_MUTEX_PARENT);

-    err = vfs_mknod(lower_dentry_parent_inode, lower_dentry, mode, dev);
+    err = vfs_mknod(lower_dentry_parent_inode, lower_dentry, lower_mnt,
+            mode, dev);
    if (err)
        goto out;

@@ -325,6 +327,7 @@ out:
static int dazukofs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
    struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
    struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
    struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
    int err = -ENOENT;
@@ -332,7 +335,8 @@ static int dazukofs_mkdir(struct inode *
    mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
              I_MUTEX_PARENT);

-    err = vfs_mkdir(lower_dentry_parent_inode, lower_dentry, mode);
+    err = vfs_mkdir(lower_dentry_parent_inode, lower_dentry, lower_mnt,
+            mode);
    if (err)
        goto out;

@@ -429,14 +433,17 @@ static int dazukofs_symlink(struct inode
                const char *symname)
{
    struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
    struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
    struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
+    umode_t mode = S_IALLUGO;
    int err = -ENOENT;

    mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
              I_MUTEX_PARENT);

-    err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, symname);
+    err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, lower_mnt,
+              symname, mode);
    if (err)
        goto out;

@@ -581,9 +588,28 @@ static void dazukofs_put_link(struct den
 *
 * Returns some result.
 */
-static int dazukofs_permission(struct inode *inode, int mask)
+static int dazukofs_permission(struct inode *inode, int mask,
+                   struct nameidata *nd)
{
-    return inode_permission(GET_LOWER_INODE(inode), mask);
+    struct vfsmount *vfsmnt_save = NULL;
+    struct dentry *dentry_save = NULL;
+    int rc;
+
+    if (nd) {
+        vfsmnt_save = nd->path.mnt;
+        dentry_save = nd->path.dentry;
+        nd->path.mnt = GET_LOWER_MNT(nd->path.dentry);
+        nd->path.dentry = GET_LOWER_DENTRY(nd->path.dentry);
+    }
+
+    rc = permission(GET_LOWER_INODE(inode), mask, nd);
+
+    if (nd) {
+        nd->path.mnt = vfsmnt_save;
+        nd->path.dentry = dentry_save;
+    }
+
+    return rc;
}

/**
@@ -601,11 +627,12 @@ static int dazukofs_permission(struct in
static int dazukofs_setattr(struct dentry *dentry, struct iattr *ia)
{
    struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
    struct inode *inode = dentry->d_inode;
    struct inode *lower_inode = GET_LOWER_INODE(inode);
    int err;

-    err = notify_change(lower_dentry, ia);
+    err = notify_change(lower_dentry, lower_mnt, ia);

    fsstack_copy_attr_all(inode, lower_inode, NULL);
    fsstack_copy_inode_size(inode, lower_inode);
@@ -786,6 +813,8 @@ static int dazukofs_link(struct dentry *
{
    struct dentry *lower_old_dentry = GET_LOWER_DENTRY(old_dentry);
    struct dentry *lower_new_dentry = GET_LOWER_DENTRY(new_dentry);
+    struct vfsmount *lower_old_mnt = GET_LOWER_MNT(old_dentry);
+    struct vfsmount *lower_new_mnt = GET_LOWER_MNT(new_dentry);
    struct dentry *lower_dentry_parent = dget(lower_new_dentry->d_parent);
    struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
    int err = -ENOENT;
@@ -793,8 +822,9 @@ static int dazukofs_link(struct dentry *
    mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
              I_MUTEX_PARENT);

-    err = vfs_link(lower_old_dentry, lower_dentry_parent_inode,
-               lower_new_dentry);
+    err = vfs_link(lower_old_dentry, lower_old_mnt,
+               lower_dentry_parent_inode, lower_new_dentry,
+               lower_new_mnt);
    if (err)
        goto out;

@@ -826,6 +856,7 @@ out:
static int dazukofs_unlink(struct inode *dir, struct dentry *dentry)
{
    struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
    struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
    struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
    int err;
@@ -833,7 +864,7 @@ static int dazukofs_unlink(struct inode
    mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
              I_MUTEX_PARENT);

-    err = vfs_unlink(lower_dentry_parent_inode, lower_dentry);
+    err = vfs_unlink(lower_dentry_parent_inode, lower_dentry, lower_mnt);
    if (err)
        goto out;

@@ -863,6 +894,7 @@ out:
static int dazukofs_rmdir(struct inode *dir, struct dentry *dentry)
{
    struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
+    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
    struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
    struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
    int err;
@@ -870,7 +902,7 @@ static int dazukofs_rmdir(struct inode *
    mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
              I_MUTEX_PARENT);

-    err = vfs_rmdir(lower_dentry_parent_inode, lower_dentry);
+    err = vfs_rmdir(lower_dentry_parent_inode, lower_dentry, lower_mnt);
    if (err)
        goto out;

@@ -905,6 +937,8 @@ static int dazukofs_rename(struct inode
{
    struct dentry *lower_old_dentry = GET_LOWER_DENTRY(old_dentry);
    struct dentry *lower_new_dentry = GET_LOWER_DENTRY(new_dentry);
+    struct vfsmount *lower_old_mnt = GET_LOWER_MNT(old_dentry);
+    struct vfsmount *lower_new_mnt = GET_LOWER_MNT(new_dentry);
    struct dentry *lower_old_dentry_parent =
        dget(lower_old_dentry->d_parent);
    struct dentry *lower_new_dentry_parent =
@@ -927,7 +961,8 @@ static int dazukofs_rename(struct inode

    lock_rename(lower_old_dentry_parent, lower_new_dentry_parent);
    err = vfs_rename(lower_old_dentry_parent_inode, lower_old_dentry,
-             lower_new_dentry_parent_inode, lower_new_dentry);
+             lower_old_mnt, lower_new_dentry_parent_inode,
+             lower_new_dentry, lower_new_mnt);
    unlock_rename(lower_old_dentry_parent, lower_new_dentry_parent);

    if (err)
diff -Nurp a//modules.order c//modules.order
--- a//modules.order    2008-11-04 11:36:53.000000000 -0700
+++ c//modules.order    2008-11-04 11:53:06.000000000 -0700
@@ -1 +1 @@
-kernel//root/data/dazukofs-3.0.0/dazukofs/dazukofs-3.0.0-rc3/dazukofs.ko
+kernel//root/dazukofs-3.0.0/dazukofs/c/dazukofs.ko
diff -Nurp a//super.c c//super.c
--- a//super.c    2008-11-04 11:36:53.000000000 -0700
+++ c//super.c    2008-11-04 11:43:17.000000000 -0700
@@ -396,7 +396,7 @@ static int init_caches(void)
        kmem_cache_create("dazukofs_inode_info_cache",
                  sizeof(struct dazukofs_inode_info), 0,
                  SLAB_HWCACHE_ALIGN,
-                  init_once);
+                  (void *)init_once);
    if (!dazukofs_inode_info_cachep)
        goto out_nomem;

diff -Nurp a//suse-vfs_mknod.patch c//suse-vfs_mknod.patch
--- a//suse-vfs_mknod.patch    1969-12-31 17:00:00.000000000 -0700
+++ c//suse-vfs_mknod.patch    2008-11-04 08:51:19.000000000 -0700
@@ -0,0 +1,180 @@
+inode.c |   57 +++++++++++++++++++++++++++++++++++++++++++-----------
+ 1 file changed, 46 insertions(+), 11 deletions(-)
+diff -Nurp a/inode.c b/inode.c
+--- a/inode.c    2008-10-25 00:58:45.000000000 +0200
++++ b/inode.c    2008-11-03 20:17:35.000000000 +0100
+@@ -284,6 +284,7 @@ static int dazukofs_mknod(struct inode *
+               dev_t dev)
+ {
+     struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
++    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
+     struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
+ struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
+     int err = -ENOENT;
+@@ -291,7 +292,8 @@ static int dazukofs_mknod(struct inode *
+     mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
+               I_MUTEX_PARENT);
+
+-    err = vfs_mknod(lower_dentry_parent_inode, lower_dentry, mode, dev);
++    err = vfs_mknod(lower_dentry_parent_inode, lower_dentry, lower_mnt,
++            mode, dev);
+     if (err)
+         goto out;
+
+@@ -325,6 +327,7 @@ out:
+ static int dazukofs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+ {
+     struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
++    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
+     struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
+ struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
+     int err = -ENOENT;
+@@ -332,7 +335,8 @@ static int dazukofs_mkdir(struct inode *
+     mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
+               I_MUTEX_PARENT);
+
+-    err = vfs_mkdir(lower_dentry_parent_inode, lower_dentry, mode);
++    err = vfs_mkdir(lower_dentry_parent_inode, lower_dentry, lower_mnt,
++            mode);
+     if (err)
+         goto out;
+
+@@ -429,14 +433,17 @@ static int dazukofs_symlink(struct inode
+                 const char *symname)
+ {
+     struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
++    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
+     struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
+ struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
++    umode_t mode = S_IALLUGO;
+     int err = -ENOENT;
+
+     mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
+               I_MUTEX_PARENT);
+
+-    err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, symname);
++    err = vfs_symlink(lower_dentry_parent_inode, lower_dentry, lower_mnt,
++              symname, mode);
+     if (err)
+         goto out;
+
+@@ -581,9 +588,28 @@ static void dazukofs_put_link(struct den
+  *
+  * Returns some result.
+  */
+-static int dazukofs_permission(struct inode *inode, int mask)
++static int dazukofs_permission(struct inode *inode, int mask,
++                   struct nameidata *nd)
+ {
+-    return inode_permission(GET_LOWER_INODE(inode), mask);
++    struct vfsmount *vfsmnt_save = NULL;
++    struct dentry *dentry_save = NULL;
++    int rc;
++
++    if (nd) {
++        vfsmnt_save = nd->path.mnt;
++        dentry_save = nd->path.dentry;
++        nd->path.mnt = GET_LOWER_MNT(nd->path.dentry);
++        nd->path.dentry = GET_LOWER_DENTRY(nd->path.dentry);
++    }
++
++    rc = permission(GET_LOWER_INODE(inode), mask, nd);
++
++    if (nd) {
++        nd->path.mnt = vfsmnt_save;
++        nd->path.dentry = dentry_save;
++    }
++
++    return rc;
+ }
+
+ /**
+@@ -601,11 +627,12 @@ static int dazukofs_permission(struct in
+ static int dazukofs_setattr(struct dentry *dentry, struct iattr *ia)
+ {
+     struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
++    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
+     struct inode *inode = dentry->d_inode;
+     struct inode *lower_inode = GET_LOWER_INODE(inode);
+     int err;
+
+-    err = notify_change(lower_dentry, ia);
++    err = notify_change(lower_dentry, lower_mnt, ia);
+
+     fsstack_copy_attr_all(inode, lower_inode, NULL);
+     fsstack_copy_inode_size(inode, lower_inode);
+@@ -786,6 +813,8 @@ static int dazukofs_link(struct dentry *
+ {
+     struct dentry *lower_old_dentry = GET_LOWER_DENTRY(old_dentry);
+     struct dentry *lower_new_dentry = GET_LOWER_DENTRY(new_dentry);
++    struct vfsmount *lower_old_mnt = GET_LOWER_MNT(old_dentry);
++    struct vfsmount *lower_new_mnt = GET_LOWER_MNT(new_dentry);
+     struct dentry *lower_dentry_parent = dget(lower_new_dentry->d_parent);
+ struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
+     int err = -ENOENT;
+@@ -793,8 +822,9 @@ static int dazukofs_link(struct dentry *
+     mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
+               I_MUTEX_PARENT);
+
+-    err = vfs_link(lower_old_dentry, lower_dentry_parent_inode,
+-               lower_new_dentry);
++    err = vfs_link(lower_old_dentry, lower_old_mnt,
++               lower_dentry_parent_inode, lower_new_dentry,
++               lower_new_mnt);
+     if (err)
+         goto out;
+
+@@ -826,6 +856,7 @@ out:
+ static int dazukofs_unlink(struct inode *dir, struct dentry *dentry)
+ {
+     struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
++    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
+     struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
+ struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
+     int err;
+@@ -833,7 +864,7 @@ static int dazukofs_unlink(struct inode
+     mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
+               I_MUTEX_PARENT);
+
+-    err = vfs_unlink(lower_dentry_parent_inode, lower_dentry);
++    err = vfs_unlink(lower_dentry_parent_inode, lower_dentry, lower_mnt);
+     if (err)
+         goto out;
+
+@@ -863,6 +894,7 @@ out:
+ static int dazukofs_rmdir(struct inode *dir, struct dentry *dentry)
+ {
+     struct dentry *lower_dentry = GET_LOWER_DENTRY(dentry);
++    struct vfsmount *lower_mnt = GET_LOWER_MNT(dentry);
+     struct dentry *lower_dentry_parent = dget(lower_dentry->d_parent);
+ struct inode *lower_dentry_parent_inode = lower_dentry_parent->d_inode;
+     int err;
+@@ -870,7 +902,7 @@ static int dazukofs_rmdir(struct inode *
+     mutex_lock_nested(&(lower_dentry_parent_inode->i_mutex),
+               I_MUTEX_PARENT);
+
+-    err = vfs_rmdir(lower_dentry_parent_inode, lower_dentry);
++    err = vfs_rmdir(lower_dentry_parent_inode, lower_dentry, lower_mnt);
+     if (err)
+         goto out;
+
+@@ -905,6 +937,8 @@ static int dazukofs_rename(struct inode
+ {
+     struct dentry *lower_old_dentry = GET_LOWER_DENTRY(old_dentry);
+     struct dentry *lower_new_dentry = GET_LOWER_DENTRY(new_dentry);
++    struct vfsmount *lower_old_mnt = GET_LOWER_MNT(old_dentry);
++    struct vfsmount *lower_new_mnt = GET_LOWER_MNT(new_dentry);
+     struct dentry *lower_old_dentry_parent =
+         dget(lower_old_dentry->d_parent);
+     struct dentry *lower_new_dentry_parent =
+@@ -927,7 +961,8 @@ static int dazukofs_rename(struct inode
+
+     lock_rename(lower_old_dentry_parent, lower_new_dentry_parent);
+     err = vfs_rename(lower_old_dentry_parent_inode, lower_old_dentry,
+-             lower_new_dentry_parent_inode, lower_new_dentry);
++             lower_old_mnt, lower_new_dentry_parent_inode,
++             lower_new_dentry, lower_new_mnt);
+     unlock_rename(lower_old_dentry_parent, lower_new_dentry_parent);
+
+     if (err)
+






reply via email to

[Prev in Thread] Current Thread [Next in Thread]