diff mbox

[1/5] ceph: fix wrong check in ceph_renew_caps()

Message ID 20170405013019.5032-1-zyan@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng April 5, 2017, 1:30 a.m. UTC
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
---
 fs/ceph/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Layton April 5, 2017, 2:16 p.m. UTC | #1
On Wed, 2017-04-05 at 09:30 +0800, Yan, Zheng wrote:
> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
> ---
>  fs/ceph/file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
> index 579a16c..0480492 100644
> --- a/fs/ceph/file.c
> +++ b/fs/ceph/file.c
> @@ -123,7 +123,7 @@ int ceph_renew_caps(struct inode *inode)
>  	spin_lock(&ci->i_ceph_lock);
>  	wanted = __ceph_caps_file_wanted(ci);
>  	if (__ceph_is_any_real_caps(ci) &&
> -	    (!(wanted & CEPH_CAP_ANY_WR) == 0 || ci->i_auth_cap)) {
> +	    (!(wanted & CEPH_CAP_ANY_WR) || ci->i_auth_cap)) {
>  		int issued = __ceph_caps_issued(ci, NULL);
>  		spin_unlock(&ci->i_ceph_lock);
>  		dout("renew caps %p want %s issued %s updating mds_wanted\n",

That certainly looks more like what was intended, but I'm still a
little unclear on why we have so much special casing in all of this
caps handling.

Why do we skip ceph_check_caps if we want CEPH_CAP_ANY_WR?
Yan, Zheng April 6, 2017, 12:04 a.m. UTC | #2
> On 5 Apr 2017, at 22:16, Jeff Layton <jlayton@redhat.com> wrote:
> 
> On Wed, 2017-04-05 at 09:30 +0800, Yan, Zheng wrote:
>> Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
>> ---
>> fs/ceph/file.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/fs/ceph/file.c b/fs/ceph/file.c
>> index 579a16c..0480492 100644
>> --- a/fs/ceph/file.c
>> +++ b/fs/ceph/file.c
>> @@ -123,7 +123,7 @@ int ceph_renew_caps(struct inode *inode)
>> 	spin_lock(&ci->i_ceph_lock);
>> 	wanted = __ceph_caps_file_wanted(ci);
>> 	if (__ceph_is_any_real_caps(ci) &&
>> -	    (!(wanted & CEPH_CAP_ANY_WR) == 0 || ci->i_auth_cap)) {
>> +	    (!(wanted & CEPH_CAP_ANY_WR) || ci->i_auth_cap)) {
>> 		int issued = __ceph_caps_issued(ci, NULL);
>> 		spin_unlock(&ci->i_ceph_lock);
>> 		dout("renew caps %p want %s issued %s updating mds_wanted\n",
> 
> That certainly looks more like what was intended, but I'm still a
> little unclear on why we have so much special casing in all of this
> caps handling.
> 
> Why do we skip ceph_check_caps if we want CEPH_CAP_ANY_WR?

It’s for multiple active mds setup. client can request read caps from any mds (that replicates the inode). client need to request write caps from auth mds.

Regards
Yan, Zheng 

> -- 
> Jeff Layton <jlayton@redhat.com>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index 579a16c..0480492 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -123,7 +123,7 @@  int ceph_renew_caps(struct inode *inode)
 	spin_lock(&ci->i_ceph_lock);
 	wanted = __ceph_caps_file_wanted(ci);
 	if (__ceph_is_any_real_caps(ci) &&
-	    (!(wanted & CEPH_CAP_ANY_WR) == 0 || ci->i_auth_cap)) {
+	    (!(wanted & CEPH_CAP_ANY_WR) || ci->i_auth_cap)) {
 		int issued = __ceph_caps_issued(ci, NULL);
 		spin_unlock(&ci->i_ceph_lock);
 		dout("renew caps %p want %s issued %s updating mds_wanted\n",