public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* NFSv3 client reordering RENAMEs
@ 2006-06-15 13:38 Janne Karhunen
  2006-06-15 13:44 ` Peter Staubach
  0 siblings, 1 reply; 6+ messages in thread
From: Janne Karhunen @ 2006-06-15 13:38 UTC (permalink / raw)
  To: linux-kernel

G'd day,

Looks like that given async NFS mount Linux NFS client can reorder
RENAMEs as well. For me this caused several eaten files :/. Didn't
really expect RENAME to be reordered as mv is generally considered
atomic. That, and RFC 1813 mandates RENAME to be atomic. Is this a
known thing and do you guys consider this feature or a bug?


-- 
// Janne

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

* Re: NFSv3 client reordering RENAMEs
  2006-06-15 13:38 NFSv3 client reordering RENAMEs Janne Karhunen
@ 2006-06-15 13:44 ` Peter Staubach
  2006-06-15 14:54   ` Janne Karhunen
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Staubach @ 2006-06-15 13:44 UTC (permalink / raw)
  To: Janne Karhunen; +Cc: linux-kernel

Janne Karhunen wrote:

>G'd day,
>
>Looks like that given async NFS mount Linux NFS client can reorder
>RENAMEs as well. For me this caused several eaten files :/. Didn't
>really expect RENAME to be reordered as mv is generally considered
>atomic. That, and RFC 1813 mandates RENAME to be atomic. Is this a
>known thing and do you guys consider this feature or a bug?
>

Can you construct a testcase which exhibits this behavior?

    Thanx...

       ps

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

* Re: NFSv3 client reordering RENAMEs
  2006-06-15 13:44 ` Peter Staubach
@ 2006-06-15 14:54   ` Janne Karhunen
  2006-06-15 16:05     ` Peter Staubach
  0 siblings, 1 reply; 6+ messages in thread
From: Janne Karhunen @ 2006-06-15 14:54 UTC (permalink / raw)
  To: linux-kernel

On Thursday 15 June 2006 16:44, Peter Staubach wrote:

> >really expect RENAME to be reordered as mv is generally considered
> >atomic. That, and RFC 1813 mandates RENAME to be atomic. Is this a
> >known thing and do you guys consider this feature or a bug?
>
> Can you construct a testcase which exhibits this behavior?

Possibly .. if someone first acks that this indeed would be
considered as bug and not as a feature :/ 


-- 
// Janne

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

* Re: NFSv3 client reordering RENAMEs
  2006-06-15 14:54   ` Janne Karhunen
@ 2006-06-15 16:05     ` Peter Staubach
  2006-06-16  6:25       ` Janne Karhunen
  0 siblings, 1 reply; 6+ messages in thread
From: Peter Staubach @ 2006-06-15 16:05 UTC (permalink / raw)
  To: Janne Karhunen; +Cc: linux-kernel

Janne Karhunen wrote:

>On Thursday 15 June 2006 16:44, Peter Staubach wrote:
>
>  
>
>>>really expect RENAME to be reordered as mv is generally considered
>>>atomic. That, and RFC 1813 mandates RENAME to be atomic. Is this a
>>>known thing and do you guys consider this feature or a bug?
>>>      
>>>
>>Can you construct a testcase which exhibits this behavior?
>>    
>>
>
>Possibly .. if someone first acks that this indeed would be
>considered as bug and not as a feature :/ 
>

Yes, I believe that this would be considered to be a bug...

       ps

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

* Re: NFSv3 client reordering RENAMEs
  2006-06-15 16:05     ` Peter Staubach
@ 2006-06-16  6:25       ` Janne Karhunen
  2006-06-16 13:45         ` Peter Staubach
  0 siblings, 1 reply; 6+ messages in thread
From: Janne Karhunen @ 2006-06-16  6:25 UTC (permalink / raw)
  To: Peter Staubach; +Cc: linux-kernel

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

On Thursday 15 June 2006 19:05, Peter Staubach wrote:

> >Possibly .. if someone first acks that this indeed would be
> >considered as bug and not as a feature :/
>
> Yes, I believe that this would be considered to be a bug...

Looks that this is a vendor kernel issue, couldn't get it to
barf on mainline. Without any more knowledge of the extent 
of the problem testcase attached. Given that you suffer from
the problem you should occasionally see files vanishing.


-- 
// Janne

[-- Attachment #2: test.c --]
[-- Type: text/x-csrc, Size: 1652 bytes --]

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include <pthread.h>
#include <stdlib.h>

#ifndef ROTATION_CYCLE
#define ROTATION_CYCLE 60
#endif

char*     str = "Quick brown fox jumped over lazy dog %d\n";
char      buf[50] = { 0 };
int       rl=1;
int       rr=1;
pthread_t thr[2];

void* logger_thread ( void* ptr ) {
  int i=0, r, fd;

  fd = open ( "/mnt/nfs/file", O_RDWR|O_CREAT, 00600 );
  printf ( "logger starting, fd %d\n", fd );

  if ( fd <= 0 ) {
    printf ("%s\n", strerror(errno));
    return NULL;
  }
  while ( rl ) {
    r = sprintf ( &buf[0], str, i );
    r = write ( fd, &buf[0], strlen(&buf[0]) );
    if ( r <= 0 ) {
      printf ("\n\n%s\n", strerror(errno));
      goto exit;
    }
    i++;
    usleep ( 10000 );
  }
exit:
  printf ("logger exiting\n");
  close (fd);
  return NULL;
}

void* logrotate_thread ( void* ptr ) {
  int r;

  printf ( "rotater starting\n" );
  while ( rr ) {
    sleep(ROTATION_CYCLE);

    r = system ( "mv /mnt/nfs/file.4 /mnt/nfs/file.5" );
    r = system ( "mv /mnt/nfs/file.3 /mnt/nfs/file.4" );
    r = system ( "mv /mnt/nfs/file.2 /mnt/nfs/file.3" );
    r = system ( "mv /mnt/nfs/file.1 /mnt/nfs/file.2" );
    r = system ( "mv /mnt/nfs/file /mnt/nfs/file.1" );
    rl=0;
    sleep(2);
    rl=1;
    pthread_create ( &thr[1], 0, logger_thread, 0 );
  }
  printf ( "rotater exiting\n" );
  return NULL;
}

int main ( int a, char** b ) {
  pthread_create ( &thr[0], 0, logrotate_thread, 0 );
  pthread_create ( &thr[0], 0, logger_thread, 0 );

  while ( 1 )
    usleep ( 100000 );
  return 0;
}


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

* Re: NFSv3 client reordering RENAMEs
  2006-06-16  6:25       ` Janne Karhunen
@ 2006-06-16 13:45         ` Peter Staubach
  0 siblings, 0 replies; 6+ messages in thread
From: Peter Staubach @ 2006-06-16 13:45 UTC (permalink / raw)
  To: Janne Karhunen; +Cc: linux-kernel

Janne Karhunen wrote:

>On Thursday 15 June 2006 19:05, Peter Staubach wrote:
>
>  
>
>>>Possibly .. if someone first acks that this indeed would be
>>>considered as bug and not as a feature :/
>>>      
>>>
>>Yes, I believe that this would be considered to be a bug...
>>    
>>
>
>Looks that this is a vendor kernel issue, couldn't get it to
>barf on mainline. Without any more knowledge of the extent 
>of the problem testcase attached. Given that you suffer from
>the problem you should occasionally see files vanishing.
>

Although this is a little timing dependent, it mostly should work.  How
long does it need to run before failures will be seen?  I have been running
it for about half an hour and it seems to be operating as I expected.


I would suggest reporting this issue to your vendor and see what they
have to say.

    Thanx...

       ps

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

end of thread, other threads:[~2006-06-16 13:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-15 13:38 NFSv3 client reordering RENAMEs Janne Karhunen
2006-06-15 13:44 ` Peter Staubach
2006-06-15 14:54   ` Janne Karhunen
2006-06-15 16:05     ` Peter Staubach
2006-06-16  6:25       ` Janne Karhunen
2006-06-16 13:45         ` Peter Staubach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox