Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 269996
b: refs/heads/master
c: 9a63edd
h: refs/heads/master
v: v3
  • Loading branch information
Steven Whitehouse committed Oct 21, 2011
1 parent 29cd41f commit 2584afa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ab9bbda0204dfd0e5342562d9979d1241b14ea5f
refs/heads/master: 9a63edd12ba3c18351f00d6b77a6b2f49f2b8eb6
36 changes: 14 additions & 22 deletions trunk/fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ static int gfs2_security_init(struct gfs2_inode *dip, struct gfs2_inode *ip,

static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
unsigned int mode, dev_t dev, const char *symname,
unsigned int size)
unsigned int size, int excl)
{
const struct qstr *name = &dentry->d_name;
struct gfs2_holder ghs[2];
Expand All @@ -683,6 +683,12 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
goto fail;

error = create_ok(dip, name, mode);
if ((error == -EEXIST) && S_ISREG(mode) && !excl) {
inode = gfs2_lookupi(dir, &dentry->d_name, 0);
gfs2_glock_dq_uninit(ghs);
d_instantiate(dentry, inode);
return IS_ERR(inode) ? PTR_ERR(inode) : 0;
}
if (error)
goto fail_gunlock;

Expand Down Expand Up @@ -760,24 +766,10 @@ static int gfs2_create_inode(struct inode *dir, struct dentry *dentry,
static int gfs2_create(struct inode *dir, struct dentry *dentry,
int mode, struct nameidata *nd)
{
struct inode *inode;
int ret;

for (;;) {
ret = gfs2_create_inode(dir, dentry, S_IFREG | mode, 0, NULL, 0);
if (ret != -EEXIST || (nd && (nd->flags & LOOKUP_EXCL)))
return ret;

inode = gfs2_lookupi(dir, &dentry->d_name, 0);
if (inode) {
if (!IS_ERR(inode))
break;
return PTR_ERR(inode);
}
}

d_instantiate(dentry, inode);
return 0;
int excl = 0;
if (nd && (nd->flags & LOOKUP_EXCL))
excl = 1;
return gfs2_create_inode(dir, dentry, S_IFREG | mode, 0, NULL, 0, excl);
}

/**
Expand Down Expand Up @@ -1135,7 +1127,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,
if (size > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode) - 1)
return -ENAMETOOLONG;

return gfs2_create_inode(dir, dentry, S_IFLNK | S_IRWXUGO, 0, symname, size);
return gfs2_create_inode(dir, dentry, S_IFLNK | S_IRWXUGO, 0, symname, size, 0);
}

/**
Expand All @@ -1149,7 +1141,7 @@ static int gfs2_symlink(struct inode *dir, struct dentry *dentry,

static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
{
return gfs2_create_inode(dir, dentry, S_IFDIR | mode, 0, NULL, 0);
return gfs2_create_inode(dir, dentry, S_IFDIR | mode, 0, NULL, 0, 0);
}

/**
Expand All @@ -1164,7 +1156,7 @@ static int gfs2_mkdir(struct inode *dir, struct dentry *dentry, int mode)
static int gfs2_mknod(struct inode *dir, struct dentry *dentry, int mode,
dev_t dev)
{
return gfs2_create_inode(dir, dentry, mode, dev, NULL, 0);
return gfs2_create_inode(dir, dentry, mode, dev, NULL, 0, 0);
}

/*
Expand Down

0 comments on commit 2584afa

Please sign in to comment.