"Text file busy" when appending in 2.0.27

Thomas Koenig (ig25@mvmap66.ciw.uni-karlsruhe.de)
Tue, 6 May 1997 20:32:48 +0200 (MET DST)


[both to linux-kernel and linux-net ... dunno where the bug is]

This may have been fixed long ago, but anyway...

On a machine under 2.0.27, I try to run the following shellscript
on an NFS-mounted directory:

$ cat foo
rm -f res
for a in 0.01 0.03 0.05 0.1 0.2 0.3
do
for b in 0.01 0.03 0.1 0.3 0.5 1
do nice -15 a.out $a $b 500 >>res;
done
echo >>res
done
$ sh < foo
sh: res: Text file busy
sh: res: Text file busy
sh: res: Text file busy
sh: res: Text file busy
sh: res: Text file busy

[...]

Uh?

stracing the offending process shows me:

[...]
open("res", O_WRONLY|O_APPEND|O_CREAT, 0666) = -1 ETXTBSY (Text file busy)
write(2, "sh: res: Text file busy\n", 24sh: res: Text file busy
) = 24
sigprocmask(SIG_BLOCK, [CHLD], []) = 0
sigprocmask(SIG_SETMASK, [], NULL) = 0
sigprocmask(SIG_BLOCK, [CHLD], []) = 0
sigprocmask(SIG_SETMASK, [], NULL) = 0

Hmm... strange.

Stracing the NFS daemon (2.0.30, nfs-server-2.2beta16) shows me:

lstat("/home/ig25/des-sim/res", 0xbffff7a8) = -1 ENOENT (No such file or directory)
sendto(3, "R\3\21\26\0\0\0\1\0\0\0\0\0\0\0\0"..., 28, 0, {sin_family=AF_INET, sin_port=htons(645), sin_addr=inet_addr("129.13.110.83")}, 16) = 28
oldselect(256, [3 4], NULL, NULL, NULL) = 1 (in [3])
recvfrom(3, "R\3\21\27\0\0\0\0\0\0\0\2\0\1\206"..., 8800, 0, {sin_family=AF_INET, sin_port=htons(645), sin_addr=inet_addr("129.13.110.83")}, [16]) = 152
time([862943322]) = 862943322
lstat("/home/ig25/des-sim/res", 0xbffff7a8) = -1 ENOENT (No such file or directory)
lstat("/home/ig25/des-sim/res", 0xbffff6cc) = -1 ENOENT (No such file or directory)
open("/home/ig25/des-sim/res", O_WRONLY|O_CREAT, 0640) = 1
lstat("/home/ig25/des-sim/res", {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
fstat(1, {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
time([862943322]) = 862943322
lstat("/home/ig25/des-sim/res", {st_mode=S_IFREG|0640, st_size=0, ...}) = 0
time([862943322]) = 862943322
time([862943322]) = 862943322
time([862943322]) = 862943322
sendto(3, "R\3\21\27\0\0\0\1\0\0\0\0\0\0\0\0"..., 128, 0, {sin_family=AF_INET, sin_port=htons(645), sin_addr=inet_addr("129.13.110.83")}, 16) = 128
oldselect(256, [3 4], NULL, NULL, NULL) = ? ERESTARTNOHAND (To be restarted)
--- SIGALRM (Alarm clock) ---

Looks like there's something seriously strange with the 2.0.27 NFS
client code, unless the NFS server itself is broken (Olaf?).

-- 
Thomas Koenig, Thomas.Koenig@ciw.uni-karlsruhe.de, ig25@dkauni2.bitnet.
The joy of engineering is to find a straight line on a double
logarithmic diagram.