linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Write delegation
@ 2010-08-03  0:17 Yudong Gao
       [not found] ` <AANLkTi=2KYZ-8qaXMG=C_s617q3k1Ocs7h1gyd8=RpY6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Yudong Gao @ 2010-08-03  0:17 UTC (permalink / raw)
  To: linux-nfs

Hi,

I am looking at the delegation implementation in the source code of
NFS 4.1 in kernel 2.6.32.15. I can find the code for read delegation,
which is working and can serve the read requests locally. But I can
never find the code about write delegation, which is supposed to cache
the write update locally. I try to look at the functions including
nfs_writepage(s), nfs_file_flush() but none of them checks or uses the
write delegation.

Is write delegation currently implemented in NFS 4.1?

Thanks!

best,

Yudong

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
       [not found] ` <AANLkTi=2KYZ-8qaXMG=C_s617q3k1Ocs7h1gyd8=RpY6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-08-04 19:21   ` Yudong Gao
  2010-08-04 20:59     ` Andy Adamson
  2010-08-04 21:09     ` Write delegation Trond Myklebust
  0 siblings, 2 replies; 16+ messages in thread
From: Yudong Gao @ 2010-08-04 19:21 UTC (permalink / raw)
  To: linux-nfs

Hi,

I am not able to find the implementation of directory delegation,
either. Similarly, the callback functions CB_NOTIFY is not
implemented, either. I find that in preprocss_nfs41_op() in
callback_xdr.c, whenever a CB_NOTIFY is encountered, an
NFS4ERR_NOTSUPP is returned directly.

Am I missing something? Or they are just not supported in the current version?

Thanks a lot!

best,

Yudong

On Mon, Aug 2, 2010 at 5:17 PM, Yudong Gao <stgyd@umich.edu> wrote:
> Hi,
>
> I am looking at the delegation implementation in the source code of
> NFS 4.1 in kernel 2.6.32.15. I can find the code for read delegation,
> which is working and can serve the read requests locally. But I can
> never find the code about write delegation, which is supposed to cache
> the write update locally. I try to look at the functions including
> nfs_writepage(s), nfs_file_flush() but none of them checks or uses the
> write delegation.
>
> Is write delegation currently implemented in NFS 4.1?
>
> Thanks!
>
> best,
>
> Yudong
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-04 19:21   ` Yudong Gao
@ 2010-08-04 20:59     ` Andy Adamson
  2010-08-04 21:11       ` Yudong Gao
  2010-08-04 21:09     ` Write delegation Trond Myklebust
  1 sibling, 1 reply; 16+ messages in thread
From: Andy Adamson @ 2010-08-04 20:59 UTC (permalink / raw)
  To: Yudong Gao; +Cc: linux-nfs


On Aug 4, 2010, at 3:21 PM, Yudong Gao wrote:

> Hi,
> 
> I am not able to find the implementation of directory delegation,
> either. Similarly, the callback functions CB_NOTIFY is not
> implemented, either. I find that in preprocss_nfs41_op() in
> callback_xdr.c, whenever a CB_NOTIFY is encountered, an
> NFS4ERR_NOTSUPP is returned directly.

CB_NOTIFY is not currently supported on the Linux NFS client.

> 
> Am I missing something? Or they are just not supported in the current version?
> 
> Thanks a lot!
> 
> best,
> 
> Yudong
> 
> On Mon, Aug 2, 2010 at 5:17 PM, Yudong Gao <stgyd@umich.edu> wrote:
>> Hi,
>> 
>> I am looking at the delegation implementation in the source code of
>> NFS 4.1 in kernel 2.6.32.15. I can find the code for read delegation,
>> which is working and can serve the read requests locally. But I can
>> never find the code about write delegation, which is supposed to cache
>> the write update locally. I try to look at the functions including
>> nfs_writepage(s), nfs_file_flush() but none of them checks or uses the
>> write delegation.
>> 
>> Is write delegation currently implemented in NFS 4.1?

Write delegation is supported but I don't think write behavior changes - writes are still cached and flushed as without a write delegation. The write delegation does prevent open/close and lock/locku from being put on the wire.

-->Andy

>> 
>> Thanks!
>> 
>> best,
>> 
>> Yudong
>> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-04 19:21   ` Yudong Gao
  2010-08-04 20:59     ` Andy Adamson
@ 2010-08-04 21:09     ` Trond Myklebust
  2010-08-04 21:20       ` Yudong Gao
  1 sibling, 1 reply; 16+ messages in thread
From: Trond Myklebust @ 2010-08-04 21:09 UTC (permalink / raw)
  To: Yudong Gao; +Cc: linux-nfs

On Wed, 2010-08-04 at 12:21 -0700, Yudong Gao wrote:
> Hi,
> 
> I am not able to find the implementation of directory delegation,
> either. Similarly, the callback functions CB_NOTIFY is not
> implemented, either. I find that in preprocss_nfs41_op() in
> callback_xdr.c, whenever a CB_NOTIFY is encountered, an
> NFS4ERR_NOTSUPP is returned directly.
> 
> Am I missing something? Or they are just not supported in the current version?

The client currently does not request any directory delegations or
notifications, so there is no reason for it to support CB_NOTIFY.

Maybe we will add support for directory delegations and notifications at
some time in the future, but before that happens, somebody needs to
convince me that they are useful. Currently there is very little
documentation to support any assertion that they are...

Cheers
  Trond


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-04 20:59     ` Andy Adamson
@ 2010-08-04 21:11       ` Yudong Gao
  2010-08-04 21:22         ` Trond Myklebust
  0 siblings, 1 reply; 16+ messages in thread
From: Yudong Gao @ 2010-08-04 21:11 UTC (permalink / raw)
  To: Andy Adamson; +Cc: linux-nfs

Thanks for the reply, Andy!

So the write delegation can only reduce the unnecessary open/close and
lock/locku. But if a client modify the same page for multiple times,
e.g. editing the file in a editor, is there any optimization to
prevent the client from sending the half-updated pages? Ideally only
the final update need to be put on the wire.

Thanks!

best,

Yudong

On Wed, Aug 4, 2010 at 1:59 PM, Andy Adamson <andros@netapp.com> wrote:
>
> On Aug 4, 2010, at 3:21 PM, Yudong Gao wrote:
>
>> Hi,
>>
>> I am not able to find the implementation of directory delegation,
>> either. Similarly, the callback functions CB_NOTIFY is not
>> implemented, either. I find that in preprocss_nfs41_op() in
>> callback_xdr.c, whenever a CB_NOTIFY is encountered, an
>> NFS4ERR_NOTSUPP is returned directly.
>
> CB_NOTIFY is not currently supported on the Linux NFS client.
>
>>
>> Am I missing something? Or they are just not supported in the current version?
>>
>> Thanks a lot!
>>
>> best,
>>
>> Yudong
>>
>> On Mon, Aug 2, 2010 at 5:17 PM, Yudong Gao <stgyd@umich.edu> wrote:
>>> Hi,
>>>
>>> I am looking at the delegation implementation in the source code of
>>> NFS 4.1 in kernel 2.6.32.15. I can find the code for read delegation,
>>> which is working and can serve the read requests locally. But I can
>>> never find the code about write delegation, which is supposed to cache
>>> the write update locally. I try to look at the functions including
>>> nfs_writepage(s), nfs_file_flush() but none of them checks or uses the
>>> write delegation.
>>>
>>> Is write delegation currently implemented in NFS 4.1?
>
> Write delegation is supported but I don't think write behavior changes - writes are still cached and flushed as without a write delegation. The write delegation does prevent open/close and lock/locku from being put on the wire.
>
> -->Andy
>
>>>
>>> Thanks!
>>>
>>> best,
>>>
>>> Yudong
>>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-04 21:09     ` Write delegation Trond Myklebust
@ 2010-08-04 21:20       ` Yudong Gao
  0 siblings, 0 replies; 16+ messages in thread
From: Yudong Gao @ 2010-08-04 21:20 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs

I see. That makes sense. I think in most case the file open delegation
will be enough. It seems to me that the directory data is at least as
critical as the file meta data such as file attributes. This kind of
data, in most cases, should be propagated to the server as soon as
possible. Not sure whether this argument makes sense. :P

Thanks!

best,

Yudong

On Wed, Aug 4, 2010 at 2:09 PM, Trond Myklebust
<trond.myklebust@fys.uio.no> wrote:
> On Wed, 2010-08-04 at 12:21 -0700, Yudong Gao wrote:
>> Hi,
>>
>> I am not able to find the implementation of directory delegation,
>> either. Similarly, the callback functions CB_NOTIFY is not
>> implemented, either. I find that in preprocss_nfs41_op() in
>> callback_xdr.c, whenever a CB_NOTIFY is encountered, an
>> NFS4ERR_NOTSUPP is returned directly.
>>
>> Am I missing something? Or they are just not supported in the current version?
>
> The client currently does not request any directory delegations or
> notifications, so there is no reason for it to support CB_NOTIFY.
>
> Maybe we will add support for directory delegations and notifications at
> some time in the future, but before that happens, somebody needs to
> convince me that they are useful. Currently there is very little
> documentation to support any assertion that they are...
>
> Cheers
>  Trond
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-04 21:11       ` Yudong Gao
@ 2010-08-04 21:22         ` Trond Myklebust
  2010-08-04 21:40           ` Yudong Gao
  0 siblings, 1 reply; 16+ messages in thread
From: Trond Myklebust @ 2010-08-04 21:22 UTC (permalink / raw)
  To: Yudong Gao; +Cc: Andy Adamson, linux-nfs

On Wed, 2010-08-04 at 14:11 -0700, Yudong Gao wrote:
> Thanks for the reply, Andy!
> 
> So the write delegation can only reduce the unnecessary open/close and
> lock/locku. But if a client modify the same page for multiple times,
> e.g. editing the file in a editor, is there any optimization to
> prevent the client from sending the half-updated pages? Ideally only
> the final update need to be put on the wire.
> 

Yes. However that optimisation is not linked to whether or not we hold a
write delegation. The NFS client assumes close-to-open cache
consistency, and so will cache writes until either the VM tries to
reclaim memory by writing out dirty page, or the application calls one
of fcntl(F_UNLCK), fsync() or close().

Trond

> Thanks!
> 
> best,
> 
> Yudong
> 
> On Wed, Aug 4, 2010 at 1:59 PM, Andy Adamson <andros@netapp.com> wrote:
> >
> > On Aug 4, 2010, at 3:21 PM, Yudong Gao wrote:
> >
> >> Hi,
> >>
> >> I am not able to find the implementation of directory delegation,
> >> either. Similarly, the callback functions CB_NOTIFY is not
> >> implemented, either. I find that in preprocss_nfs41_op() in
> >> callback_xdr.c, whenever a CB_NOTIFY is encountered, an
> >> NFS4ERR_NOTSUPP is returned directly.
> >
> > CB_NOTIFY is not currently supported on the Linux NFS client.
> >
> >>
> >> Am I missing something? Or they are just not supported in the current version?
> >>
> >> Thanks a lot!
> >>
> >> best,
> >>
> >> Yudong
> >>
> >> On Mon, Aug 2, 2010 at 5:17 PM, Yudong Gao <stgyd@umich.edu> wrote:
> >>> Hi,
> >>>
> >>> I am looking at the delegation implementation in the source code of
> >>> NFS 4.1 in kernel 2.6.32.15. I can find the code for read delegation,
> >>> which is working and can serve the read requests locally. But I can
> >>> never find the code about write delegation, which is supposed to cache
> >>> the write update locally. I try to look at the functions including
> >>> nfs_writepage(s), nfs_file_flush() but none of them checks or uses the
> >>> write delegation.
> >>>
> >>> Is write delegation currently implemented in NFS 4.1?
> >
> > Write delegation is supported but I don't think write behavior changes - writes are still cached and flushed as without a write delegation. The write delegation does prevent open/close and lock/locku from being put on the wire.
> >
> > -->Andy
> >
> >>>
> >>> Thanks!
> >>>
> >>> best,
> >>>
> >>> Yudong
> >>>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> >> the body of a message to majordomo@vger.kernel.org
> >> 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 majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-04 21:22         ` Trond Myklebust
@ 2010-08-04 21:40           ` Yudong Gao
  2010-08-05  0:52             ` Trond Myklebust
  0 siblings, 1 reply; 16+ messages in thread
From: Yudong Gao @ 2010-08-04 21:40 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Andy Adamson, linux-nfs

I see. But according to the spec, the write delegation is supposed to
break the close-to-open consistency so that the client can avoid
flushing dirty page to server when closing the file. Is this part
implemented? I can not find it in the source code...

Another question is how the nfs file write interacts with fscache? I
was not able to find the code that update the page copy in fscache
when the page in memory is modified.

Thanks a lot!

best,

Yudong

On Wed, Aug 4, 2010 at 2:22 PM, Trond Myklebust
<trond.myklebust@fys.uio.no> wrote:
> On Wed, 2010-08-04 at 14:11 -0700, Yudong Gao wrote:
>> Thanks for the reply, Andy!
>>
>> So the write delegation can only reduce the unnecessary open/close and
>> lock/locku. But if a client modify the same page for multiple times,
>> e.g. editing the file in a editor, is there any optimization to
>> prevent the client from sending the half-updated pages? Ideally only
>> the final update need to be put on the wire.
>>
>
> Yes. However that optimisation is not linked to whether or not we hold a
> write delegation. The NFS client assumes close-to-open cache
> consistency, and so will cache writes until either the VM tries to
> reclaim memory by writing out dirty page, or the application calls one
> of fcntl(F_UNLCK), fsync() or close().
>
> Trond
>
>> Thanks!
>>
>> best,
>>
>> Yudong
>>
>> On Wed, Aug 4, 2010 at 1:59 PM, Andy Adamson <andros@netapp.com> wrote:
>> >
>> > On Aug 4, 2010, at 3:21 PM, Yudong Gao wrote:
>> >
>> >> Hi,
>> >>
>> >> I am not able to find the implementation of directory delegation,
>> >> either. Similarly, the callback functions CB_NOTIFY is not
>> >> implemented, either. I find that in preprocss_nfs41_op() in
>> >> callback_xdr.c, whenever a CB_NOTIFY is encountered, an
>> >> NFS4ERR_NOTSUPP is returned directly.
>> >
>> > CB_NOTIFY is not currently supported on the Linux NFS client.
>> >
>> >>
>> >> Am I missing something? Or they are just not supported in the current version?
>> >>
>> >> Thanks a lot!
>> >>
>> >> best,
>> >>
>> >> Yudong
>> >>
>> >> On Mon, Aug 2, 2010 at 5:17 PM, Yudong Gao <stgyd@umich.edu> wrote:
>> >>> Hi,
>> >>>
>> >>> I am looking at the delegation implementation in the source code of
>> >>> NFS 4.1 in kernel 2.6.32.15. I can find the code for read delegation,
>> >>> which is working and can serve the read requests locally. But I can
>> >>> never find the code about write delegation, which is supposed to cache
>> >>> the write update locally. I try to look at the functions including
>> >>> nfs_writepage(s), nfs_file_flush() but none of them checks or uses the
>> >>> write delegation.
>> >>>
>> >>> Is write delegation currently implemented in NFS 4.1?
>> >
>> > Write delegation is supported but I don't think write behavior changes - writes are still cached and flushed as without a write delegation. The write delegation does prevent open/close and lock/locku from being put on the wire.
>> >
>> > -->Andy
>> >
>> >>>
>> >>> Thanks!
>> >>>
>> >>> best,
>> >>>
>> >>> Yudong
>> >>>
>> >> --
>> >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> >> the body of a message to majordomo@vger.kernel.org
>> >> 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 majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
>
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-04 21:40           ` Yudong Gao
@ 2010-08-05  0:52             ` Trond Myklebust
  2010-08-05  1:22               ` Yudong Gao
  0 siblings, 1 reply; 16+ messages in thread
From: Trond Myklebust @ 2010-08-05  0:52 UTC (permalink / raw)
  To: Yudong Gao; +Cc: Andy Adamson, linux-nfs

On Wed, 2010-08-04 at 14:40 -0700, Yudong Gao wrote:
> I see. But according to the spec, the write delegation is supposed to
> break the close-to-open consistency so that the client can avoid
> flushing dirty page to server when closing the file. Is this part
> implemented? I can not find it in the source code...

No. We didn't do that. The main reason for continuing to flush the
writes on close is to avoid slow delegation recalls.

> Another question is how the nfs file write interacts with fscache? I
> was not able to find the code that update the page copy in fscache
> when the page in memory is modified.

AFAIK fscache is read-only at this point. I think David has plans to
make it read/write, but I don't know whether he will ever do so for NFS.

Trond

> Thanks a lot!
> 
> best,
> 
> Yudong
> 
> On Wed, Aug 4, 2010 at 2:22 PM, Trond Myklebust
> <trond.myklebust@fys.uio.no> wrote:
> > On Wed, 2010-08-04 at 14:11 -0700, Yudong Gao wrote:
> >> Thanks for the reply, Andy!
> >>
> >> So the write delegation can only reduce the unnecessary open/close and
> >> lock/locku. But if a client modify the same page for multiple times,
> >> e.g. editing the file in a editor, is there any optimization to
> >> prevent the client from sending the half-updated pages? Ideally only
> >> the final update need to be put on the wire.
> >>
> >
> > Yes. However that optimisation is not linked to whether or not we hold a
> > write delegation. The NFS client assumes close-to-open cache
> > consistency, and so will cache writes until either the VM tries to
> > reclaim memory by writing out dirty page, or the application calls one
> > of fcntl(F_UNLCK), fsync() or close().
> >
> > Trond
> >
> >> Thanks!
> >>
> >> best,
> >>
> >> Yudong
> >>
> >> On Wed, Aug 4, 2010 at 1:59 PM, Andy Adamson <andros@netapp.com> wrote:
> >> >
> >> > On Aug 4, 2010, at 3:21 PM, Yudong Gao wrote:
> >> >
> >> >> Hi,
> >> >>
> >> >> I am not able to find the implementation of directory delegation,
> >> >> either. Similarly, the callback functions CB_NOTIFY is not
> >> >> implemented, either. I find that in preprocss_nfs41_op() in
> >> >> callback_xdr.c, whenever a CB_NOTIFY is encountered, an
> >> >> NFS4ERR_NOTSUPP is returned directly.
> >> >
> >> > CB_NOTIFY is not currently supported on the Linux NFS client.
> >> >
> >> >>
> >> >> Am I missing something? Or they are just not supported in the current version?
> >> >>
> >> >> Thanks a lot!
> >> >>
> >> >> best,
> >> >>
> >> >> Yudong
> >> >>
> >> >> On Mon, Aug 2, 2010 at 5:17 PM, Yudong Gao <stgyd@umich.edu> wrote:
> >> >>> Hi,
> >> >>>
> >> >>> I am looking at the delegation implementation in the source code of
> >> >>> NFS 4.1 in kernel 2.6.32.15. I can find the code for read delegation,
> >> >>> which is working and can serve the read requests locally. But I can
> >> >>> never find the code about write delegation, which is supposed to cache
> >> >>> the write update locally. I try to look at the functions including
> >> >>> nfs_writepage(s), nfs_file_flush() but none of them checks or uses the
> >> >>> write delegation.
> >> >>>
> >> >>> Is write delegation currently implemented in NFS 4.1?
> >> >
> >> > Write delegation is supported but I don't think write behavior changes - writes are still cached and flushed as without a write delegation. The write delegation does prevent open/close and lock/locku from being put on the wire.
> >> >
> >> > -->Andy
> >> >
> >> >>>
> >> >>> Thanks!
> >> >>>
> >> >>> best,
> >> >>>
> >> >>> Yudong
> >> >>>
> >> >> --
> >> >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> >> >> the body of a message to majordomo@vger.kernel.org
> >> >> 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 majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >
> >
> >




^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-05  0:52             ` Trond Myklebust
@ 2010-08-05  1:22               ` Yudong Gao
       [not found]                 ` <AANLkTinq-q5f5QjCBiXuZMJY6dHajpDPZ7aO55ipNZcE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Yudong Gao @ 2010-08-05  1:22 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Andy Adamson, linux-nfs

On Wed, Aug 4, 2010 at 5:52 PM, Trond Myklebust
<trond.myklebust@fys.uio.no> wrote:
> On Wed, 2010-08-04 at 14:40 -0700, Yudong Gao wrote:
>> I see. But according to the spec, the write delegation is supposed to
>> break the close-to-open consistency so that the client can avoid
>> flushing dirty page to server when closing the file. Is this part
>> implemented? I can not find it in the source code...
>
> No. We didn't do that. The main reason for continuing to flush the
> writes on close is to avoid slow delegation recalls.
>
This makes sense! Thanks for clarifying!

>> Another question is how the nfs file write interacts with fscache? I
>> was not able to find the code that update the page copy in fscache
>> when the page in memory is modified.
>
> AFAIK fscache is read-only at this point. I think David has plans to
> make it read/write, but I don't know whether he will ever do so for NFS.
>

I think fscache itself support writing. We can find the
fscache_write_page() definition in both the api document and the
source code. I check the source code and it seems fully implemented.

But for the integration with NFS, it is confusing. The
fscache_write_page() is called only in one place:
nfs_readpage_release(). So a NFS page is only written to fscache after
it is read from the server in nfs_readpage. So my question is, if a
page is locally modified, when its data is propagated to fscache? I
check the nfs_write_begin() and nfs_write_end() but cannot find any
relative implementation.

Thanks!

best,

Yudong

> Trond
>
>> Thanks a lot!
>>
>> best,
>>
>> Yudong
>>
>> On Wed, Aug 4, 2010 at 2:22 PM, Trond Myklebust
>> <trond.myklebust@fys.uio.no> wrote:
>> > On Wed, 2010-08-04 at 14:11 -0700, Yudong Gao wrote:
>> >> Thanks for the reply, Andy!
>> >>
>> >> So the write delegation can only reduce the unnecessary open/close and
>> >> lock/locku. But if a client modify the same page for multiple times,
>> >> e.g. editing the file in a editor, is there any optimization to
>> >> prevent the client from sending the half-updated pages? Ideally only
>> >> the final update need to be put on the wire.
>> >>
>> >
>> > Yes. However that optimisation is not linked to whether or not we hold a
>> > write delegation. The NFS client assumes close-to-open cache
>> > consistency, and so will cache writes until either the VM tries to
>> > reclaim memory by writing out dirty page, or the application calls one
>> > of fcntl(F_UNLCK), fsync() or close().
>> >
>> > Trond
>> >
>> >> Thanks!
>> >>
>> >> best,
>> >>
>> >> Yudong
>> >>
>> >> On Wed, Aug 4, 2010 at 1:59 PM, Andy Adamson <andros@netapp.com> wrote:
>> >> >
>> >> > On Aug 4, 2010, at 3:21 PM, Yudong Gao wrote:
>> >> >
>> >> >> Hi,
>> >> >>
>> >> >> I am not able to find the implementation of directory delegation,
>> >> >> either. Similarly, the callback functions CB_NOTIFY is not
>> >> >> implemented, either. I find that in preprocss_nfs41_op() in
>> >> >> callback_xdr.c, whenever a CB_NOTIFY is encountered, an
>> >> >> NFS4ERR_NOTSUPP is returned directly.
>> >> >
>> >> > CB_NOTIFY is not currently supported on the Linux NFS client.
>> >> >
>> >> >>
>> >> >> Am I missing something? Or they are just not supported in the current version?
>> >> >>
>> >> >> Thanks a lot!
>> >> >>
>> >> >> best,
>> >> >>
>> >> >> Yudong
>> >> >>
>> >> >> On Mon, Aug 2, 2010 at 5:17 PM, Yudong Gao <stgyd@umich.edu> wrote:
>> >> >>> Hi,
>> >> >>>
>> >> >>> I am looking at the delegation implementation in the source code of
>> >> >>> NFS 4.1 in kernel 2.6.32.15. I can find the code for read delegation,
>> >> >>> which is working and can serve the read requests locally. But I can
>> >> >>> never find the code about write delegation, which is supposed to cache
>> >> >>> the write update locally. I try to look at the functions including
>> >> >>> nfs_writepage(s), nfs_file_flush() but none of them checks or uses the
>> >> >>> write delegation.
>> >> >>>
>> >> >>> Is write delegation currently implemented in NFS 4.1?
>> >> >
>> >> > Write delegation is supported but I don't think write behavior changes - writes are still cached and flushed as without a write delegation. The write delegation does prevent open/close and lock/locku from being put on the wire.
>> >> >
>> >> > -->Andy
>> >> >
>> >> >>>
>> >> >>> Thanks!
>> >> >>>
>> >> >>> best,
>> >> >>>
>> >> >>> Yudong
>> >> >>>
>> >> >> --
>> >> >> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>> >> >> the body of a message to majordomo@vger.kernel.org
>> >> >> 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 majordomo@vger.kernel.org
>> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> >
>> >
>> >
>> >
>
>
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
       [not found]                 ` <AANLkTinq-q5f5QjCBiXuZMJY6dHajpDPZ7aO55ipNZcE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2010-08-05  1:25                   ` Trond Myklebust
  2010-08-05 18:10                     ` Yudong Gao
  0 siblings, 1 reply; 16+ messages in thread
From: Trond Myklebust @ 2010-08-05  1:25 UTC (permalink / raw)
  To: Yudong Gao; +Cc: Andy Adamson, linux-nfs

On Wed, 2010-08-04 at 18:22 -0700, Yudong Gao wrote:

> But for the integration with NFS, it is confusing. The
> fscache_write_page() is called only in one place:
> nfs_readpage_release(). So a NFS page is only written to fscache after
> it is read from the server in nfs_readpage. So my question is, if a
> page is locally modified, when its data is propagated to fscache? I
> check the nfs_write_begin() and nfs_write_end() but cannot find any
> relative implementation.

See my previous answer. fscache only supports read-only files in NFS.

Trond


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-05  1:25                   ` Trond Myklebust
@ 2010-08-05 18:10                     ` Yudong Gao
  2010-08-05 20:13                       ` Yudong Gao
  0 siblings, 1 reply; 16+ messages in thread
From: Yudong Gao @ 2010-08-05 18:10 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Andy Adamson, linux-nfs

I see. I was kind of confused before. Sorry about that.

I am trying to figure out how this read-only is supported in the
source code. When a page is read from the network through
nfs_readpage(), it will be cached to fscache, as implemented in
nfs_readpage_release(). The code in nfs_readpage_release() only checks
whether fscache is available, and if so, the page will be cached to
fscache.

If a page is modified locally in memory (the page cache), then it
becomes dirty. But since the fscache is read-only, the copy of the
page in fscache becomes stale. When the file is close, the dirty page
will be written back to the server. Later when it is not used for a
while, it will be removed from the page cache. Here I suppose the copy
in fscache will not be deleted, or fscache becomes useless: it can
only mirror the pages in the page cache and does not provide extra
cache. And actually in the source code, I can not find the code to
uncache the page in fscache().

So far so good. But if later this page is read again, the behavior
becomes strange. The nfs_readpage() checks first try to read the page
from fscache. In this case, it will read the stale page and oops!

I think the problem here is that when a page become dirty in page
cache, it should be removed from fscache. So my question is where is
this implemented?

Thanks a lot!

best,

Yudong

On Wed, Aug 4, 2010 at 6:25 PM, Trond Myklebust
<trond.myklebust@fys.uio.no> wrote:
> On Wed, 2010-08-04 at 18:22 -0700, Yudong Gao wrote:
>
>> But for the integration with NFS, it is confusing. The
>> fscache_write_page() is called only in one place:
>> nfs_readpage_release(). So a NFS page is only written to fscache after
>> it is read from the server in nfs_readpage. So my question is, if a
>> page is locally modified, when its data is propagated to fscache? I
>> check the nfs_write_begin() and nfs_write_end() but cannot find any
>> relative implementation.
>
> See my previous answer. fscache only supports read-only files in NFS.
>
> Trond
>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write delegation
  2010-08-05 18:10                     ` Yudong Gao
@ 2010-08-05 20:13                       ` Yudong Gao
  2010-08-05 20:38                         ` fscache Gilliam, PaulX J
  0 siblings, 1 reply; 16+ messages in thread
From: Yudong Gao @ 2010-08-05 20:13 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Andy Adamson, linux-nfs

Hi Trond,

I just find the function nfs_fscache_set_inode_cookie() that checks
the access flag and allows only read-only files to use the cache.

Thanks!

best,

Yudong

On Thu, Aug 5, 2010 at 11:10 AM, Yudong Gao <stgyd@umich.edu> wrote:
> I see. I was kind of confused before. Sorry about that.
>
> I am trying to figure out how this read-only is supported in the
> source code. When a page is read from the network through
> nfs_readpage(), it will be cached to fscache, as implemented in
> nfs_readpage_release(). The code in nfs_readpage_release() only checks
> whether fscache is available, and if so, the page will be cached to
> fscache.
>
> If a page is modified locally in memory (the page cache), then it
> becomes dirty. But since the fscache is read-only, the copy of the
> page in fscache becomes stale. When the file is close, the dirty page
> will be written back to the server. Later when it is not used for a
> while, it will be removed from the page cache. Here I suppose the copy
> in fscache will not be deleted, or fscache becomes useless: it can
> only mirror the pages in the page cache and does not provide extra
> cache. And actually in the source code, I can not find the code to
> uncache the page in fscache().
>
> So far so good. But if later this page is read again, the behavior
> becomes strange. The nfs_readpage() checks first try to read the page
> from fscache. In this case, it will read the stale page and oops!
>
> I think the problem here is that when a page become dirty in page
> cache, it should be removed from fscache. So my question is where is
> this implemented?
>
> Thanks a lot!
>
> best,
>
> Yudong
>
> On Wed, Aug 4, 2010 at 6:25 PM, Trond Myklebust
> <trond.myklebust@fys.uio.no> wrote:
>> On Wed, 2010-08-04 at 18:22 -0700, Yudong Gao wrote:
>>
>>> But for the integration with NFS, it is confusing. The
>>> fscache_write_page() is called only in one place:
>>> nfs_readpage_release(). So a NFS page is only written to fscache after
>>> it is read from the server in nfs_readpage. So my question is, if a
>>> page is locally modified, when its data is propagated to fscache? I
>>> check the nfs_write_begin() and nfs_write_end() but cannot find any
>>> relative implementation.
>>
>> See my previous answer. fscache only supports read-only files in NFS.
>>
>> Trond
>>
>>
>

^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: fscache.
  2010-08-05 20:13                       ` Yudong Gao
@ 2010-08-05 20:38                         ` Gilliam, PaulX J
  0 siblings, 0 replies; 16+ messages in thread
From: Gilliam, PaulX J @ 2010-08-05 20:38 UTC (permalink / raw)
  To: Yudong Gao; +Cc: linux-cachefs@redhat.com, linux-nfs@vger.kernel.org

Yudong,

There is a email list just for fscache, cachefiles and cachefs:
	linux-cachefs@redhat.com
It gets a lot less traffic than linux-nfs@vger.kernel.org and I don't know if one can find the same level of expertise monitoring it, I have seen David Howells there.  He is the author of fcache, cachefiles and cachefs.

-=# Paul Gilliam #=-


>-----Original Message-----
>From: linux-nfs-owner@vger.kernel.org [mailto:linux-nfs-
>owner@vger.kernel.org] On Behalf Of Yudong Gao
>Sent: Thursday, August 05, 2010 1:14 PM
>To: Trond Myklebust
>Cc: Andy Adamson; linux-nfs@vger.kernel.org
>Subject: Re: Write delegation
>
>Hi Trond,
>
>I just find the function nfs_fscache_set_inode_cookie() that checks
>the access flag and allows only read-only files to use the cache.
>
>Thanks!
>
>best,
>
>Yudong
>
>On Thu, Aug 5, 2010 at 11:10 AM, Yudong Gao <stgyd@umich.edu> wrote:
>> I see. I was kind of confused before. Sorry about that.
>>
>> I am trying to figure out how this read-only is supported in the
>> source code. When a page is read from the network through
>> nfs_readpage(), it will be cached to fscache, as implemented in
>> nfs_readpage_release(). The code in nfs_readpage_release() only checks
>> whether fscache is available, and if so, the page will be cached to
>> fscache.
>>
>> If a page is modified locally in memory (the page cache), then it
>> becomes dirty. But since the fscache is read-only, the copy of the
>> page in fscache becomes stale. When the file is close, the dirty page
>> will be written back to the server. Later when it is not used for a
>> while, it will be removed from the page cache. Here I suppose the copy
>> in fscache will not be deleted, or fscache becomes useless: it can
>> only mirror the pages in the page cache and does not provide extra
>> cache. And actually in the source code, I can not find the code to
>> uncache the page in fscache().
>>
>> So far so good. But if later this page is read again, the behavior
>> becomes strange. The nfs_readpage() checks first try to read the page
>> from fscache. In this case, it will read the stale page and oops!
>>
>> I think the problem here is that when a page become dirty in page
>> cache, it should be removed from fscache. So my question is where is
>> this implemented?
>>
>> Thanks a lot!
>>
>> best,
>>
>> Yudong
>>
>> On Wed, Aug 4, 2010 at 6:25 PM, Trond Myklebust
>> <trond.myklebust@fys.uio.no> wrote:
>>> On Wed, 2010-08-04 at 18:22 -0700, Yudong Gao wrote:
>>>
>>>> But for the integration with NFS, it is confusing. The
>>>> fscache_write_page() is called only in one place:
>>>> nfs_readpage_release(). So a NFS page is only written to fscache after
>>>> it is read from the server in nfs_readpage. So my question is, if a
>>>> page is locally modified, when its data is propagated to fscache? I
>>>> check the nfs_write_begin() and nfs_write_end() but cannot find any
>>>> relative implementation.
>>>
>>> See my previous answer. fscache only supports read-only files in NFS.
>>>
>>> Trond
>>>
>>>
>>
>--
>To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Write Delegation
@ 2019-07-23 21:21 Diyu Zhou
  2019-07-24 12:03 ` Benjamin Coddington
  0 siblings, 1 reply; 16+ messages in thread
From: Diyu Zhou @ 2019-07-23 21:21 UTC (permalink / raw)
  To: linux-nfs

Hey,

I just started studying the Linux NFS code and I found the comments on file
/fs/nfsd/nfs4state.c right above function nfs4_open_delegation, saying: "
Attempt to hand out a delegation. Note we don't support write delegations, and
won't until the vfs has proper support for them."

Does that mean the current implementation of nfs4 in Linux does not support
write delegation?

Thank you all for your effort in building the NFS for Linux and thanks in
advance for your help.

Best,
Diyu

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: Write Delegation
  2019-07-23 21:21 Write Delegation Diyu Zhou
@ 2019-07-24 12:03 ` Benjamin Coddington
  0 siblings, 0 replies; 16+ messages in thread
From: Benjamin Coddington @ 2019-07-24 12:03 UTC (permalink / raw)
  To: Diyu Zhou; +Cc: linux-nfs

On 23 Jul 2019, at 17:21, Diyu Zhou wrote:

> Hey,
>
> I just started studying the Linux NFS code and I found the comments on 
> file
> /fs/nfsd/nfs4state.c right above function nfs4_open_delegation, 
> saying: "
> Attempt to hand out a delegation. Note we don't support write 
> delegations, and
> won't until the vfs has proper support for them."
>
> Does that mean the current implementation of nfs4 in Linux does not 
> support
> write delegation?

Hi Diyu,

The linux NFS server does not give out write delegations yet, but the 
linux
NFS client is capable of using them.

Ben

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-07-24 12:03 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-03  0:17 Write delegation Yudong Gao
     [not found] ` <AANLkTi=2KYZ-8qaXMG=C_s617q3k1Ocs7h1gyd8=RpY6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-04 19:21   ` Yudong Gao
2010-08-04 20:59     ` Andy Adamson
2010-08-04 21:11       ` Yudong Gao
2010-08-04 21:22         ` Trond Myklebust
2010-08-04 21:40           ` Yudong Gao
2010-08-05  0:52             ` Trond Myklebust
2010-08-05  1:22               ` Yudong Gao
     [not found]                 ` <AANLkTinq-q5f5QjCBiXuZMJY6dHajpDPZ7aO55ipNZcE-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-08-05  1:25                   ` Trond Myklebust
2010-08-05 18:10                     ` Yudong Gao
2010-08-05 20:13                       ` Yudong Gao
2010-08-05 20:38                         ` fscache Gilliam, PaulX J
2010-08-04 21:09     ` Write delegation Trond Myklebust
2010-08-04 21:20       ` Yudong Gao
  -- strict thread matches above, loose matches on Subject: below --
2019-07-23 21:21 Write Delegation Diyu Zhou
2019-07-24 12:03 ` Benjamin Coddington

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).