[Lustre-discuss] inconsistent client behavior when creating an empty directory
Kevin Van Maren
kevin.van.maren at oracle.com
Tue Aug 9 09:14:03 PDT 2011
This appears to be the same issue as
https://bugzilla.lustre.org/show_bug.cgi?id=23459
Kevin
Andrej Filipcic wrote:
> Hi,
>
> the following code does not work as expected:
> ---------
> #include <sys/stat.h>
> #include <errno.h>
> #include <stdio.h>
>
> int main(int argc, char** argv) {
>
> int rc;
> rc=mkdir(argv[1],S_IRWXU);
> if(rc) perror("failed create dir");
> chown(argv[1],4103,4100);
>
> struct stat buf;
> /* stat(argv[1],&buf); */
>
> setresuid(0,4103,4100);
> rc=mkdir(argv[1],S_IRWXU);
> if(rc) perror("failed create dir as user");
> }
> ---------
>
> initial status:
>
> # ls -ld /lustre/test
> drwxr-xr-x 2 root root 4096 Aug 9 14:59 /lustre/test
> # ls -l /lustre/test
> total 0
>
> 1) running the test program:
>
> # /tmp/test /lustre/test/testdir
> failed create dir as user: Permission denied
> # ls -l /lustre/test
> total 4
> drwx------ 2 griduser03 grid 4096 Aug 9 15:02 testdir
>
> griduser03, grid correspond to uid=4103,gid=4100
>
>
> 2) running the test program, but with uncommented stat call:
> # /tmp/test /lustre/test/testdir
> failed create dir as user: File exists
> # ls -l /lustre/test
> total 4
> drwx------ 2 griduser03 grid 4096 Aug 9 15:04 testdir
>
>
> The code first makes the testdir as root and changes the ownership to uid 4103.
> Then it tries to (re)create the same dir with the user privileges.
>
> If "stat" is called, the code behaves as expected (case 2), but if not (case
> 1), the second mkdir should return EEXIST and not EACCES. Is this behavior
> expected or is it a client bug? The client runs lustre 1.8.6.
>
> The code just illustrates, what is actually used in a complex software.
>
> Andrej
>
>
More information about the lustre-discuss
mailing list