2010-10-12 11:09:40

by P.B.Shelley

[permalink] [raw]
Subject: Question about LAYOUTRETURN stateid

Hi, all

While reading Linux pnfs code, I have a question in layoutreturn code path.

nfs4_layoutreturn_release() only invalidate layout stateid when
res.lrs_present is FALSE. If it is TRUE, client is supposed to set it
to res.stateid, is it? But I do not see somewhere the layout stateid
is updated. Am I missing something?

5683 static void nfs4_layoutreturn_release(void *calldata)
5684 {
5685 struct nfs4_layoutreturn *lrp = calldata;
5686 struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout;
5687
5688 dprintk("--> %s return_type %d lo %p\n", __func__,
5689 lrp->args.return_type, lo);
5690
5691 if (lrp->args.return_type == RETURN_FILE) {
5692 if (!lrp->res.lrs_present)
5693 pnfs_invalidate_layout_stateid(lo);
5694 pnfs_layoutreturn_release(lo, &lrp->args.range);
5695 }
5696 kfree(calldata);
5697 dprintk("<-- %s\n", __func__);
5698 }

--
Thanks,
Shelley


2010-10-12 15:38:19

by Fred Isaman

[permalink] [raw]
Subject: Re: Question about LAYOUTRETURN stateid

On Tue, Oct 12, 2010 at 11:29 AM, William A. (Andy) Adamson
<[email protected]> wrote:
> I'll send one
>
> -->Andy

Another issue in the same code that could be fixed at the same time:
the set/invalidate stateid decision should not be under the type==FILE
check, but should always be done.

Fred

>
> On Tue, Oct 12, 2010 at 10:40 AM, Benny Halevy <[email protected]> wrote:
>> On 2010-10-12 09:11, Fred Isaman wrote:
>>> On Tue, Oct 12, 2010 at 7:09 AM, P.B.Shelley <[email protected]> wrote:
>>>> Hi, all
>>>>
>>>> While reading Linux pnfs code, I have a question in layoutreturn code path.
>>>>
>>>> nfs4_layoutreturn_release() only invalidate layout stateid when
>>>> res.lrs_present is FALSE. If it is TRUE, client is supposed to set it
>>>> to res.stateid, is it? But I do not see somewhere the layout stateid
>>>> is updated. Am I missing something?
>>>>
>>>
>>> No, you are not missing anything. ?that is a bug.
>>>
>>
>> Agreed.
>> Who's volunteering to send a fix? :)
>>
>> Benny
>>
>>> Fred
>>>
>>>> 5683 static void nfs4_layoutreturn_release(void *calldata)
>>>> 5684 {
>>>> 5685 ? ? ? ? struct nfs4_layoutreturn *lrp = calldata;
>>>> 5686 ? ? ? ? struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout;
>>>> 5687
>>>> 5688 ? ? ? ? dprintk("--> %s return_type %d lo %p\n", __func__,
>>>> 5689 ? ? ? ? ? ? ? ? lrp->args.return_type, lo);
>>>> 5690
>>>> 5691 ? ? ? ? if (lrp->args.return_type == RETURN_FILE) {
>>>> 5692 ? ? ? ? ? ? ? ? if (!lrp->res.lrs_present)
>>>> 5693 ? ? ? ? ? ? ? ? ? ? ? ? pnfs_invalidate_layout_stateid(lo);
>>>> 5694 ? ? ? ? ? ? ? ? pnfs_layoutreturn_release(lo, &lrp->args.range);
>>>> 5695 ? ? ? ? }
>>>> 5696 ? ? ? ? kfree(calldata);
>>>> 5697 ? ? ? ? dprintk("<-- %s\n", __func__);
>>>> 5698 }
>>>>
>>>> --
>>>> Thanks,
>>>> Shelley
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>>>> the body of a message to [email protected]
>>>> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>>> the body of a message to [email protected]
>>> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

2010-10-12 13:11:57

by Fred Isaman

[permalink] [raw]
Subject: Re: Question about LAYOUTRETURN stateid

On Tue, Oct 12, 2010 at 7:09 AM, P.B.Shelley <[email protected]> wrote:
> Hi, all
>
> While reading Linux pnfs code, I have a question in layoutreturn code path.
>
> nfs4_layoutreturn_release() only invalidate layout stateid when
> res.lrs_present is FALSE. If it is TRUE, client is supposed to set it
> to res.stateid, is it? But I do not see somewhere the layout stateid
> is updated. Am I missing something?
>

No, you are not missing anything. that is a bug.

Fred

> 5683 static void nfs4_layoutreturn_release(void *calldata)
> 5684 {
> 5685 ? ? ? ? struct nfs4_layoutreturn *lrp = calldata;
> 5686 ? ? ? ? struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout;
> 5687
> 5688 ? ? ? ? dprintk("--> %s return_type %d lo %p\n", __func__,
> 5689 ? ? ? ? ? ? ? ? lrp->args.return_type, lo);
> 5690
> 5691 ? ? ? ? if (lrp->args.return_type == RETURN_FILE) {
> 5692 ? ? ? ? ? ? ? ? if (!lrp->res.lrs_present)
> 5693 ? ? ? ? ? ? ? ? ? ? ? ? pnfs_invalidate_layout_stateid(lo);
> 5694 ? ? ? ? ? ? ? ? pnfs_layoutreturn_release(lo, &lrp->args.range);
> 5695 ? ? ? ? }
> 5696 ? ? ? ? kfree(calldata);
> 5697 ? ? ? ? dprintk("<-- %s\n", __func__);
> 5698 }
>
> --
> Thanks,
> Shelley
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at ?http://vger.kernel.org/majordomo-info.html
>

2010-10-12 14:40:48

by Benny Halevy

[permalink] [raw]
Subject: Re: Question about LAYOUTRETURN stateid

On 2010-10-12 09:11, Fred Isaman wrote:
> On Tue, Oct 12, 2010 at 7:09 AM, P.B.Shelley <[email protected]> wrote:
>> Hi, all
>>
>> While reading Linux pnfs code, I have a question in layoutreturn code path.
>>
>> nfs4_layoutreturn_release() only invalidate layout stateid when
>> res.lrs_present is FALSE. If it is TRUE, client is supposed to set it
>> to res.stateid, is it? But I do not see somewhere the layout stateid
>> is updated. Am I missing something?
>>
>
> No, you are not missing anything. that is a bug.
>

Agreed.
Who's volunteering to send a fix? :)

Benny

> Fred
>
>> 5683 static void nfs4_layoutreturn_release(void *calldata)
>> 5684 {
>> 5685 struct nfs4_layoutreturn *lrp = calldata;
>> 5686 struct pnfs_layout_hdr *lo = NFS_I(lrp->args.inode)->layout;
>> 5687
>> 5688 dprintk("--> %s return_type %d lo %p\n", __func__,
>> 5689 lrp->args.return_type, lo);
>> 5690
>> 5691 if (lrp->args.return_type == RETURN_FILE) {
>> 5692 if (!lrp->res.lrs_present)
>> 5693 pnfs_invalidate_layout_stateid(lo);
>> 5694 pnfs_layoutreturn_release(lo, &lrp->args.range);
>> 5695 }
>> 5696 kfree(calldata);
>> 5697 dprintk("<-- %s\n", __func__);
>> 5698 }
>>
>> --
>> Thanks,
>> Shelley
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to [email protected]
>> More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html

2010-10-12 15:29:35

by Andy Adamson

[permalink] [raw]
Subject: Re: Question about LAYOUTRETURN stateid

I'll send one

-->Andy

On Tue, Oct 12, 2010 at 10:40 AM, Benny Halevy <[email protected]> wr=
ote:
> On 2010-10-12 09:11, Fred Isaman wrote:
>> On Tue, Oct 12, 2010 at 7:09 AM, P.B.Shelley <[email protected]> w=
rote:
>>> Hi, all
>>>
>>> While reading Linux pnfs code, I have a question in layoutreturn co=
de path.
>>>
>>> nfs4_layoutreturn_release() only invalidate layout stateid when
>>> res.lrs_present is FALSE. If it is TRUE, client is supposed to set =
it
>>> to res.stateid, is it? But I do not see somewhere the layout statei=
d
>>> is updated. Am I missing something?
>>>
>>
>> No, you are not missing anything. =A0that is a bug.
>>
>
> Agreed.
> Who's volunteering to send a fix? :)
>
> Benny
>
>> Fred
>>
>>> 5683 static void nfs4_layoutreturn_release(void *calldata)
>>> 5684 {
>>> 5685 =A0 =A0 =A0 =A0 struct nfs4_layoutreturn *lrp =3D calldata;
>>> 5686 =A0 =A0 =A0 =A0 struct pnfs_layout_hdr *lo =3D NFS_I(lrp->args=
=2Einode)->layout;
>>> 5687
>>> 5688 =A0 =A0 =A0 =A0 dprintk("--> %s return_type %d lo %p\n", __fun=
c__,
>>> 5689 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 lrp->args.return_type, lo);
>>> 5690
>>> 5691 =A0 =A0 =A0 =A0 if (lrp->args.return_type =3D=3D RETURN_FILE) =
{
>>> 5692 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!lrp->res.lrs_present)
>>> 5693 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pnfs_invalidat=
e_layout_stateid(lo);
>>> 5694 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pnfs_layoutreturn_release(lo, =
&lrp->args.range);
>>> 5695 =A0 =A0 =A0 =A0 }
>>> 5696 =A0 =A0 =A0 =A0 kfree(calldata);
>>> 5697 =A0 =A0 =A0 =A0 dprintk("<-- %s\n", __func__);
>>> 5698 }
>>>
>>> --
>>> Thanks,
>>> Shelley
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs=
" in
>>> the body of a message to [email protected]
>>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.htm=
l
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs"=
in
>> the body of a message to [email protected]
>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" =
in
> the body of a message to [email protected]
> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>

2010-10-12 15:41:18

by Andy Adamson

[permalink] [raw]
Subject: Re: Question about LAYOUTRETURN stateid

On Tue, Oct 12, 2010 at 11:38 AM, Fred Isaman <[email protected]> wrot=
e:
> On Tue, Oct 12, 2010 at 11:29 AM, William A. (Andy) Adamson
> <[email protected]> wrote:
>> I'll send one
>>
>> -->Andy
>
> Another issue in the same code that could be fixed at the same time:
> the set/invalidate stateid decision should not be under the type=3D=3D=
=46ILE
> check, but should always be done.
>
> Fred

OK - I'll look that over.

-->Andy

>
>>
>> On Tue, Oct 12, 2010 at 10:40 AM, Benny Halevy <[email protected]>=
wrote:
>>> On 2010-10-12 09:11, Fred Isaman wrote:
>>>> On Tue, Oct 12, 2010 at 7:09 AM, P.B.Shelley <[email protected]>=
wrote:
>>>>> Hi, all
>>>>>
>>>>> While reading Linux pnfs code, I have a question in layoutreturn =
code path.
>>>>>
>>>>> nfs4_layoutreturn_release() only invalidate layout stateid when
>>>>> res.lrs_present is FALSE. If it is TRUE, client is supposed to se=
t it
>>>>> to res.stateid, is it? But I do not see somewhere the layout stat=
eid
>>>>> is updated. Am I missing something?
>>>>>
>>>>
>>>> No, you are not missing anything. =A0that is a bug.
>>>>
>>>
>>> Agreed.
>>> Who's volunteering to send a fix? :)
>>>
>>> Benny
>>>
>>>> Fred
>>>>
>>>>> 5683 static void nfs4_layoutreturn_release(void *calldata)
>>>>> 5684 {
>>>>> 5685 =A0 =A0 =A0 =A0 struct nfs4_layoutreturn *lrp =3D calldata;
>>>>> 5686 =A0 =A0 =A0 =A0 struct pnfs_layout_hdr *lo =3D NFS_I(lrp->ar=
gs.inode)->layout;
>>>>> 5687
>>>>> 5688 =A0 =A0 =A0 =A0 dprintk("--> %s return_type %d lo %p\n", __f=
unc__,
>>>>> 5689 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 lrp->args.return_type, lo);
>>>>> 5690
>>>>> 5691 =A0 =A0 =A0 =A0 if (lrp->args.return_type =3D=3D RETURN_FILE=
) {
>>>>> 5692 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (!lrp->res.lrs_present)
>>>>> 5693 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pnfs_invalid=
ate_layout_stateid(lo);
>>>>> 5694 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 pnfs_layoutreturn_release(lo=
, &lrp->args.range);
>>>>> 5695 =A0 =A0 =A0 =A0 }
>>>>> 5696 =A0 =A0 =A0 =A0 kfree(calldata);
>>>>> 5697 =A0 =A0 =A0 =A0 dprintk("<-- %s\n", __func__);
>>>>> 5698 }
>>>>>
>>>>> --
>>>>> Thanks,
>>>>> Shelley
>>>>> --
>>>>> To unsubscribe from this list: send the line "unsubscribe linux-n=
fs" in
>>>>> the body of a message to [email protected]
>>>>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.h=
tml
>>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe linux-nf=
s" in
>>>> the body of a message to [email protected]
>>>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.ht=
ml
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-nfs=
" in
>>> the body of a message to [email protected]
>>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.htm=
l
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs"=
in
>> the body of a message to [email protected]
>> More majordomo info at =A0http://vger.kernel.org/majordomo-info.html
>>
>