2003-11-17 00:45:42

by J.A. Magallon

[permalink] [raw]
Subject: Reading libs fails through NFS

Hi all...

Anybody has any idea about why this fails:

fd = open("/lib/libnss_files.so.2", O_RDONLY);
res = read(fd,buf,512);

/lib is NFS mounted:

192.168.0.1:/lib on /lib type nfs (ro,noatime,nfsvers=3,nolock,addr=192.168.0.1)

and the read fails.
The original code does a getprotobyname("tcp") (netpipe), that fails when it
tries to read the same lib.

The node boots via PXE, with a version of libnss_files.so.2 on the /lib present
in the initrd, which is replaced by the mounted one.

TIA

--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
Mandrake Linux release 10.0 (Cooker) for i586
Linux 2.4.23-rc1-jam2 (gcc 3.3.1 (Mandrake Linux 9.2 3.3.1-4mdk))


2003-11-17 01:24:24

by Trond Myklebust

[permalink] [raw]
Subject: Re: Reading libs fails through NFS

>>>>> " " == J A Magallon <J.A.> writes:

> Hi all... Anybody has any idea about why this fails:

> fd = open("/lib/libnss_files.so.2", O_RDONLY); res =
> read(fd,buf,512);

No. Nobody else will be able to tell you either until you tell us what
setup you are using.

Cheers,
Trond

2003-11-17 01:29:22

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: Reading libs fails through NFS

On Mon, 17 Nov 2003 01:45:39 +0100, "J.A. Magallon" said:

> fd = open("/lib/libnss_files.so.2", O_RDONLY);

> The node boots via PXE, with a version of libnss_files.so.2 on the /lib present
> in the initrd, which is replaced by the mounted one.

Just a shot in the dark, but could there be a bug in the NFS code where it's
getting upset that there's cached pages of the file in memory, but the file
that the cached page is from isn't from the file that NFS can see? (note that
this is possibly *different* than a stale NFS handle when a file is unlinked
and then recreated - here chasing the origin of the page doesn't point at
the NFS mount, but at the initrd mount.

Yes, when you mount over a directory, the previous contents are supposed to
become invisible. I wonder if there's a bug with that if a file is read and
pages cached 'sufficiently early' in the boot process (i.e. before the
real root gets mounted over the initrd root..)


Attachments:
(No filename) (226.00 B)