Unionfs ODF: create and pass lower_nd to vfs_create
authorErez Zadok <ezk@cs.sunysb.edu>
Mon, 19 Nov 2007 02:46:07 +0000 (21:46 -0500)
committerRachita Kothiyal <rachita@dewey.fsl.cs.sunysb.edu>
Thu, 1 May 2008 23:03:20 +0000 (19:03 -0400)
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
fs/unionfs/odf.c

index 5a2972aad0536bcd9efb7fb26950e8def4ec502e..9d5a4f584ef099061bbc8c54bfe402adb41618c2 100644 (file)
@@ -48,6 +48,7 @@ int __odf_create_hierarchy(struct dentry *odf_root)
 {
        struct dentry *dentry = NULL;
        int err = 0;
+       struct nameidata lower_nd;
 
        dentry = __odf_create_dir(odf_root, ODF_NS);
        if (IS_ERR(dentry)) {
@@ -87,7 +88,11 @@ int __odf_create_hierarchy(struct dentry *odf_root)
                err = -EEXIST;
                goto out;
        }
-       err = vfs_create(odf_root->d_inode, dentry, S_IRWXUGO, NULL);
+       err = init_lower_nd(&lower_nd, LOOKUP_CREATE);
+       if (unlikely(err < 0))
+               goto out;
+       err = vfs_create(odf_root->d_inode, dentry, S_IRWXUGO, &lower_nd);
+       release_lower_nd(&lower_nd, err);
 
 out:
        dput(dentry);
@@ -1163,9 +1168,15 @@ retry:
                        vfs_link(link, odf_dentry->d_parent->d_inode,
                                 odf_dentry);
                } else if (flags & ODF_LOOKUP_FILE) {
+                       struct nameidata lower_nd;
+                       err = init_lower_nd(&lower_nd, LOOKUP_CREATE);
+                       if (unlikely(err < 0))
+                               goto out;
                        current->fsuid = 0;
                        current->fsgid = 0;
-                       err = vfs_create(odf_i_dir, odf_dentry, S_IRWXUGO, 0);
+                       err = vfs_create(odf_i_dir, odf_dentry, S_IRWXUGO,
+                                        &lower_nd);
+                       release_lower_nd(&lower_nd, err);
                } else if (flags & ODF_LOOKUP_WH) {
                        current->fsuid = 0;
                        current->fsgid = 0;
@@ -1321,7 +1332,13 @@ struct dentry *odf_ic_dentry(struct odf_sb_info *osi, u64 ino, char *name,
                goto out;
        }
        if (!ret->d_inode) {
-               err = vfs_create(dirs[3]->d_inode, ret, S_IRWXUGO, 0);
+               struct nameidata lower_nd;
+               err = init_lower_nd(&lower_nd, LOOKUP_CREATE);
+               if (unlikely(err < 0))
+                       goto out;
+               err = vfs_create(dirs[3]->d_inode, ret, S_IRWXUGO,
+                       &lower_nd);
+               release_lower_nd(&lower_nd, err);
                if (err)
                        dput(ret);
        }
@@ -1755,8 +1772,13 @@ int odf_write_sb_data(struct odf_sb_info *osi, struct unionfs_data *data,
                        goto out;
                }
        } else {
+               struct nameidata lower_nd;
+               err = init_lower_nd(&lower_nd, LOOKUP_CREATE);
+               if (unlikely(err < 0))
+                       goto out;
                err = vfs_create(d_content->d_parent->d_inode, d_content,
-                                S_IRWXUGO, NULL);
+                                S_IRWXUGO, &lower_nd);
+               release_lower_nd(&lower_nd, err);
                if (err)
                        goto out;
        }