[OpenAFS] "textfile busy" reopening file

Sebastian Heidl heidl@zib.de
Tue, 19 Jun 2001 16:38:10 +0200


Hi,

I'm experiencing a strange error when a program creates a file,
closes it and tries to reopen it afterwards.
My tests are running on some SMP nodes with linux 2.2.17 and
OpenAFS 1.0.4. The user running the program has write (rlidwk)
permissions for the directory.

When I run a simple test program that does exactly the mentioned
steps (create file, write data to file, close, reopen file) the
call to reopen the file fails with errno 26 (textfile busy).

here's my test program:

#include <stdio.h>
#include <fcntl.h>
#include <error.h>
#include <errno.h>

int main() {

        FILE *file;
        char *filename = "test.file";

        file = fopen(filename, "w+");
        if( file == NULL ) {
                perror("error opening file for the first time: ");
                printf("(%i)\n", errno);
                exit(-1);
        }

        fprintf(file, "Teststring...\n");

        if( fclose(file) != 0 ) {
                perror("error closing file: ");
                exit(-1);
        }

        file = fopen(filename, "r+"); /* <-- this call fails */
        if( file == NULL ) {
                perror("error opening file: ");
                exit(-1);
        }
}

What am I doing wrong here ? Am I missing something trivial ?

_sh_

PS: Please cc your replies to me as I'm not subscribed to the list.

--