kern/94849: rename on UFS filesystem is not atomic

Kris Kennaway kris at FreeBSD.org
Thu Mar 23 02:20:19 UTC 2006


>Number:         94849
>Category:       kern
>Synopsis:       rename on UFS filesystem is not atomic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Mar 23 02:20:17 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     Kris Kennaway
>Release:        FreeBSD 6.1-PRERELEASE i386
>Organization:
FreeBSD
>Environment:
SMP system running FreeBSD 6.x/7.x
>Description:

When more than one rename() operation on the same source file executes
on multiple CPUs at once, more than one operation may return success.

>How-To-Repeat:

Use the simul filesystem analysis tool:

   ftp://ftp.llnl.gov/pub/siop/simul/

(I'll add a port for this soon)

Tracing the operations with AUDIT, shows

header,153,1,rename(2),0,Thu Mar  9 15:52:21 2006, + 40 msec
path,/c/test/simul_rename.0
attribute,644,root,wheel,78,2175369,0
path,/c/test/simul_rename_new.1
subject,-1,root,wheel,root,wheel,58428,0,0,0.0.0.0
return,success,0
trailer,153
header,153,1,rename(2),0,Thu Mar  9 15:52:21 2006, + 40 msec
path,/c/test/simul_rename.0
attribute,644,root,wheel,78,2175369,0
path,/c/test/simul_rename_new.0
subject,-1,root,wheel,root,wheel,58422,0,0,0.0.0.0
return,success,0
trailer,153

i.e., rename(/c/test/simul_rename.0,/c/test/simul_rename_new.0) and
rename(/c/test/simul_rename.0,/c/test/simul_rename_new.1) were
executed simultaneously on this dual-CPU machine, and both succeeded.
The result is:

2175369 -rw-r--r--  2 root  wheel      0 Mar  9 15:52 simul_rename_new.0
2175369 -rw-r--r--  2 root  wheel      0 Mar  9 15:52 simul_rename_new.1

Similar bugs involving other filesystem operations exist when
operations are performed in parallel on an NFS client; on NFS client
and server at once; and on nullfs upper/lower layers at once (and
probably other filesystems).  This is the only problem I have found on
UFS so far.

>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list