]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/ocfs2/namei.c
Merge branch 'master' into next
[net-next-2.6.git] / fs / ocfs2 / namei.c
index 485a6aa0ad39060e9eb27f2897be98026b886d4c..2545e7402efed1453d69347c676beaf2231043e0 100644 (file)
@@ -378,8 +378,8 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
        }
 
        inode = new_inode(dir->i_sb);
-       if (IS_ERR(inode)) {
-               status = PTR_ERR(inode);
+       if (!inode) {
+               status = -ENOMEM;
                mlog(ML_ERROR, "new_inode failed!\n");
                goto leave;
        }
@@ -421,13 +421,13 @@ static int ocfs2_mknod_locked(struct ocfs2_super *osb,
        fe->i_blkno = cpu_to_le64(fe_blkno);
        fe->i_suballoc_bit = cpu_to_le16(suballoc_bit);
        fe->i_suballoc_slot = cpu_to_le16(inode_ac->ac_alloc_slot);
-       fe->i_uid = cpu_to_le32(current->fsuid);
+       fe->i_uid = cpu_to_le32(current_fsuid());
        if (dir->i_mode & S_ISGID) {
                fe->i_gid = cpu_to_le32(dir->i_gid);
                if (S_ISDIR(mode))
                        mode |= S_ISGID;
        } else
-               fe->i_gid = cpu_to_le32(current->fsgid);
+               fe->i_gid = cpu_to_le32(current_fsgid());
        fe->i_mode = cpu_to_le16(mode);
        if (S_ISCHR(mode) || S_ISBLK(mode))
                fe->id1.dev1.i_rdev = cpu_to_le64(huge_encode_dev(dev));
@@ -491,8 +491,10 @@ leave:
                        brelse(*new_fe_bh);
                        *new_fe_bh = NULL;
                }
-               if (inode)
+               if (inode) {
+                       clear_nlink(inode);
                        iput(inode);
+               }
        }
 
        mlog_exit(status);