Commit e1cbbf40 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-4.20-ofs1' of git://git.kernel.org/pub/scm/linux/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
parents 6b609e3b 22fc9db2
...@@ -167,12 +167,16 @@ int orangefs_init_acl(struct inode *inode, struct inode *dir) ...@@ -167,12 +167,16 @@ int orangefs_init_acl(struct inode *inode, struct inode *dir)
error = __orangefs_set_acl(inode, default_acl, error = __orangefs_set_acl(inode, default_acl,
ACL_TYPE_DEFAULT); ACL_TYPE_DEFAULT);
posix_acl_release(default_acl); posix_acl_release(default_acl);
} else {
inode->i_default_acl = NULL;
} }
if (acl) { if (acl) {
if (!error) if (!error)
error = __orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS); error = __orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS);
posix_acl_release(acl); posix_acl_release(acl);
} else {
inode->i_acl = NULL;
} }
/* If mode of the inode was changed, then do a forcible ->setattr */ /* If mode of the inode was changed, then do a forcible ->setattr */
......
...@@ -405,7 +405,11 @@ struct inode *orangefs_iget(struct super_block *sb, ...@@ -405,7 +405,11 @@ struct inode *orangefs_iget(struct super_block *sb,
orangefs_test_inode, orangefs_test_inode,
orangefs_set_inode, orangefs_set_inode,
ref); ref);
if (!inode || !(inode->i_state & I_NEW))
if (!inode)
return ERR_PTR(-ENOMEM);
if (!(inode->i_state & I_NEW))
return inode; return inode;
error = orangefs_inode_getattr(inode, 1, 1, STATX_ALL); error = orangefs_inode_getattr(inode, 1, 1, STATX_ALL);
...@@ -448,7 +452,7 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir, ...@@ -448,7 +452,7 @@ struct inode *orangefs_new_inode(struct super_block *sb, struct inode *dir,
inode = new_inode(sb); inode = new_inode(sb);
if (!inode) if (!inode)
return NULL; return ERR_PTR(-ENOMEM);
orangefs_set_inode(inode, ref); orangefs_set_inode(inode, ref);
inode->i_ino = hash; /* needed for stat etc */ inode->i_ino = hash; /* needed for stat etc */
......
...@@ -58,7 +58,6 @@ static int orangefs_create(struct inode *dir, ...@@ -58,7 +58,6 @@ static int orangefs_create(struct inode *dir,
goto out; goto out;
ref = new_op->downcall.resp.create.refn; ref = new_op->downcall.resp.create.refn;
op_release(new_op);
inode = orangefs_new_inode(dir->i_sb, dir, S_IFREG | mode, 0, &ref); inode = orangefs_new_inode(dir->i_sb, dir, S_IFREG | mode, 0, &ref);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
...@@ -92,6 +91,7 @@ static int orangefs_create(struct inode *dir, ...@@ -92,6 +91,7 @@ static int orangefs_create(struct inode *dir,
mark_inode_dirty_sync(dir); mark_inode_dirty_sync(dir);
ret = 0; ret = 0;
out: out:
op_release(new_op);
gossip_debug(GOSSIP_NAME_DEBUG, gossip_debug(GOSSIP_NAME_DEBUG,
"%s: %pd: returning %d\n", "%s: %pd: returning %d\n",
__func__, __func__,
...@@ -157,7 +157,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry, ...@@ -157,7 +157,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry,
new_op->downcall.resp.lookup.refn.fs_id, new_op->downcall.resp.lookup.refn.fs_id,
ret); ret);
if (ret >= 0) { if (ret == 0) {
orangefs_set_timeout(dentry); orangefs_set_timeout(dentry);
inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn); inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn);
} else if (ret == -ENOENT) { } else if (ret == -ENOENT) {
...@@ -269,7 +269,6 @@ static int orangefs_symlink(struct inode *dir, ...@@ -269,7 +269,6 @@ static int orangefs_symlink(struct inode *dir,
} }
ref = new_op->downcall.resp.sym.refn; ref = new_op->downcall.resp.sym.refn;
op_release(new_op);
inode = orangefs_new_inode(dir->i_sb, dir, S_IFLNK | mode, 0, &ref); inode = orangefs_new_inode(dir->i_sb, dir, S_IFLNK | mode, 0, &ref);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
...@@ -307,6 +306,7 @@ static int orangefs_symlink(struct inode *dir, ...@@ -307,6 +306,7 @@ static int orangefs_symlink(struct inode *dir,
mark_inode_dirty_sync(dir); mark_inode_dirty_sync(dir);
ret = 0; ret = 0;
out: out:
op_release(new_op);
return ret; return ret;
} }
...@@ -346,7 +346,6 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -346,7 +346,6 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
} }
ref = new_op->downcall.resp.mkdir.refn; ref = new_op->downcall.resp.mkdir.refn;
op_release(new_op);
inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0, &ref); inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0, &ref);
if (IS_ERR(inode)) { if (IS_ERR(inode)) {
...@@ -379,6 +378,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -379,6 +378,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
orangefs_inode_setattr(dir, &iattr); orangefs_inode_setattr(dir, &iattr);
mark_inode_dirty_sync(dir); mark_inode_dirty_sync(dir);
out: out:
op_release(new_op);
return ret; return ret;
} }
......
...@@ -323,7 +323,7 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj, ...@@ -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... */ /* Can't do a service_operation if the client is not running... */
rc = is_daemon_in_service(); rc = is_daemon_in_service();
if (rc) { if (rc) {
pr_info("%s: Client not running :%d:\n", pr_info_ratelimited("%s: Client not running :%d:\n",
__func__, __func__,
is_daemon_in_service()); is_daemon_in_service());
goto out; goto out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment