linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is UNSTABLE ever sent in client writes?
@ 2015-10-01 16:55 Constantine Peresypkin
  2015-10-01 17:32 ` Benjamin Coddington
  0 siblings, 1 reply; 5+ messages in thread
From: Constantine Peresypkin @ 2015-10-01 16:55 UTC (permalink / raw)
  To: linux-nfs

Tried with various mount options (sync, async)
Looked into source code.
It seems like it will never be sent, client always assumes server can
do FILE_SYNC, and server cannot respond with anything else, if
implemented correctly.
But what we can do if the server is inherently unable to do FILE_SYNC
(eventual consistency, write reorder, etc.)?

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

* Re: Is UNSTABLE ever sent in client writes?
  2015-10-01 16:55 Is UNSTABLE ever sent in client writes? Constantine Peresypkin
@ 2015-10-01 17:32 ` Benjamin Coddington
  2015-10-01 17:37   ` Constantine Peresypkin
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Coddington @ 2015-10-01 17:32 UTC (permalink / raw)
  To: Constantine Peresypkin; +Cc: linux-nfs

On Thu, 1 Oct 2015, Constantine Peresypkin wrote:

> Tried with various mount options (sync, async)
> Looked into source code.
> It seems like it will never be sent, client always assumes server can
> do FILE_SYNC, and server cannot respond with anything else, if
> implemented correctly.
> But what we can do if the server is inherently unable to do FILE_SYNC
> (eventual consistency, write reorder, etc.)?

Hi Constantine, my linux client does unstable writes all the time.
nfs_pgio_rpcsetup() default stable arg is NFS_UNSTABLE..

Try doing a write larger than your mount's wsize parameter.

Ben

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

* Re: Is UNSTABLE ever sent in client writes?
  2015-10-01 17:32 ` Benjamin Coddington
@ 2015-10-01 17:37   ` Constantine Peresypkin
  2015-10-01 17:55     ` Benjamin Coddington
  0 siblings, 1 reply; 5+ messages in thread
From: Constantine Peresypkin @ 2015-10-01 17:37 UTC (permalink / raw)
  To: Benjamin Coddington; +Cc: linux-nfs

[-- Attachment #1: Type: text/plain, Size: 822 bytes --]

The question is: can I force it to always use unstable? Or how can I debug
why FILE_SYNC is always sent in my case?
On Oct 1, 2015 12:32 PM, "Benjamin Coddington" <bcodding@redhat.com> wrote:

> On Thu, 1 Oct 2015, Constantine Peresypkin wrote:
>
> > Tried with various mount options (sync, async)
> > Looked into source code.
> > It seems like it will never be sent, client always assumes server can
> > do FILE_SYNC, and server cannot respond with anything else, if
> > implemented correctly.
> > But what we can do if the server is inherently unable to do FILE_SYNC
> > (eventual consistency, write reorder, etc.)?
>
> Hi Constantine, my linux client does unstable writes all the time.
> nfs_pgio_rpcsetup() default stable arg is NFS_UNSTABLE..
>
> Try doing a write larger than your mount's wsize parameter.
>
> Ben
>

[-- Attachment #2: Type: text/html, Size: 1141 bytes --]

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

* Re: Is UNSTABLE ever sent in client writes?
  2015-10-01 17:37   ` Constantine Peresypkin
@ 2015-10-01 17:55     ` Benjamin Coddington
  2015-10-01 19:12       ` Constantine Peresypkin
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Coddington @ 2015-10-01 17:55 UTC (permalink / raw)
  To: Constantine Peresypkin; +Cc: linux-nfs

On Thu, 1 Oct 2015, Constantine Peresypkin wrote:

>
> The question is: can I force it to always use unstable? Or how can I debug why FILE_SYNC is always sent in my case?

No, I don't believe you can.  You can use systemtap, or turn up the nfs
debugging.

I don't think FILE_SYNC will always be sent.  It depends upon how you are
doing IO.  What are you using to test?

Try something like this on a mount with wsize=4096.  It should get you four
unstable writes, and eventually a COMMIT:

#define TPATH "/mnt/fedora/tmp/"
#define SIZE 4096*4
#define CHARS "I love when strings are 32 chars"

int main(void *argc) {
    int pos, filp_foo;
    void *foo_addr;

    unlink(TPATH "foo");
    filp_foo = open(TPATH "foo", O_RDWR|O_CREAT, S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH);
    ftruncate(filp_foo, SIZE);
    foo_addr = mmap(NULL, SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, filp_foo, 0);
    for (pos = 0; pos < SIZE; pos += strlen(CHARS))
        strcpy(foo_addr + pos, CHARS);
    close(filp_foo);
}

Ben


>
> On Oct 1, 2015 12:32 PM, "Benjamin Coddington" <bcodding@redhat.com> wrote:
>       On Thu, 1 Oct 2015, Constantine Peresypkin wrote:
>
>       > Tried with various mount options (sync, async)
>       > Looked into source code.
>       > It seems like it will never be sent, client always assumes server can
>       > do FILE_SYNC, and server cannot respond with anything else, if
>       > implemented correctly.
>       > But what we can do if the server is inherently unable to do FILE_SYNC
>       > (eventual consistency, write reorder, etc.)?
>
>       Hi Constantine, my linux client does unstable writes all the time.
>       nfs_pgio_rpcsetup() default stable arg is NFS_UNSTABLE..
>
>       Try doing a write larger than your mount's wsize parameter.
>
>       Ben
>
>
>

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

* Re: Is UNSTABLE ever sent in client writes?
  2015-10-01 17:55     ` Benjamin Coddington
@ 2015-10-01 19:12       ` Constantine Peresypkin
  0 siblings, 0 replies; 5+ messages in thread
From: Constantine Peresypkin @ 2015-10-01 19:12 UTC (permalink / raw)
  To: Benjamin Coddington; +Cc: linux-nfs

Doesn't help much.
As far as I can see from the code, there are only two places where
write_pageio_init() is called, and it's called either with
FLUSH_STABLE or FLUSH_COND_STABLE
Therefore I have no idea how exactly any unstable write will be submitted.

On Thu, Oct 1, 2015 at 12:55 PM, Benjamin Coddington
<bcodding@redhat.com> wrote:
> On Thu, 1 Oct 2015, Constantine Peresypkin wrote:
>
>>
>> The question is: can I force it to always use unstable? Or how can I debug why FILE_SYNC is always sent in my case?
>
> No, I don't believe you can.  You can use systemtap, or turn up the nfs
> debugging.
>
> I don't think FILE_SYNC will always be sent.  It depends upon how you are
> doing IO.  What are you using to test?
>
> Try something like this on a mount with wsize=4096.  It should get you four
> unstable writes, and eventually a COMMIT:
>
> #define TPATH "/mnt/fedora/tmp/"
> #define SIZE 4096*4
> #define CHARS "I love when strings are 32 chars"
>
> int main(void *argc) {
>     int pos, filp_foo;
>     void *foo_addr;
>
>     unlink(TPATH "foo");
>     filp_foo = open(TPATH "foo", O_RDWR|O_CREAT, S_IWUSR|S_IRUSR|S_IRGRP|S_IROTH);
>     ftruncate(filp_foo, SIZE);
>     foo_addr = mmap(NULL, SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, filp_foo, 0);
>     for (pos = 0; pos < SIZE; pos += strlen(CHARS))
>         strcpy(foo_addr + pos, CHARS);
>     close(filp_foo);
> }
>
> Ben
>
>
>>
>> On Oct 1, 2015 12:32 PM, "Benjamin Coddington" <bcodding@redhat.com> wrote:
>>       On Thu, 1 Oct 2015, Constantine Peresypkin wrote:
>>
>>       > Tried with various mount options (sync, async)
>>       > Looked into source code.
>>       > It seems like it will never be sent, client always assumes server can
>>       > do FILE_SYNC, and server cannot respond with anything else, if
>>       > implemented correctly.
>>       > But what we can do if the server is inherently unable to do FILE_SYNC
>>       > (eventual consistency, write reorder, etc.)?
>>
>>       Hi Constantine, my linux client does unstable writes all the time.
>>       nfs_pgio_rpcsetup() default stable arg is NFS_UNSTABLE..
>>
>>       Try doing a write larger than your mount's wsize parameter.
>>
>>       Ben
>>
>>
>>

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

end of thread, other threads:[~2015-10-01 19:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01 16:55 Is UNSTABLE ever sent in client writes? Constantine Peresypkin
2015-10-01 17:32 ` Benjamin Coddington
2015-10-01 17:37   ` Constantine Peresypkin
2015-10-01 17:55     ` Benjamin Coddington
2015-10-01 19:12       ` Constantine Peresypkin

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).