Skip to content

Commit

Permalink
Merge tag 'for-linus-4.20-ofs1' of git://git.kernel.org/pub/scm/linux…
Browse files Browse the repository at this point in the history
…/kernel/git/hubcap/linux

Pull orangefs updates from Mike Marshall:
 "Fixes and a cleanup.

  Fixes:
   - fix superfluous service_operation return code check in
     orangefs_lookup
   - fix some error code paths that missed kmem_cache_free
   - don't let orangefs_iget return NULL
   - don't let orangefs_new_inode return NULL
   - cache NULL when both default_acl and acl are NULL

 Cleanup:
   - rate limit the client not running info message"

* tag 'for-linus-4.20-ofs1' of git://git.kernel.org/pub/scm/linux/kernel/git/hubcap/linux:
  orangefs: no need to check for service_operation returns > 0
  orangefs: some error code paths missed kmem_cache_free
  orangefs: don't let orangefs_iget return NULL.
  orangefs: don't let orangefs_new_inode return NULL
  orangefs: rate limit the client not running info message
  orangefs: cache NULL when both default_acl and acl are NULL
  • Loading branch information
torvalds committed Oct 24, 2018
2 parents 6b609e3 + 22fc9db commit e1cbbf4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
4 changes: 4 additions & 0 deletions fs/orangefs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,16 @@ int orangefs_init_acl(struct inode *inode, struct inode *dir)
error = __orangefs_set_acl(inode, default_acl,
ACL_TYPE_DEFAULT);
posix_acl_release(default_acl);
} else {
inode->i_default_acl = NULL;
}

if (acl) {
if (!error)
error = __orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS);
posix_acl_release(acl);
} else {
inode->i_acl = NULL;
}

/* If mode of the inode was changed, then do a forcible ->setattr */
Expand Down
8 changes: 6 additions & 2 deletions fs/orangefs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ struct inode *orangefs_iget(struct super_block *sb,
orangefs_test_inode,
orangefs_set_inode,
ref);
if (!inode || !(inode->i_state & I_NEW))

if (!inode)
return ERR_PTR(-ENOMEM);

if (!(inode->i_state & I_NEW))
return inode;

error = orangefs_inode_getattr(inode, 1, 1, STATX_ALL);
Expand Down Expand Up @@ -448,7 +452,7 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir,

inode = new_inode(sb);
if (!inode)
return NULL;
return ERR_PTR(-ENOMEM);

orangefs_set_inode(inode, ref);
inode->i_ino = hash; /* needed for stat etc */
Expand Down
8 changes: 4 additions & 4 deletions fs/orangefs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ static int orangefs_create(struct inode *dir,
goto out;

ref = new_op->downcall.resp.create.refn;
op_release(new_op);

inode = orangefs_new_inode(dir->i_sb, dir, S_IFREG | mode, 0, &ref);
if (IS_ERR(inode)) {
Expand Down Expand Up @@ -92,6 +91,7 @@ static int orangefs_create(struct inode *dir,
mark_inode_dirty_sync(dir);
ret = 0;
out:
op_release(new_op);
gossip_debug(GOSSIP_NAME_DEBUG,
"%s: %pd: returning %d\n",
__func__,
Expand Down Expand Up @@ -157,7 +157,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
new_op->downcall.resp.lookup.refn.fs_id,
ret);

if (ret >= 0) {
if (ret == 0) {
orangefs_set_timeout(dentry);
inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn);
} else if (ret == -ENOENT) {
Expand Down Expand Up @@ -269,7 +269,6 @@ static int orangefs_symlink(struct inode *dir,
}

ref = new_op->downcall.resp.sym.refn;
op_release(new_op);

inode = orangefs_new_inode(dir->i_sb, dir, S_IFLNK | mode, 0, &ref);
if (IS_ERR(inode)) {
Expand Down Expand Up @@ -307,6 +306,7 @@ static int orangefs_symlink(struct inode *dir,
mark_inode_dirty_sync(dir);
ret = 0;
out:
op_release(new_op);
return ret;
}

Expand Down Expand Up @@ -346,7 +346,6 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
}

ref = new_op->downcall.resp.mkdir.refn;
op_release(new_op);

inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0, &ref);
if (IS_ERR(inode)) {
Expand Down Expand Up @@ -379,6 +378,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
orangefs_inode_setattr(dir, &iattr);
mark_inode_dirty_sync(dir);
out:
op_release(new_op);
return ret;
}

Expand Down
2 changes: 1 addition & 1 deletion fs/orangefs/orangefs-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj,
/* Can't do a service_operation if the client is not running... */
rc = is_daemon_in_service();
if (rc) {
pr_info("%s: Client not running :%d:\n",
pr_info_ratelimited("%s: Client not running :%d:\n",
__func__,
is_daemon_in_service());
goto out;
Expand Down

0 comments on commit e1cbbf4

Please sign in to comment.