All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@ubuntukylin.com>
To: Mikhail Campos Guadamuz <plageat90@gmail.com>,
	ceph-devel@vger.kernel.org
Subject: Re: [PATCH 1/2] No MDS mount error fix
Date: Mon, 09 Dec 2013 22:41:24 +0800	[thread overview]
Message-ID: <52A5D694.4000509@ubuntukylin.com> (raw)
In-Reply-To: <52A5D324.7010604@ubuntukylin.com>

Well, after double-checking the code, it seems the wait process will be 
unconditionally waked up if new MDS map received. Is there a situation 
that the client is pushed a new MDS map, but still no mds active. If so,
maybe worth a little bit optimization such as calling check_new_map() to 
avoid the client be uselessly waked up ...

On 2013/12/9 22:26, Li Wang wrote:
> Personally, I don't think there is issue for current implementation,
> either. If no ACTIVE mds, the mount process put to wait, until updated
> MDS map received and with active mds present indicated in the map, it
> will be waked up and go on the mount process, otherwise, EIO returned if
> timeout. If it is boring to hang for a long time, you can specify a
> shorter mount timeout.
>
> On 2013/12/8 2:59, Mikhail Campos Guadamuz wrote:
>> For http://tracker.ceph.com/issues/4386
>>
>> It determines situation, when a user is trying to mount CephFS
>> with no MDS present. Return ECOMM from
>> open_root_dentry which can be analyzed then by ceph.mount
>>
>> Signed-off-by: Mikhail Campos Guadamuz <plageat90@gmail.com>
>> ---
>>   fs/ceph/mdsmap.c            | 19 ++++++++++++++++---
>>   fs/ceph/super.c             | 10 +++++++++-
>>   include/linux/ceph/mdsmap.h |  1 +
>>   3 files changed, 26 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
>> index 132b64e..3a6ba8a 100644
>> --- a/fs/ceph/mdsmap.c
>> +++ b/fs/ceph/mdsmap.c
>> @@ -12,6 +12,20 @@
>>
>>   #include "super.h"
>>
>> +/*
>> + * count active mds's
>> + */
>> +int ceph_mdsmap_active_mds_count(struct ceph_mdsmap *m)
>> +{
>> +    int n = 0;
>> +    int i;
>> +
>> +    for(i = 0; i < m->m_max_mds; ++i)
>> +    if(m->m_info[i].state > 0)
>> +        ++n;
>> +
>> +    return  n;
>> +}
>>
>>   /*
>>    * choose a random mds that is "up" (i.e. has a state > 0), or -1.
>> @@ -26,9 +40,8 @@ int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m)
>>           return 0;
>>
>>       /* count */
>> -    for (i = 0; i < m->m_max_mds; i++)
>> -        if (m->m_info[i].state > 0)
>> -            n++;
>> +    n = ceph_mdsmap_active_mds_count(m);
>> +
>>       if (n == 0)
>>           return -1;
>>
>> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
>> index 6627b26..4d33d68 100644
>> --- a/fs/ceph/super.c
>> +++ b/fs/ceph/super.c
>> @@ -674,7 +674,15 @@ static struct dentry *open_root_dentry(struct
>> ceph_fs_client *fsc,
>>       struct ceph_mds_request *req = NULL;
>>       int err;
>>       struct dentry *root;
>> -
>> +
>> +    /* check for mds*/
>> +    if( 0 == ceph_mdsmap_active_mds_count(mdsc->mdsmap) )
>> +    {
>> +        pr_info("active mds not found, possible not exist\n");
>> +        root = ERR_PTR( -ECOMM );
>> +        return root;
>> +    }
>> +
>>       /* open dir */
>>       dout("open_root_inode opening '%s'\n", path);
>>       req = ceph_mdsc_create_request(mdsc, CEPH_MDS_OP_GETATTR,
>> USE_ANY_MDS);
>> diff --git a/include/linux/ceph/mdsmap.h b/include/linux/ceph/mdsmap.h
>> index 87ed09f..4d7d502 100644
>> --- a/include/linux/ceph/mdsmap.h
>> +++ b/include/linux/ceph/mdsmap.h
>> @@ -56,6 +56,7 @@ static inline bool ceph_mdsmap_is_laggy(struct
>> ceph_mdsmap *m, int w)
>>       return false;
>>   }
>>
>> +extern int ceph_mdsmap_active_mds_count(struct ceph_mdsmap *m);
>>   extern int ceph_mdsmap_get_random_mds(struct ceph_mdsmap *m);
>>   extern struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end);
>>   extern void ceph_mdsmap_destroy(struct ceph_mdsmap *m);
>>

  reply	other threads:[~2013-12-09 14:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-07 18:59 [PATCH 1/2] No MDS mount error fix Mikhail Campos Guadamuz
2013-12-07 13:59 ` Yan, Zheng
2013-12-09 12:02   ` Dzianis Huznou
2013-12-09 13:13     ` Yan, Zheng
2013-12-17 11:28   ` Dzianis Huznou
2013-12-07 19:00 ` [PATCH 2/2] No mds mount error print Mikhail Campos Guadamuz
2013-12-09 14:26 ` [PATCH 1/2] No MDS mount error fix Li Wang
2013-12-09 14:41   ` Li Wang [this message]
     [not found]   ` <CAN6N2SYZXgAKhu2mdBBr0=j2Dyry4Apr2EK0iMuCJiaK9_FczA@mail.gmail.com>
2013-12-10  1:25     ` Li Wang
2013-12-11 14:23       ` Mikhail_Campos-Guadamuz

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=52A5D694.4000509@ubuntukylin.com \
    --to=liwang@ubuntukylin.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=plageat90@gmail.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.