From: Jeff Layton <jlayton@kernel.org>
To: ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, dan.carpenter@oracle.com, sage@redhat.com
Subject: [PATCH 1/2] ceph: have ceph_mdsc_free_path ignore ERR_PTR values
Date: Wed, 8 Apr 2020 10:21:24 -0400 [thread overview]
Message-ID: <20200408142125.52908-2-jlayton@kernel.org> (raw)
In-Reply-To: <20200408142125.52908-1-jlayton@kernel.org>
This makes the error handling simpler in some callers, and fixes a
couple of bugs in the new async dirops callback code.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ceph/debugfs.c | 4 ----
fs/ceph/mds_client.c | 6 ++----
fs/ceph/mds_client.h | 2 +-
3 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/fs/ceph/debugfs.c b/fs/ceph/debugfs.c
index eebbce7c3b0c..3a198e40f100 100644
--- a/fs/ceph/debugfs.c
+++ b/fs/ceph/debugfs.c
@@ -83,8 +83,6 @@ static int mdsc_show(struct seq_file *s, void *p)
} else if (req->r_dentry) {
path = ceph_mdsc_build_path(req->r_dentry, &pathlen,
&pathbase, 0);
- if (IS_ERR(path))
- path = NULL;
spin_lock(&req->r_dentry->d_lock);
seq_printf(s, " #%llx/%pd (%s)",
ceph_ino(d_inode(req->r_dentry->d_parent)),
@@ -102,8 +100,6 @@ static int mdsc_show(struct seq_file *s, void *p)
if (req->r_old_dentry) {
path = ceph_mdsc_build_path(req->r_old_dentry, &pathlen,
&pathbase, 0);
- if (IS_ERR(path))
- path = NULL;
spin_lock(&req->r_old_dentry->d_lock);
seq_printf(s, " #%llx/%pd (%s)",
req->r_old_dentry_dir ?
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index a8a5b98148ec..e25ee9fe0ee8 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -2535,11 +2535,9 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
msg->hdr.data_off = cpu_to_le16(0);
out_free2:
- if (freepath2)
- ceph_mdsc_free_path((char *)path2, pathlen2);
+ ceph_mdsc_free_path((char *)path2, pathlen2);
out_free1:
- if (freepath1)
- ceph_mdsc_free_path((char *)path1, pathlen1);
+ ceph_mdsc_free_path((char *)path1, pathlen1);
out:
return msg;
}
diff --git a/fs/ceph/mds_client.h b/fs/ceph/mds_client.h
index 1b40f30e0a8e..43111e408fa2 100644
--- a/fs/ceph/mds_client.h
+++ b/fs/ceph/mds_client.h
@@ -531,7 +531,7 @@ extern void ceph_mdsc_pre_umount(struct ceph_mds_client *mdsc);
static inline void ceph_mdsc_free_path(char *path, int len)
{
- if (path)
+ if (!IS_ERR_OR_NULL(path))
__putname(path - (PATH_MAX - 1 - len));
}
--
2.25.2
next prev parent reply other threads:[~2020-04-08 14:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-08 14:21 [PATCH 0/2] ceph: fix error handling bugs in async dirops callbacks Jeff Layton
2020-04-08 14:21 ` Jeff Layton [this message]
2020-04-13 8:09 ` [PATCH 1/2] ceph: have ceph_mdsc_free_path ignore ERR_PTR values Ilya Dryomov
2020-04-13 11:15 ` Jeff Layton
2020-04-13 12:35 ` Ilya Dryomov
2020-04-13 13:23 ` Jeff Layton
2020-04-13 15:48 ` Ilya Dryomov
2020-04-13 16:03 ` Jeff Layton
2020-04-13 19:41 ` Dan Carpenter
2020-04-14 10:43 ` Jeff Layton
2020-04-08 14:21 ` [PATCH 2/2] ceph: initialize base and pathlen variables in async dirops cb's Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200408142125.52908-2-jlayton@kernel.org \
--to=jlayton@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=dan.carpenter@oracle.com \
--cc=idryomov@gmail.com \
--cc=sage@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.