From: Luis Henriques <lhenriques@suse.com>
To: "Yan, Zheng" <ukernel@gmail.com>
Cc: "Yan, Zheng" <zyan@redhat.com>, Sage Weil <sage@redhat.com>,
Ilya Dryomov <idryomov@gmail.com>,
ceph-devel <ceph-devel@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Hendrik Peyerl <hpeyerl@plusline.net>
Subject: Re: [PATCH v2 2/2] ceph: quota: fix quota subdir mounts
Date: Tue, 19 Mar 2019 16:42:24 +0000 [thread overview]
Message-ID: <8736nin7db.fsf@suse.com> (raw)
In-Reply-To: <CAAM7YAkksn_w6Nsm0D7HVGh59ysAJyHptXQ886xD9DAVGhxNEQ@mail.gmail.com> (Zheng Yan's message of "Mon, 18 Mar 2019 21:06:28 +0800")
"Yan, Zheng" <ukernel@gmail.com> writes:
> On Tue, Mar 12, 2019 at 10:22 PM Luis Henriques <lhenriques@suse.com> wrote:
...
>> +static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc,
>> + struct super_block *sb,
>> + struct ceph_snap_realm *realm)
>> +{
>> + struct inode *in;
>> +
>> + in = ceph_lookup_inode(sb, realm->ino);
>> + if (IS_ERR(in)) {
>> + pr_warn("Can't lookup inode %llx (err: %ld)\n",
>> + realm->ino, PTR_ERR(in));
>> + return in;
>> + }
>> +
>> + spin_lock(&mdsc->quotarealms_inodes_lock);
>> + list_add(&ceph_inode(in)->i_quotarealms_inode_item,
>> + &mdsc->quotarealms_inodes_list);
>> + spin_unlock(&mdsc->quotarealms_inodes_lock);
>> +
> Multiple threads can call this function for the same inode at the same
> time. need to handle this. Besides, client needs to record lookupino
> error. Otherwise, client may repeatedly send useless request.
Good point. So, the only way I see to fix this is to drop the
mdsc->quotarealms_inodes_list and instead use an ordered list/tree of
structs that would either point to the corresponding ceph inode or to
NULL if there was an error in the lookup:
struct ceph_realm_inode {
u64 ino;
struct ceph_inode_info *ci;
spinlock_t lock;
unsigned long timeout;
}
The 'timeout' field would be used to try to do the lookup again if the
error occurred long time ago.
The code would then create a new struct for the realm->ino (if one is
not found in the mdsc list), lock it and do the lookupino; if there's a
struct already on the list, it either means there's a lookupino in
progress or there was an error in the last lookup.
This sounds overly complicated so I may be missing the obvious simple
fix. Any ideas?
>> + spin_lock(&realm->inodes_with_caps_lock);
>> + realm->inode = in;
>
> reply of lookup_ino should alreadly set realm->inode
Yes, of course. This was silly.
Cheers,
--
Luis
WARNING: multiple messages have this Message-ID (diff)
From: Luis Henriques <lhenriques@suse.com>
To: "Yan\, Zheng" <ukernel@gmail.com>
Cc: "Yan\, Zheng" <zyan@redhat.com>, Sage Weil <sage@redhat.com>,
Ilya Dryomov <idryomov@gmail.com>,
ceph-devel <ceph-devel@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Hendrik Peyerl <hpeyerl@plusline.net>
Subject: Re: [PATCH v2 2/2] ceph: quota: fix quota subdir mounts
Date: Tue, 19 Mar 2019 16:42:24 +0000 [thread overview]
Message-ID: <8736nin7db.fsf@suse.com> (raw)
In-Reply-To: <CAAM7YAkksn_w6Nsm0D7HVGh59ysAJyHptXQ886xD9DAVGhxNEQ@mail.gmail.com> (Zheng Yan's message of "Mon, 18 Mar 2019 21:06:28 +0800")
"Yan, Zheng" <ukernel@gmail.com> writes:
> On Tue, Mar 12, 2019 at 10:22 PM Luis Henriques <lhenriques@suse.com> wrote:
...
>> +static struct inode *lookup_quotarealm_inode(struct ceph_mds_client *mdsc,
>> + struct super_block *sb,
>> + struct ceph_snap_realm *realm)
>> +{
>> + struct inode *in;
>> +
>> + in = ceph_lookup_inode(sb, realm->ino);
>> + if (IS_ERR(in)) {
>> + pr_warn("Can't lookup inode %llx (err: %ld)\n",
>> + realm->ino, PTR_ERR(in));
>> + return in;
>> + }
>> +
>> + spin_lock(&mdsc->quotarealms_inodes_lock);
>> + list_add(&ceph_inode(in)->i_quotarealms_inode_item,
>> + &mdsc->quotarealms_inodes_list);
>> + spin_unlock(&mdsc->quotarealms_inodes_lock);
>> +
> Multiple threads can call this function for the same inode at the same
> time. need to handle this. Besides, client needs to record lookupino
> error. Otherwise, client may repeatedly send useless request.
Good point. So, the only way I see to fix this is to drop the
mdsc->quotarealms_inodes_list and instead use an ordered list/tree of
structs that would either point to the corresponding ceph inode or to
NULL if there was an error in the lookup:
struct ceph_realm_inode {
u64 ino;
struct ceph_inode_info *ci;
spinlock_t lock;
unsigned long timeout;
}
The 'timeout' field would be used to try to do the lookup again if the
error occurred long time ago.
The code would then create a new struct for the realm->ino (if one is
not found in the mdsc list), lock it and do the lookupino; if there's a
struct already on the list, it either means there's a lookupino in
progress or there was an error in the last lookup.
This sounds overly complicated so I may be missing the obvious simple
fix. Any ideas?
>> + spin_lock(&realm->inodes_with_caps_lock);
>> + realm->inode = in;
>
> reply of lookup_ino should alreadly set realm->inode
Yes, of course. This was silly.
Cheers,
--
Luis
next prev parent reply other threads:[~2019-03-19 16:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-12 14:20 [PATCH v2 0/2] fix quota subdir mounts Luis Henriques
2019-03-12 14:20 ` [PATCH v2 1/2] ceph: factor out ceph_lookup_inode() Luis Henriques
2019-03-12 14:20 ` [PATCH v2 2/2] ceph: quota: fix quota subdir mounts Luis Henriques
2019-03-18 9:01 ` Yan, Zheng
2019-03-18 9:05 ` Gregory Farnum
2019-03-18 9:12 ` Yan, Zheng
2019-03-18 10:55 ` Luis Henriques
2019-03-18 10:55 ` Luis Henriques
2019-03-18 11:19 ` Gregory Farnum
2019-03-18 12:55 ` Yan, Zheng
2019-03-18 13:06 ` Yan, Zheng
2019-03-19 16:42 ` Luis Henriques [this message]
2019-03-19 16:42 ` Luis Henriques
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=8736nin7db.fsf@suse.com \
--to=lhenriques@suse.com \
--cc=ceph-devel@vger.kernel.org \
--cc=hpeyerl@plusline.net \
--cc=idryomov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sage@redhat.com \
--cc=ukernel@gmail.com \
--cc=zyan@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.