cxgb4 : Fix missing initialization of win0_lock
[sfrench/cifs-2.6.git] / fs / gfs2 / inode.c
index fc8ac2ee0667c8d66082aa48f05f9acee452a8ac..c4ed823d150e9609529ef1789874801180bcd4d9 100644 (file)
@@ -600,7 +600,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
        int error, free_vfs_inode = 0;
        u32 aflags = 0;
        unsigned blocks = 1;
-       struct gfs2_diradd da = { .bh = NULL, };
+       struct gfs2_diradd da = { .bh = NULL, .save_loc = 1, };
 
        if (!name->len || name->len > GFS2_FNAMESIZE)
                return -ENAMETOOLONG;
@@ -672,6 +672,7 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
        inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
        gfs2_set_inode_blocks(inode, 1);
        munge_mode_uid_gid(dip, inode);
+       check_and_update_goal(dip);
        ip->i_goal = dip->i_goal;
        ip->i_diskflags = 0;
        ip->i_eattr = 0;
@@ -899,7 +900,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
        struct gfs2_inode *ip = GFS2_I(inode);
        struct gfs2_holder ghs[2];
        struct buffer_head *dibh;
-       struct gfs2_diradd da = { .bh = NULL, };
+       struct gfs2_diradd da = { .bh = NULL, .save_loc = 1, };
        int error;
 
        if (S_ISDIR(inode->i_mode))
@@ -1244,6 +1245,9 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry,
        struct dentry *d;
        bool excl = !!(flags & O_EXCL);
 
+       if (!d_unhashed(dentry))
+               goto skip_lookup;
+
        d = __gfs2_lookup(dir, dentry, file, opened);
        if (IS_ERR(d))
                return PTR_ERR(d);
@@ -1260,6 +1264,8 @@ static int gfs2_atomic_open(struct inode *dir, struct dentry *dentry,
        }
 
        BUG_ON(d != NULL);
+
+skip_lookup:
        if (!(flags & O_CREAT))
                return -ENOENT;
 
@@ -1337,7 +1343,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
        struct gfs2_rgrpd *nrgd;
        unsigned int num_gh;
        int dir_rename = 0;
-       struct gfs2_diradd da = { .nr_blocks = 0, };
+       struct gfs2_diradd da = { .nr_blocks = 0, .save_loc = 0, };
        unsigned int x;
        int error;