Unionfs ODF: save vfsmount and dentry (struct path) of /odf
authorErez Zadok <ezk@cs.sunysb.edu>
Fri, 30 Nov 2007 22:31:17 +0000 (17:31 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:03:25 +0000 (19:03 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/dirfops.c
fs/unionfs/dirhelper.c
fs/unionfs/export.c
fs/unionfs/odf.c
fs/unionfs/union.h

index 7d51cbe0c653b540a6ce73b9e2cc17d9db7f07f5..2ac01d364b075f0c679a458a9ed80a782d4a9ef7 100644 (file)
@@ -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;
index 3e726388bd20b4c158f651be3913c639b9d943df..7a56d6ba9a9da6f13bda74101d1ea82ffb52a99b 100644 (file)
@@ -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);
index 535039083e1e4799e634fdf163ccae9bf76e2ac3..f8bd66a3405e27cf397bb2403315674b7a5f991a 100644 (file)
@@ -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;
index 0ad2ba521db441805b8ab1e4c78b632e7c4094b3..f75ba7c73bf5b98ba25c7f176c81c252ec94f345 100644 (file)
@@ -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;
        }
index 7e75a39b4e50f9fa2ec962748c74b5754a2b66a1..399ab96bedacae479386523d03112c64454b0c26 100644 (file)
@@ -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) */