From: "Yan, Zheng" <zheng.z.yan@intel.com>
To: ceph-devel@vger.kernel.org
Cc: sage@inktank.com, alex.elder@linaro.org
Subject: Re: [PATCH 3/3] mds: fix race between cap issue and revoke
Date: Mon, 24 Jun 2013 16:16:30 +0800 [thread overview]
Message-ID: <51C8005E.9020105@intel.com> (raw)
In-Reply-To: <1372056089-11603-3-git-send-email-zheng.z.yan@intel.com>
This patch's title is wrong, please ignore it.
Thanks
Yan, Zheng
On 06/24/2013 02:41 PM, Yan, Zheng wrote:
> From: "Yan, Zheng" <zheng.z.yan@intel.com>
>
> If we receive new caps from the auth MDS and the non-auth MDS is
> revoking the newly issued caps, we should release the caps from
> the non-auth MDS. The scenario is filelock's state changes from
> SYNC to LOCK. Non-auth MDS revokes Fc cap, the client gets Fc
> cap from the auth MDS at the same time.
>
> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> ---
> fs/ceph/caps.c | 29 ++++++++++++++++++++---------
> 1 file changed, 20 insertions(+), 9 deletions(-)
>
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index a8c616b..9b8b1aa 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -813,22 +813,28 @@ int __ceph_caps_issued_mask(struct ceph_inode_info *ci, int mask, int touch)
> /*
> * Return true if mask caps are currently being revoked by an MDS.
> */
> -int ceph_caps_revoking(struct ceph_inode_info *ci, int mask)
> +int __ceph_caps_revoking_other(struct ceph_inode_info *ci,
> + struct ceph_cap *ocap, int mask)
> {
> - struct inode *inode = &ci->vfs_inode;
> struct ceph_cap *cap;
> struct rb_node *p;
> - int ret = 0;
>
> - spin_lock(&ci->i_ceph_lock);
> for (p = rb_first(&ci->i_caps); p; p = rb_next(p)) {
> cap = rb_entry(p, struct ceph_cap, ci_node);
> - if (__cap_is_valid(cap) &&
> - (cap->implemented & ~cap->issued & mask)) {
> - ret = 1;
> - break;
> - }
> + if (cap != ocap && __cap_is_valid(cap) &&
> + (cap->implemented & ~cap->issued & mask))
> + return 1;
> }
> + return 0;
> +}
> +
> +int ceph_caps_revoking(struct ceph_inode_info *ci, int mask)
> +{
> + struct inode *inode = &ci->vfs_inode;
> + int ret;
> +
> + spin_lock(&ci->i_ceph_lock);
> + ret = __ceph_caps_revoking_other(ci, NULL, mask);
> spin_unlock(&ci->i_ceph_lock);
> dout("ceph_caps_revoking %p %s = %d\n", inode,
> ceph_cap_string(mask), ret);
> @@ -2491,6 +2497,11 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
> } else {
> dout("grant: %s -> %s\n", ceph_cap_string(cap->issued),
> ceph_cap_string(newcaps));
> + /* non-auth MDS is revoking the newly grant caps ? */
> + if (cap == ci->i_auth_cap &&
> + __ceph_caps_revoking_other(ci, cap, newcaps))
> + check_caps = 2;
> +
> cap->issued = newcaps;
> cap->implemented |= newcaps; /* add bits only, to
> * avoid stepping on a
>
next prev parent reply other threads:[~2013-06-24 8:16 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 6:41 [PATCH 1/3] libceph: call r_unsafe_callback when unsafe reply is received Yan, Zheng
2013-06-24 6:41 ` [PATCH 2/3] mds: fix cap revoke race Yan, Zheng
2013-06-24 8:00 ` Yan, Zheng
2013-06-24 8:19 ` Yan, Zheng
2013-06-24 6:41 ` [PATCH 3/3] mds: fix race between cap issue and revoke Yan, Zheng
2013-06-24 8:16 ` Yan, Zheng [this message]
2013-07-01 7:28 ` [PATCH 1/3] libceph: call r_unsafe_callback when unsafe reply is received Yan, Zheng
2013-07-01 19:46 ` Sage Weil
2013-07-03 21:57 ` Sage Weil
2013-07-03 22:07 ` Milosz Tanski
2013-07-03 22:10 ` Sage Weil
2013-07-03 22:43 ` Yan, Zheng
2013-07-08 14:42 ` Milosz Tanski
2013-07-08 19:58 ` Milosz Tanski
2013-07-08 20:30 ` Yan, Zheng
2013-07-08 21:16 ` Milosz Tanski
2013-07-25 15:43 ` Milosz Tanski
2013-07-03 22:18 ` Alex Elder
2013-07-03 22:22 ` Yan, Zheng
2013-07-03 22:26 ` Sage Weil
2013-07-03 22:32 ` Sage Weil
2013-07-02 13:07 ` Alex Elder
2013-07-02 14:27 ` Yan, Zheng
2013-07-02 18:10 ` Sage Weil
2013-07-02 18:11 ` Alex Elder
-- strict thread matches above, loose matches on Subject: below --
2013-06-17 2:48 [PATCH 2/3] mds: fix cap revoke race Yan, Zheng
2013-06-17 2:48 ` [PATCH 3/3] mds: fix race between cap issue and revoke Yan, Zheng
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=51C8005E.9020105@intel.com \
--to=zheng.z.yan@intel.com \
--cc=alex.elder@linaro.org \
--cc=ceph-devel@vger.kernel.org \
--cc=sage@inktank.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox