[Linux-cluster] gfs2: st_size is 0 for symbolic links

Nathaniel Griswold griswold at cs.wisc.edu
Mon Jun 1 16:03:40 UTC 2009


I had an application fail on gfs2 today because of incorrect stat
st_size on a symlink. The application was trying to utilize the fact
that st_size on a symlink should be the character length of the
destination path.

[root at somehost somepath]# touch somefile
[root at somehost somepath]# ln -s somefile somelink
[root at somehost somepath]# stat somelink |grep Size
  Size: 0               Blocks: 8          IO Block: 4096   symbolic link
[root at somehost somepath]# gfs2_tool getargs /somepath
noatime 0
data 2
suiddir 0
quota 0
posix_acl 1
num_glockd 1
upgrade 0
debug 0
localflocks 0
localcaching 0
ignore_local_fs 0
spectator 0
hostdata jid=0:id=196612:first=1

[root at somehost somepath]# uname -r

[root at somehost somepath]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.3 (Tikanga)

If i go to some other host or remount the filesystem, then st_size is correct:

[root at someotherhost somepath]# stat somelink |grep Size
  Size: 8               Blocks: 8          IO Block: 4096   symbolic link

Searched archives and didn't see anything. Is this a bug?


More information about the Linux-cluster mailing list