Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 27 Oct 2011 18:48:57 +0400
From:      Anton Yuzhaninov <citrin@citrin.ru>
To:        freebsd-stable@freebsd.org
Subject:   FreeBSD 8 - bug in rename(2)
Message-ID:  <4EA96F59.7040308@citrin.ru>

next in thread | raw e-mail | index | archive | help
After upgrade from old RELENG_7 to fresh RELENG_8 I've met with error in log rotation script.

After some digging I'v found, that rename(2) syscall sometime don't work properly. I can't reproduce problem with simple test case, but in production this problem appeared several time per day.

After rename(2) sometimes old name still exists.
stat for old and new names:

101 12153947 -rw-r--r-- 1 owner data 54507160 164374900 "Oct 27 13:58:06 2011" "Oct 27 13:58:06 2011" "Oct 27 13:58:06 2011" "Oct 27 13:56:05 2011" 16384 321248 0 /usr/local/run/nginx/access_log
101 12153947 -rw-r--r-- 1 owner data 54507160 164377726 "Oct 27 13:58:06 2011" "Oct 27 13:58:06 2011" "Oct 27 13:58:06 2011" "Oct 27 13:56:05 2011" 16384 321248 0 /usr/local/run/nginx/access_log.20111027T135806

2 files share same inode, but number of links is 1

2-nd rename for this file fail:
mv: rename /usr/local/run/nginx/access_log to /usr/local/run/nginx/access_log.tmp: No such file or directory

vfs.lookup_shared=0 don't affect this problem,

It seems to be, that problem is related to namei (vfs) cache - old entry sometimes is not removed.

Renamed file is open for write by nginx, but I don't know how this can affect namei.

-- 
 Anton Yuzhaninov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4EA96F59.7040308>