[PATCH v2] ceph: Fix ERR_PTR(0) in ceph_mkdir()

Hongling Zeng posted 1 patch 4 days, 1 hour ago
fs/ceph/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH v2] ceph: Fix ERR_PTR(0) in ceph_mkdir()
Posted by Hongling Zeng 4 days, 1 hour ago
When mkdir succeeds, ceph_mkdir() sets ret to ERR_PTR(0) which is
incorrect. It should return NULL instead for success.

Fixes: 88d5baf69082 ("Change inode_operations.mkdir to return struct dentry *")
Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@ibm.com>

---
Change in v2:
 -Add pre-reviewer
---
 fs/ceph/dir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c
index 27ce9e55e947..7acd4353a7a7 100644
--- a/fs/ceph/dir.c
+++ b/fs/ceph/dir.c
@@ -1169,7 +1169,7 @@ static struct dentry *ceph_mkdir(struct mnt_idmap *idmap, struct inode *dir,
 	    !req->r_reply_info.head->is_target &&
 	    !req->r_reply_info.head->is_dentry)
 		err = ceph_handle_notrace_create(dir, dentry);
-	ret = ERR_PTR(err);
+	ret = err ? ERR_PTR(err) : NULL;
 out_req:
 	if (!IS_ERR(ret) && req->r_dentry != dentry)
 		/* Some other dentry was spliced in */
-- 
2.25.1