Operating System - HP-UX
1827279 Members
2593 Online
109717 Solutions
New Discussion

Open file with O_EXCL parameter on NFS

 

Open file with O_EXCL parameter on NFS

Hi

While trying to figure out while Oracle 10g fails to create a data file on a NFS share, I used tusc and found that creates a file by calling:
open("nfsFile.dat", O_RDWR|O_CREAT|O_EXCL|0x800|O_SYNC, 0660);

Next, it closed the file and the second call to open the file: open(nfsFile.dat, O_RDONLY|0x800, 011655) - failed.

I wrote a small program, and found that the source of the problem is the O_EXCL flag.
When used, the file is created with the wrong Group ID - and as a result, the second attempt to open the file fails.

The NFS client is HP-UX 11.23 - IA 64 and the NFS Server is Solaris 10.

Has anyone any idea how to overcome this issue?

Thanks!

Shay
1 REPLY 1
kobylka
Valued Contributor

Re: Open file with O_EXCL parameter on NFS

Hello Shay!

The flag O_EXCL is normally used together with O_CREAT to check for exclusiveness during file creation (see man open).

As for the problem with the wrong group id the answer could lie in the way the NFS share was mounted on the client. Take a look at the two possible semantics for group ids when files are created (your case):


man mount_nfs (grpid option)

If grpid is set on mount (BSD-semantics), you need to change the GID of the parent directory because this will be the GID of the new file created.

If grpid is NOT set (SYSV-semantics), check for the parent directory not being set-GID, and if so, change it to the GID you need since that will be the GID of the new file created.

Kind regards,

Kobylka