All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donald Buczek <buczek@molgen.mpg.de>
To: linux-nfs@vger.kernel.org
Subject: open after unlink tries to open old file
Date: Fri, 10 Mar 2017 14:55:09 +0100	[thread overview]
Message-ID: <ae2f9a9e-65b0-9fe5-a148-4ec698df91d0@molgen.mpg.de> (raw)

I see this code

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

     #define FILENAME "test.dat"

     int main() {
         int i;
         int fd;
         unlink(FILENAME);
         for  (i=0;i<1000;i++) {
             printf("%d\n",i);
             if ((fd=open(FILENAME,O_WRONLY+O_CREAT,0))==-1) {
                 perror("open");
                 exit(1);
             }
             if (close(fd)==-1) {
                 perror("close");
                 exit(1);
             }
             if (unlink(FILENAME)==-1) {
                 perror("unlink");
                 exit(1);
             }
         }
     }

failing most of the time in NFS-mounted directories:

     buczek@theinternet:~$ uname -a
     Linux theinternet.molgen.mpg.de 4.4.52.mx64.142 #1 SMP Fri Mar 3 
21:25:00 CET 2017 x86_64 GNU/Linux
     buczek@theinternet:~$ nfs_test

     0
     1
     2
     3
     4
     open: Permission denied
     buczek@theinternet:~$

but I fail to find an answer to the question, whether this is supposed 
to work or not. Is this a bug or a caching feature?

Thanks
   Donald

-- 
Donald Buczek
buczek@molgen.mpg.de
Tel: +49 30 8413 1433






             reply	other threads:[~2017-03-10 14:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-10 13:55 Donald Buczek [this message]
2017-03-24 15:22 ` open after unlink tries to open old file Donald Buczek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ae2f9a9e-65b0-9fe5-a148-4ec698df91d0@molgen.mpg.de \
    --to=buczek@molgen.mpg.de \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.