Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1265520 > unrolled thread

Re: [PATCH] ceph:Fix error handling in the function down_reply

Started by"Yan, Zheng" <zyan@redhat.com>
First post2015-11-09 11:20 +0100
Last post2015-11-09 11:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] ceph:Fix error handling in the function down_reply "Yan, Zheng" <zyan@redhat.com> - 2015-11-09 11:20 +0100
    Re: [PATCH] ceph:Fix error handling in the function down_reply Ilya Dryomov <idryomov@gmail.com> - 2015-11-09 11:30 +0100

#1265520 — Re: [PATCH] ceph:Fix error handling in the function down_reply

From"Yan, Zheng" <zyan@redhat.com>
Date2015-11-09 11:20 +0100
SubjectRe: [PATCH] ceph:Fix error handling in the function down_reply
Message-ID<qsRIl-55g-9@gated-at.bofh.it>
> On Nov 9, 2015, at 11:11, Nicholas Krause <xerofoify@gmail.com> wrote:
> 
> This fixes error handling in the function down_reply in order to
> properly check and jump to the goto label, out_err for this
> particular function if a error code is returned by any function
> called in down_reply and therefore make checking be included
> for the call to ceph_update_snap_trace in order to comply with
> these error handling checks/paths.
> 
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> fs/ceph/mds_client.c | 11 +++++++----
> 1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 51cb02d..0b01f94 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -2495,14 +2495,17 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
> 	realm = NULL;
> 	if (rinfo->snapblob_len) {
> 		down_write(&mdsc->snap_rwsem);
> -		ceph_update_snap_trace(mdsc, rinfo->snapblob,
> -				rinfo->snapblob + rinfo->snapblob_len,
> -				le32_to_cpu(head->op) == CEPH_MDS_OP_RMSNAP,
> -				&realm);
> +		err = ceph_update_snap_trace(mdsc, rinfo->snapblob,
> +					     rinfo->snapblob + rinfo->snapblob_len,
> +					     le32_to_cpu(head->op) == CEPH_MDS_OP_RMSNAP,
> +					     &realm);
> 		downgrade_write(&mdsc->snap_rwsem);
> 	} else {
> 		down_read(&mdsc->snap_rwsem);
> 	}
> +
> +	if (err)
> +		goto out_err;
> 
> 	/* insert trace into our cache */
> 	mutex_lock(&req->r_fill_mutex);

Applied, thanks

Yan, Zheng

> -- 
> 2.5.0
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1265547

FromIlya Dryomov <idryomov@gmail.com>
Date2015-11-09 11:30 +0100
Message-ID<qsRS2-598-27@gated-at.bofh.it>
In reply to#1265520
On Mon, Nov 9, 2015 at 11:15 AM, Yan, Zheng <zyan@redhat.com> wrote:
>
>> On Nov 9, 2015, at 11:11, Nicholas Krause <xerofoify@gmail.com> wrote:
>>
>> This fixes error handling in the function down_reply in order to
>> properly check and jump to the goto label, out_err for this
>> particular function if a error code is returned by any function
>> called in down_reply and therefore make checking be included
>> for the call to ceph_update_snap_trace in order to comply with
>> these error handling checks/paths.
>>
>> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
>> ---
>> fs/ceph/mds_client.c | 11 +++++++----
>> 1 file changed, 7 insertions(+), 4 deletions(-)
>>
>> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
>> index 51cb02d..0b01f94 100644
>> --- a/fs/ceph/mds_client.c
>> +++ b/fs/ceph/mds_client.c
>> @@ -2495,14 +2495,17 @@ static void handle_reply(struct ceph_mds_session *session, struct ceph_msg *msg)
>>       realm = NULL;
>>       if (rinfo->snapblob_len) {
>>               down_write(&mdsc->snap_rwsem);
>> -             ceph_update_snap_trace(mdsc, rinfo->snapblob,
>> -                             rinfo->snapblob + rinfo->snapblob_len,
>> -                             le32_to_cpu(head->op) == CEPH_MDS_OP_RMSNAP,
>> -                             &realm);
>> +             err = ceph_update_snap_trace(mdsc, rinfo->snapblob,
>> +                                          rinfo->snapblob + rinfo->snapblob_len,
>> +                                          le32_to_cpu(head->op) == CEPH_MDS_OP_RMSNAP,
>> +                                          &realm);
>>               downgrade_write(&mdsc->snap_rwsem);
>>       } else {
>>               down_read(&mdsc->snap_rwsem);
>>       }
>> +
>> +     if (err)
>> +             goto out_err;
>>
>>       /* insert trace into our cache */
>>       mutex_lock(&req->r_fill_mutex);
>
> Applied, thanks

This looks to me like it'd leave snap_rwsem locked for read?  Also, the
name of the function in question is handle_reply(), not down_reply().

I'll revert testing.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web