ceph: show more detail logs during mount
diff mbox series

Message ID 20200225033013.4832-1-xiubli@redhat.com
State New
Headers show
Series
  • ceph: show more detail logs during mount
Related show

Commit Message

Xiubo Li Feb. 25, 2020, 3:30 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

Print the logs in error level to give a helpful hint to make it
more user-friendly to debug.

URL: https://tracker.ceph.com/issues/44215
Signed-off-by: Xiubo Li <xiubli@redhat.com>
---
 fs/ceph/super.c       | 8 ++++++--
 net/ceph/mon_client.c | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Ilya Dryomov Feb. 25, 2020, 10:39 a.m. UTC | #1
On Tue, Feb 25, 2020 at 4:30 AM <xiubli@redhat.com> wrote:
>
> From: Xiubo Li <xiubli@redhat.com>
>
> Print the logs in error level to give a helpful hint to make it
> more user-friendly to debug.
>
> URL: https://tracker.ceph.com/issues/44215
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
>  fs/ceph/super.c       | 8 ++++++--
>  net/ceph/mon_client.c | 2 ++
>  2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index c7f150686a53..e33c2f86647b 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -905,8 +905,10 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
>                                      fsc->mount_options->server_path + 1 : "";
>
>                 err = __ceph_open_session(fsc->client, started);
> -               if (err < 0)
> +               if (err < 0) {
> +                       pr_err("mount joining the ceph cluster fail %d\n", err);
>                         goto out;
> +               }
>
>                 /* setup fscache */
>                 if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) {
> @@ -922,6 +924,8 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
>                 root = open_root_dentry(fsc, path, started);
>                 if (IS_ERR(root)) {
>                         err = PTR_ERR(root);
> +                       pr_err("mount opening the root directory fail %d\n",
> +                              err);

Hi Xiubo,

Given that these are new user-level filesystem log messages, they
should probably go into fs_context log.

>                         goto out;
>                 }
>                 fsc->sb->s_root = dget(root);
> @@ -1079,7 +1083,7 @@ static int ceph_get_tree(struct fs_context *fc)
>
>  out_splat:
>         if (!ceph_mdsmap_is_cluster_available(fsc->mdsc->mdsmap)) {
> -               pr_info("No mds server is up or the cluster is laggy\n");
> +               pr_err("No mds server is up or the cluster is laggy\n");
>                 err = -EHOSTUNREACH;
>         }

If you are changing this one, it should be directed to fs_context log
as well.

>
> diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
> index 9d9e4e4ea600..6f1372f5f2a7 100644
> --- a/net/ceph/mon_client.c
> +++ b/net/ceph/mon_client.c
> @@ -1179,6 +1179,8 @@ static void handle_auth_reply(struct ceph_mon_client *monc,
>
>         if (ret < 0) {
>                 monc->client->auth_err = ret;
> +               pr_err("authenticate fail on mon%d %s\n", monc->cur_mon,
> +                       ceph_pr_addr(&monc->con.peer_addr));

I don't think this is needed.  Authentication errors are already logged
in ceph_handle_auth_reply().

Thanks,

                Ilya
Xiubo Li Feb. 26, 2020, 12:58 a.m. UTC | #2
On 2020/2/25 18:39, Ilya Dryomov wrote:
> On Tue, Feb 25, 2020 at 4:30 AM <xiubli@redhat.com> wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> Print the logs in error level to give a helpful hint to make it
>> more user-friendly to debug.
>>
>> URL: https://tracker.ceph.com/issues/44215
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>>   fs/ceph/super.c       | 8 ++++++--
>>   net/ceph/mon_client.c | 2 ++
>>   2 files changed, 8 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
>> index c7f150686a53..e33c2f86647b 100644
>> --- a/fs/ceph/super.c
>> +++ b/fs/ceph/super.c
>> @@ -905,8 +905,10 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
>>                                       fsc->mount_options->server_path + 1 : "";
>>
>>                  err = __ceph_open_session(fsc->client, started);
>> -               if (err < 0)
>> +               if (err < 0) {
>> +                       pr_err("mount joining the ceph cluster fail %d\n", err);
>>                          goto out;
>> +               }
>>
>>                  /* setup fscache */
>>                  if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) {
>> @@ -922,6 +924,8 @@ static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
>>                  root = open_root_dentry(fsc, path, started);
>>                  if (IS_ERR(root)) {
>>                          err = PTR_ERR(root);
>> +                       pr_err("mount opening the root directory fail %d\n",
>> +                              err);
> Hi Xiubo,
>
> Given that these are new user-level filesystem log messages, they
> should probably go into fs_context log.

Yeah, will fix it.


>
>>                          goto out;
>>                  }
>>                  fsc->sb->s_root = dget(root);
>> @@ -1079,7 +1083,7 @@ static int ceph_get_tree(struct fs_context *fc)
>>
>>   out_splat:
>>          if (!ceph_mdsmap_is_cluster_available(fsc->mdsc->mdsmap)) {
>> -               pr_info("No mds server is up or the cluster is laggy\n");
>> +               pr_err("No mds server is up or the cluster is laggy\n");
>>                  err = -EHOSTUNREACH;
>>          }
> If you are changing this one, it should be directed to fs_context log
> as well.
Will do it.
>> diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
>> index 9d9e4e4ea600..6f1372f5f2a7 100644
>> --- a/net/ceph/mon_client.c
>> +++ b/net/ceph/mon_client.c
>> @@ -1179,6 +1179,8 @@ static void handle_auth_reply(struct ceph_mon_client *monc,
>>
>>          if (ret < 0) {
>>                  monc->client->auth_err = ret;
>> +               pr_err("authenticate fail on mon%d %s\n", monc->cur_mon,
>> +                       ceph_pr_addr(&monc->con.peer_addr));
> I don't think this is needed.  Authentication errors are already logged
> in ceph_handle_auth_reply().

Yeah, it is, here just want to give more messages, such as the monX. But 
it is not necessary. So I will delete it.

Thanks Ilya.

BRs

> Thanks,
>
>                  Ilya
>

Patch
diff mbox series

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index c7f150686a53..e33c2f86647b 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -905,8 +905,10 @@  static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
 				     fsc->mount_options->server_path + 1 : "";
 
 		err = __ceph_open_session(fsc->client, started);
-		if (err < 0)
+		if (err < 0) {
+			pr_err("mount joining the ceph cluster fail %d\n", err);
 			goto out;
+		}
 
 		/* setup fscache */
 		if (fsc->mount_options->flags & CEPH_MOUNT_OPT_FSCACHE) {
@@ -922,6 +924,8 @@  static struct dentry *ceph_real_mount(struct ceph_fs_client *fsc,
 		root = open_root_dentry(fsc, path, started);
 		if (IS_ERR(root)) {
 			err = PTR_ERR(root);
+			pr_err("mount opening the root directory fail %d\n",
+			       err);
 			goto out;
 		}
 		fsc->sb->s_root = dget(root);
@@ -1079,7 +1083,7 @@  static int ceph_get_tree(struct fs_context *fc)
 
 out_splat:
 	if (!ceph_mdsmap_is_cluster_available(fsc->mdsc->mdsmap)) {
-		pr_info("No mds server is up or the cluster is laggy\n");
+		pr_err("No mds server is up or the cluster is laggy\n");
 		err = -EHOSTUNREACH;
 	}
 
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c
index 9d9e4e4ea600..6f1372f5f2a7 100644
--- a/net/ceph/mon_client.c
+++ b/net/ceph/mon_client.c
@@ -1179,6 +1179,8 @@  static void handle_auth_reply(struct ceph_mon_client *monc,
 
 	if (ret < 0) {
 		monc->client->auth_err = ret;
+		pr_err("authenticate fail on mon%d %s\n", monc->cur_mon,
+			ceph_pr_addr(&monc->con.peer_addr));
 	} else if (!was_auth && ceph_auth_is_authenticated(monc->auth)) {
 		dout("authenticated, starting session\n");