From 052d12766b7147500d9d5017bb90d4524f01e731 Mon Sep 17 00:00:00 2001 From: Chengguang Xu Date: Fri, 31 Aug 2018 22:33:52 +0800 Subject: [PATCH 1/6] orangefs: cache NULL when both default_acl and acl are NULL default_acl and acl of newly created inode will be initiated as ACL_NOT_CACHED in vfs function inode_init_always() and later will be updated by calling xxx_init_acl() in specific filesystems. Howerver, when default_acl and acl are NULL then they keep the value of ACL_NOT_CACHED, this patch tries to cache NULL for acl/default_acl in this case. Signed-off-by: Chengguang Xu Signed-off-by: Mike Marshall --- fs/orangefs/acl.c | 4 ++++ 1 file changed, 4 insertions(+) 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) 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 */ From 2978d873471005577e7b68a528b4f256a529b030 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Wed, 5 Sep 2018 15:54:01 +0100 Subject: [PATCH 2/6] orangefs: rate limit the client not running info message Currently accessing various /sys/fs/orangefs files will spam the kernel log with the following info message when the client is not running: [ 491.489284] sysfs_service_op_show: Client not running :-5: Rate limit this info message to make it less spammy. Signed-off-by: Colin Ian King Signed-off-by: Mike Marshall --- fs/orangefs/orangefs-sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, /* 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; From 56249998b25f602f8dedbe916ec5494b71da113d Mon Sep 17 00:00:00 2001 From: Mike Marshall Date: Thu, 18 Oct 2018 13:47:16 -0400 Subject: [PATCH 3/6] orangefs: don't let orangefs_new_inode return NULL Suggested by Dan Carpenter Signed-off-by: Mike Marshall --- fs/orangefs/inode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index 31932879b716..c1b4ce399ab7 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -448,7 +448,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 */ From b5d72cdc53bd13a363943a67a8c5537b9524c94d Mon Sep 17 00:00:00 2001 From: Mike Marshall Date: Thu, 18 Oct 2018 13:52:23 -0400 Subject: [PATCH 4/6] orangefs: don't let orangefs_iget return NULL. Suggested by Dan Carpenter. Signed-off-by: Mike Marshall --- fs/orangefs/inode.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index c1b4ce399ab7..5e65d818937b 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -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); From 34e6148a2c75abdde44071d1605d009d0ad92e5e Mon Sep 17 00:00:00 2001 From: Mike Marshall Date: Thu, 18 Oct 2018 13:58:25 -0400 Subject: [PATCH 5/6] orangefs: some error code paths missed kmem_cache_free If a slab cache object is allocated, it needs to be freed eventually, certainly before anyone unloads the module that allocated it. Signed-off-by: Mike Marshall --- fs/orangefs/namei.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index 625b0580f9be..f5cd7075e78e 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -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)) { @@ -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__, @@ -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)) { @@ -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; } @@ -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)) { @@ -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; } From 22fc9db296fcf7ac30151c52765a7fba10870ab7 Mon Sep 17 00:00:00 2001 From: Mike Marshall Date: Thu, 18 Oct 2018 14:05:46 -0400 Subject: [PATCH 6/6] orangefs: no need to check for service_operation returns > 0 service_operation returns > 0 is undefined. Signed-off-by: Mike Marshall --- fs/orangefs/namei.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/orangefs/namei.c b/fs/orangefs/namei.c index f5cd7075e78e..c8676c996249 100644 --- a/fs/orangefs/namei.c +++ b/fs/orangefs/namei.c @@ -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) {