diff mbox

[5/6] ceph: check mds_wanted for imported cap

Message ID 1357299261-20591-6-git-send-email-zheng.z.yan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Yan, Zheng Jan. 4, 2013, 11:34 a.m. UTC
From: "Yan, Zheng" <zheng.z.yan@intel.com>

The MDS may have incorrect wanted caps after importing caps. So the
client should check the value mds has and send cap update if necessary.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
---
 fs/ceph/caps.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Sage Weil Jan. 6, 2013, 6:20 a.m. UTC | #1
On Fri, 4 Jan 2013, Yan, Zheng wrote:
> From: "Yan, Zheng" <zheng.z.yan@intel.com>
> 
> The MDS may have incorrect wanted caps after importing caps. So the
> client should check the value mds has and send cap update if necessary.
> 
> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> ---
>  fs/ceph/caps.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index 7e90299..16c10f8 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -2425,10 +2425,12 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
>  	     ceph_cap_string(used),
>  	     ceph_cap_string(dirty));
>  	if (wanted != le32_to_cpu(grant->wanted)) {
> -		dout("mds wanted %s -> %s\n",
> -		     ceph_cap_string(le32_to_cpu(grant->wanted)),
> -		     ceph_cap_string(wanted));
> -		grant->wanted = cpu_to_le32(wanted);

Doh, this was a holdover from when we used to re-use the incoming message 
and send it back out over the wire.

> +		dout("mds wanted = %s\n",
> +		     ceph_cap_string(le32_to_cpu(grant->wanted)));

Any reason to drop the "old -> new" output?

> +		/* imported cap may not have correct mds_wanted */
> +		if (cap == ci->i_auth_cap &&
> +		    (wanted & ~(cap->mds_wanted | cap->issued)))
> +			check_caps = 1;

I think we want

		if (cap == ci->i_auth_cap)
			check_caps = 1;

If we want more caps, check_caps will request immediately.  If we have 
extra, we'll put the cap on the delay list.

sage


>  	}
>  
>  	cap->seq = seq;
> -- 
> 1.7.11.7
> 
> 
--
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
Yan, Zheng Jan. 6, 2013, 8:21 a.m. UTC | #2
On 01/06/2013 02:20 PM, Sage Weil wrote:
> On Fri, 4 Jan 2013, Yan, Zheng wrote:
>> From: "Yan, Zheng" <zheng.z.yan@intel.com>
>>
>> The MDS may have incorrect wanted caps after importing caps. So the
>> client should check the value mds has and send cap update if necessary.
>>
>> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
>> ---
>>  fs/ceph/caps.c | 10 ++++++----
>>  1 file changed, 6 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
>> index 7e90299..16c10f8 100644
>> --- a/fs/ceph/caps.c
>> +++ b/fs/ceph/caps.c
>> @@ -2425,10 +2425,12 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
>>  	     ceph_cap_string(used),
>>  	     ceph_cap_string(dirty));
>>  	if (wanted != le32_to_cpu(grant->wanted)) {
>> -		dout("mds wanted %s -> %s\n",
>> -		     ceph_cap_string(le32_to_cpu(grant->wanted)),
>> -		     ceph_cap_string(wanted));
>> -		grant->wanted = cpu_to_le32(wanted);
> 
> Doh, this was a holdover from when we used to re-use the incoming message 
> and send it back out over the wire.
> 
>> +		dout("mds wanted = %s\n",
>> +		     ceph_cap_string(le32_to_cpu(grant->wanted)));
> 
> Any reason to drop the "old -> new" output?
> 
will and it back in next patch

>> +		/* imported cap may not have correct mds_wanted */
>> +		if (cap == ci->i_auth_cap &&
>> +		    (wanted & ~(cap->mds_wanted | cap->issued)))
>> +			check_caps = 1;
> 
> I think we want
> 
> 		if (cap == ci->i_auth_cap)
> 			check_caps = 1;
probably, we need

if (le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT)
  check_caps = 1;

Regards
Yan, Zheng

> 
> If we want more caps, check_caps will request immediately.  If we have 
> extra, we'll put the cap on the delay list.
> 
> sage
> 
> 
>>  	}
>>  
>>  	cap->seq = seq;
>> -- 
>> 1.7.11.7
>>
>>

--
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
Sage Weil Jan. 7, 2013, 5:06 a.m. UTC | #3
On Sun, 6 Jan 2013, Yan, Zheng wrote:
> On 01/06/2013 02:20 PM, Sage Weil wrote:
> > On Fri, 4 Jan 2013, Yan, Zheng wrote:
> >> From: "Yan, Zheng" <zheng.z.yan@intel.com>
> >>
> >> The MDS may have incorrect wanted caps after importing caps. So the
> >> client should check the value mds has and send cap update if necessary.
> >>
> >> Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
> >> ---
> >>  fs/ceph/caps.c | 10 ++++++----
> >>  1 file changed, 6 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> >> index 7e90299..16c10f8 100644
> >> --- a/fs/ceph/caps.c
> >> +++ b/fs/ceph/caps.c
> >> @@ -2425,10 +2425,12 @@ static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
> >>  	     ceph_cap_string(used),
> >>  	     ceph_cap_string(dirty));
> >>  	if (wanted != le32_to_cpu(grant->wanted)) {
> >> -		dout("mds wanted %s -> %s\n",
> >> -		     ceph_cap_string(le32_to_cpu(grant->wanted)),
> >> -		     ceph_cap_string(wanted));
> >> -		grant->wanted = cpu_to_le32(wanted);
> > 
> > Doh, this was a holdover from when we used to re-use the incoming message 
> > and send it back out over the wire.
> > 
> >> +		dout("mds wanted = %s\n",
> >> +		     ceph_cap_string(le32_to_cpu(grant->wanted)));
> > 
> > Any reason to drop the "old -> new" output?
> > 
> will and it back in next patch
> 
> >> +		/* imported cap may not have correct mds_wanted */
> >> +		if (cap == ci->i_auth_cap &&
> >> +		    (wanted & ~(cap->mds_wanted | cap->issued)))
> >> +			check_caps = 1;
> > 
> > I think we want
> > 
> > 		if (cap == ci->i_auth_cap)
> > 			check_caps = 1;
> probably, we need
> 
> if (le32_to_cpu(grant->op) == CEPH_CAP_OP_IMPORT)
>   check_caps = 1;

That sounds right; I can't think offhand why the MDS would have an 
incorrect notion of wanted except on import.

sage


> 
> Regards
> Yan, Zheng
> 
> > 
> > If we want more caps, check_caps will request immediately.  If we have 
> > extra, we'll put the cap on the delay list.
> > 
> > sage
> > 
> > 
> >>  	}
> >>  
> >>  	cap->seq = seq;
> >> -- 
> >> 1.7.11.7
> >>
> >>
> 
> 
--
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/caps.c b/fs/ceph/caps.c
index 7e90299..16c10f8 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2425,10 +2425,12 @@  static void handle_cap_grant(struct inode *inode, struct ceph_mds_caps *grant,
 	     ceph_cap_string(used),
 	     ceph_cap_string(dirty));
 	if (wanted != le32_to_cpu(grant->wanted)) {
-		dout("mds wanted %s -> %s\n",
-		     ceph_cap_string(le32_to_cpu(grant->wanted)),
-		     ceph_cap_string(wanted));
-		grant->wanted = cpu_to_le32(wanted);
+		dout("mds wanted = %s\n",
+		     ceph_cap_string(le32_to_cpu(grant->wanted)));
+		/* imported cap may not have correct mds_wanted */
+		if (cap == ci->i_auth_cap &&
+		    (wanted & ~(cap->mds_wanted | cap->issued)))
+			check_caps = 1;
 	}
 
 	cap->seq = seq;