On lustre2.10.3 ifort lseek will return the wrong position when using append ">>" operation.
This can be reproduced on
client: sles12 lustre2.103 <–> server: lustre2.7.3
client: sles12 lustre2.103 <–> server: lustre2.10.3
hello.f
write(6,*) "hello world"
end
Working on sles11 and lustre2.7.3
> date > tt
> date >> tt
> cat tt
Wed May 30 13:32:58 PDT 2018
Wed May 30 13:33:04 PDT 2018
> strace ./a.out >> tt
.....
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffffffbf80) = -1 ENOTTY (Inappropriate ioctl for device)
fstat(1, {st_mode=S_IFREG|0600, st_size=58, ...}) = 0
ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, 0x7fffffffbf80) = -1 ENOTTY (Inappropriate ioctl for device)
write(1, " hello world\n", 13) = 13
lseek(1, 0, SEEK_CUR) = 71
ftruncate(1, 71)
= 0
> cat tt
Wed May 30 13:32:58 PDT 2018
Wed May 30 13:33:04 PDT 2018
hello world
-
- Note lseek(1,0,SEEK_CUR) set at 71.
Not working on lustre2.10.3.
> rm tt
> date > tt
> date >> tt
> cat tt
Wed May 30 13:41:39 PDT 2018
Wed May 30 13:41:44 PDT 2018
> strace ./a.out >> tt
....
fstat(1, {st_mode=S_IFREG|0600, st_size=58, ...}) = 0
ioctl(1, TCGETS, 0x7fffffffbf80) = -1 ENOTTY (Inappropriate ioctl for device)
write(1, " hello world\n", 13) = 13
lseek(1, 0, SEEK_CUR) = 13
ftruncate(1, 13) = 0
pfe27:/nobackup/jchang> cat tt
Wed May 30 13pfe27:/nobackup/jchang>
*Note that it's lseek that is getting the **wrong* information about current position after the append.
John L. Hammond (jhammond@whamcloud.com) merged in patch https://review.whamcloud.com/32661/
Subject:
LU-11069llite: correct file position after appending writesProject: fs/lustre-release
Branch: b2_10
Current Patch Set:
Commit: 7bc18a0083b27292dd912dba0ae1aa5010568fb4