diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-24 12:28:03 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-24 12:28:03 -0400 |
commit | e1cbbf4067820ea4df534dd96f51c8f67854dcad (patch) | |
tree | a2636f537d86e3581dd2c40c12a988501966a9b8 | |
parent | 6b609e3b0068d29c676e8f1c6d2c0d503d18fea1 (diff) | |
parent | 22fc9db296fcf7ac30151c52765a7fba10870ab7 (diff) |
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
-rw-r--r-- | fs/orangefs/acl.c | 4 | ||||
-rw-r--r-- | fs/orangefs/inode.c | 8 | ||||
-rw-r--r-- | fs/orangefs/namei.c | 8 | ||||
-rw-r--r-- | fs/orangefs/orangefs-sysfs.c | 2 |
4 files changed, 15 insertions, 7 deletions
diff --git a/fs/orangefs/acl.c b/fs/orangefs/acl.c index 10587413b20e..72d2ff17d27b 100644 --- a/fs/orangefs/acl.c +++ b/fs/orangefs/acl.c | |||
@@ -167,12 +167,16 @@ int orangefs_init_acl(struct inode *inode, struct inode *dir) | |||
167 | error = __orangefs_set_acl(inode, default_acl, | 167 | error = __orangefs_set_acl(inode, default_acl, |
168 | ACL_TYPE_DEFAULT); | 168 | ACL_TYPE_DEFAULT); |
169 | posix_acl_release(default_acl); | 169 | posix_acl_release(default_acl); |
170 | } else { | ||
171 | inode->i_default_acl = NULL; | ||
170 | } | 172 | } |
171 | 173 | ||
172 | if (acl) { | 174 | if (acl) { |
173 | if (!error) | 175 | if (!error) |
174 | error = __orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS); | 176 | error = __orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS); |
175 | posix_acl_release(acl); | 177 | posix_acl_release(acl); |
178 | } else { | ||
179 | inode->i_acl = NULL; | ||
176 | } | 180 | } |
177 | 181 | ||
178 | /* If mode of the inode was changed, then do a forcible ->setattr */ | 182 | /* If mode of the inode was changed, then do a forcible ->setattr */ |
diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 31932879b716..5e65d818937b 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c | |||
@@ -405,7 +405,11 @@ struct inode *orangefs_iget(struct super_block *sb, | |||
405 | orangefs_test_inode, | 405 | orangefs_test_inode, |
406 | orangefs_set_inode, | 406 | orangefs_set_inode, |
407 | ref); | 407 | ref); |
408 | if (!inode || !(inode->i_state & I_NEW)) | 408 | |
409 | if (!inode) | ||
410 | return ERR_PTR(-ENOMEM); | ||
411 | |||
412 | if (!(inode->i_state & I_NEW)) | ||
409 | return inode; | 413 | return inode; |
410 | 414 | ||
411 | error = orangefs_inode_getattr(inode, 1, 1, STATX_ALL); | 415 | 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 | 452 | ||
449 | inode = new_inode(sb); | 453 | inode = new_inode(sb); |
450 | if (!inode) | 454 | if (!inode) |
451 | return NULL; | 455 | return ERR_PTR(-ENOMEM); |
452 | 456 | ||
453 | orangefs_set_inode(inode, ref); | 457 | orangefs_set_inode(inode, ref); |
454 | inode->i_ino = hash; /* needed for stat etc */ | 458 | inode->i_ino = hash; /* needed for stat etc */ |
diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 625b0580f9be..c8676c996249 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c | |||
@@ -58,7 +58,6 @@ static int orangefs_create(struct inode *dir, | |||
58 | goto out; | 58 | goto out; |
59 | 59 | ||
60 | ref = new_op->downcall.resp.create.refn; | 60 | ref = new_op->downcall.resp.create.refn; |
61 | op_release(new_op); | ||
62 | 61 | ||
63 | inode = orangefs_new_inode(dir->i_sb, dir, S_IFREG | mode, 0, &ref); | 62 | inode = orangefs_new_inode(dir->i_sb, dir, S_IFREG | mode, 0, &ref); |
64 | if (IS_ERR(inode)) { | 63 | if (IS_ERR(inode)) { |
@@ -92,6 +91,7 @@ static int orangefs_create(struct inode *dir, | |||
92 | mark_inode_dirty_sync(dir); | 91 | mark_inode_dirty_sync(dir); |
93 | ret = 0; | 92 | ret = 0; |
94 | out: | 93 | out: |
94 | op_release(new_op); | ||
95 | gossip_debug(GOSSIP_NAME_DEBUG, | 95 | gossip_debug(GOSSIP_NAME_DEBUG, |
96 | "%s: %pd: returning %d\n", | 96 | "%s: %pd: returning %d\n", |
97 | __func__, | 97 | __func__, |
@@ -157,7 +157,7 @@ static struct dentry *orangefs_lookup(struct inode *dir, struct dentry *dentry, | |||
157 | new_op->downcall.resp.lookup.refn.fs_id, | 157 | new_op->downcall.resp.lookup.refn.fs_id, |
158 | ret); | 158 | ret); |
159 | 159 | ||
160 | if (ret >= 0) { | 160 | if (ret == 0) { |
161 | orangefs_set_timeout(dentry); | 161 | orangefs_set_timeout(dentry); |
162 | inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn); | 162 | inode = orangefs_iget(dir->i_sb, &new_op->downcall.resp.lookup.refn); |
163 | } else if (ret == -ENOENT) { | 163 | } else if (ret == -ENOENT) { |
@@ -269,7 +269,6 @@ static int orangefs_symlink(struct inode *dir, | |||
269 | } | 269 | } |
270 | 270 | ||
271 | ref = new_op->downcall.resp.sym.refn; | 271 | ref = new_op->downcall.resp.sym.refn; |
272 | op_release(new_op); | ||
273 | 272 | ||
274 | inode = orangefs_new_inode(dir->i_sb, dir, S_IFLNK | mode, 0, &ref); | 273 | inode = orangefs_new_inode(dir->i_sb, dir, S_IFLNK | mode, 0, &ref); |
275 | if (IS_ERR(inode)) { | 274 | if (IS_ERR(inode)) { |
@@ -307,6 +306,7 @@ static int orangefs_symlink(struct inode *dir, | |||
307 | mark_inode_dirty_sync(dir); | 306 | mark_inode_dirty_sync(dir); |
308 | ret = 0; | 307 | ret = 0; |
309 | out: | 308 | out: |
309 | op_release(new_op); | ||
310 | return ret; | 310 | return ret; |
311 | } | 311 | } |
312 | 312 | ||
@@ -346,7 +346,6 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode | |||
346 | } | 346 | } |
347 | 347 | ||
348 | ref = new_op->downcall.resp.mkdir.refn; | 348 | ref = new_op->downcall.resp.mkdir.refn; |
349 | op_release(new_op); | ||
350 | 349 | ||
351 | inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0, &ref); | 350 | inode = orangefs_new_inode(dir->i_sb, dir, S_IFDIR | mode, 0, &ref); |
352 | if (IS_ERR(inode)) { | 351 | if (IS_ERR(inode)) { |
@@ -379,6 +378,7 @@ static int orangefs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode | |||
379 | orangefs_inode_setattr(dir, &iattr); | 378 | orangefs_inode_setattr(dir, &iattr); |
380 | mark_inode_dirty_sync(dir); | 379 | mark_inode_dirty_sync(dir); |
381 | out: | 380 | out: |
381 | op_release(new_op); | ||
382 | return ret; | 382 | return ret; |
383 | } | 383 | } |
384 | 384 | ||
diff --git a/fs/orangefs/orangefs-sysfs.c b/fs/orangefs/orangefs-sysfs.c index dd28079f518c..19739aaee675 100644 --- a/fs/orangefs/orangefs-sysfs.c +++ b/fs/orangefs/orangefs-sysfs.c | |||
@@ -323,7 +323,7 @@ static ssize_t sysfs_service_op_show(struct kobject *kobj, | |||
323 | /* Can't do a service_operation if the client is not running... */ | 323 | /* Can't do a service_operation if the client is not running... */ |
324 | rc = is_daemon_in_service(); | 324 | rc = is_daemon_in_service(); |
325 | if (rc) { | 325 | if (rc) { |
326 | pr_info("%s: Client not running :%d:\n", | 326 | pr_info_ratelimited("%s: Client not running :%d:\n", |
327 | __func__, | 327 | __func__, |
328 | is_daemon_in_service()); | 328 | is_daemon_in_service()); |
329 | goto out; | 329 | goto out; |