commit 444771b3e992946a43b04a827b8085c415139a61
Author: Erez Zadok <[EMAIL PROTECTED]>
Date:   Fri Nov 30 17:31:17 2007 -0500

    Unionfs ODF: save vfsmount and dentry (struct path) of /odf
    
    Signed-off-by: Erez Zadok <[EMAIL PROTECTED]>

diff --git a/fs/unionfs/dirfops.c b/fs/unionfs/dirfops.c
index 7d51cbe..2ac01d3 100644
--- a/fs/unionfs/dirfops.c
+++ b/fs/unionfs/dirfops.c
@@ -73,13 +73,13 @@ static int unionfs_readdir(struct file *file, void *dirent, 
filldir_t filldir)
        }
 
        dget(odf_cache);
-       mntget(UNIONFS_SB(file->f_path.dentry->d_sb)->odf.mnt);
+       mntget(UNIONFS_SB(file->f_path.dentry->d_sb)->odf.path.mnt);
        odf_file = dentry_open(odf_cache,
-                              UNIONFS_SB(file->f_path.dentry->d_sb)->odf.mnt,
+                              
UNIONFS_SB(file->f_path.dentry->d_sb)->odf.path.mnt,
                               O_RDONLY);
        if (IS_ERR(odf_file)) {
                err = PTR_ERR(odf_file);
-               mntput(UNIONFS_SB(file->f_path.dentry->d_sb)->odf.mnt);
+               mntput(UNIONFS_SB(file->f_path.dentry->d_sb)->odf.path.mnt);
                dput(odf_cache);
                odf_file = NULL;
                goto out;
diff --git a/fs/unionfs/dirhelper.c b/fs/unionfs/dirhelper.c
index 3e72638..7a56d6b 100644
--- a/fs/unionfs/dirhelper.c
+++ b/fs/unionfs/dirhelper.c
@@ -337,7 +337,7 @@ retry:
                        goto out;
        }
        dget(d_odf);
-       mntget(UNIONFS_SB(sb)->odf.mnt);
+       mntget(UNIONFS_SB(sb)->odf.path.mnt);
 
        /* force truncate if file exists */
        if (i_odf) {
@@ -348,12 +348,12 @@ retry:
                        goto out;
        }
        odf_file = dentry_open(d_odf,
-                              UNIONFS_SB(sb)->odf.mnt,
+                              UNIONFS_SB(sb)->odf.path.mnt,
                               O_TRUNC|O_CREAT|O_WRONLY);
        if (IS_ERR(odf_file)) {
                err = PTR_ERR(odf_file);
                dput(d_odf);
-               mntput(UNIONFS_SB(sb)->odf.mnt);
+               mntput(UNIONFS_SB(sb)->odf.path.mnt);
                odf_file = NULL;
                goto out;
        }
@@ -591,7 +591,7 @@ int odf_cleanup(struct odf_sb_info *odf, int mode, u64 
b_to_free,
                goto out;
        }
        buf->err = 0;
-       buf->mnt = odf->mnt;
+       buf->mnt = odf->path.mnt;
        buf->mode = CLN_IC;
        buf->blocks = 0;
        buf->inodes = 0;
@@ -616,9 +616,9 @@ cleanup_loop:
                 */
                if (buf->mode != CLN_IC)
                        dget(dentry);
-               mntget(odf->mnt);
+               mntget(odf->path.mnt);
 
-               file = dentry_open(dentry, odf->mnt, O_RDONLY);
+               file = dentry_open(dentry, odf->path.mnt, O_RDONLY);
                if (IS_ERR(file)) {
                        err = PTR_ERR(file);
                        dput(dentry);
diff --git a/fs/unionfs/export.c b/fs/unionfs/export.c
index 5350390..f8bd66a 100644
--- a/fs/unionfs/export.c
+++ b/fs/unionfs/export.c
@@ -235,12 +235,12 @@ static int unionfs_get_name(struct dentry *dentry, char 
*name,
        }
 
        dget(odf_cache);
-       mntget(UNIONFS_SB(dentry->d_sb)->odf.mnt);
-       file = dentry_open(odf_cache, UNIONFS_SB(dentry->d_sb)->odf.mnt,
+       mntget(UNIONFS_SB(dentry->d_sb)->odf.path.mnt);
+       file = dentry_open(odf_cache, UNIONFS_SB(dentry->d_sb)->odf.path.mnt,
                           O_RDONLY);
        if (IS_ERR(file)) {
                err = PTR_ERR(file);
-               mntput(UNIONFS_SB(dentry->d_sb)->odf.mnt);
+               mntput(UNIONFS_SB(dentry->d_sb)->odf.path.mnt);
                dput(odf_cache);
                file = NULL;
                goto out;
diff --git a/fs/unionfs/odf.c b/fs/unionfs/odf.c
index 0ad2ba5..f75ba7c 100644
--- a/fs/unionfs/odf.c
+++ b/fs/unionfs/odf.c
@@ -210,9 +210,9 @@ int odf_read_super(struct super_block *sb, char *data)
                               ODF_CLEAN_DEFAULT :
                               ODF_CLEAN_SR|ODF_CLEAN_FULL);
        osi->cleanup = sioa;
-       osi->mnt = nd.mnt;
-       mntget(osi->mnt);
-       dget(nd.dentry);
+       osi->path.mnt = nd.mnt;
+       osi->path.dentry = nd.dentry;
+       pathget(&osi->path);
        path_release(&nd);
        goto out;
 
@@ -244,15 +244,10 @@ out:
  */
 void odf_put_super(struct odf_sb_info *osi)
 {
-       struct dentry *odf_root = NULL;
-
        if (osi->cleanup)
                complete_sioa(osi->cleanup);
        kfree(osi->cleanup);
 
-       if (osi->sb)
-               odf_root = osi->sb->d_parent;
-
        dput(osi->ns);
        osi->ns = NULL;
        dput(osi->rc);
@@ -268,8 +263,7 @@ void odf_put_super(struct odf_sb_info *osi)
        kfree(osi->branch_uuids);
        osi->branch_uuids = NULL;
 
-       dput(odf_root);
-       mntput(osi->mnt);
+       pathput(&osi->path);
 }
 
 /*
@@ -743,13 +737,13 @@ int odf_copyup_link(struct super_block *sb, struct dentry 
*old_dentry,
 
        /* open the file */
        dget(links);
-       mntget(osi->mnt);
-       link_file = dentry_open(links, osi->mnt, O_RDWR);
+       mntget(osi->path.mnt);
+       link_file = dentry_open(links, osi->path.mnt, O_RDWR);
        if (IS_ERR(link_file)) {
                err = PTR_ERR(link_file);
                link_file = NULL;
                dput(links);
-               mntput(osi->mnt);
+               mntput(osi->path.mnt);
                goto out;
        }
 
@@ -1033,13 +1027,13 @@ int odf_lookup(struct dentry *parent, struct dentry 
*dentry, int flags)
 
                /* open the file */
                dget(links);
-               mntget(osi->mnt);
-               link_file = dentry_open(links, osi->mnt, O_RDWR);
+               mntget(osi->path.mnt);
+               link_file = dentry_open(links, osi->path.mnt, O_RDWR);
                if (IS_ERR(link_file)) {
                        err = PTR_ERR(link_file);
                        link_file = NULL;
                        dput(links);
-                       mntput(osi->mnt);
+                       mntput(osi->path.mnt);
                        goto out;
                }
 
@@ -1754,7 +1748,7 @@ int odf_write_sb_data(struct odf_sb_info *osi, struct 
unionfs_data *data,
                goto out;
        }
 
-       odf_mnt = osi->mnt;
+       odf_mnt = osi->path.mnt;
 
        d_content = osi->sb;
        if (IS_ERR(d_content) || !d_content) {
@@ -1921,10 +1915,10 @@ char *odf_read_sb_data(struct odf_sb_info *odf_sb, int 
**bid)
                goto out_err;
        }
 
-       mntget(odf_sb->mnt);
-       file = dentry_open(d_content, odf_sb->mnt, O_RDONLY);
+       mntget(odf_sb->path.mnt);
+       file = dentry_open(d_content, odf_sb->path.mnt, O_RDONLY);
        if (IS_ERR(file)) {
-               mntput(odf_sb->mnt);
+               mntput(odf_sb->path.mnt);
                dput(d_content);
                goto out_err;
        }
diff --git a/fs/unionfs/union.h b/fs/unionfs/union.h
index 7e75a39..399ab96 100644
--- a/fs/unionfs/union.h
+++ b/fs/unionfs/union.h
@@ -120,7 +120,7 @@ struct odf_dentry_info {
 
 /* odf sb data */
 struct odf_sb_info {
-       struct vfsmount *mnt;           /* odf vfsmount */
+       struct path path;               /* odf path (vfsmount+dentry) */
        struct dentry *ns;              /* namespace (/odf/ns) */
        struct dentry *rc;              /* reclaim (/odf/reclaim) */
        struct dentry *ic;              /* inode cache (/odf/ic) */
_______________________________________________
unionfs-cvs mailing list: http://unionfs.filesystems.org/
[email protected]
http://www.fsl.cs.sunysb.edu/mailman/listinfo/unionfs-cvs

Reply via email to