From kris@obsecurity.org  Thu Mar 23 02:15:25 2006
Return-Path: <kris@obsecurity.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 86A4B16A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 23 Mar 2006 02:15:25 +0000 (UTC)
	(envelope-from kris@obsecurity.org)
Received: from elvis.mu.org (elvis.mu.org [192.203.228.196])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 56A8643D45
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 23 Mar 2006 02:15:25 +0000 (GMT)
	(envelope-from kris@obsecurity.org)
Received: from obsecurity.dyndns.org (elvis.mu.org [192.203.228.196])
	by elvis.mu.org (Postfix) with ESMTP id 3CF641A4E63
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 22 Mar 2006 18:15:25 -0800 (PST)
Received: by obsecurity.dyndns.org (Postfix, from userid 1000)
	id 84E1A51965; Wed, 22 Mar 2006 21:15:24 -0500 (EST)
Message-Id: <20060323021524.84E1A51965@obsecurity.dyndns.org>
Date: Wed, 22 Mar 2006 21:15:24 -0500 (EST)
From: Kris Kennaway <kris@FreeBSD.org>
Reply-To: Kris Kennaway <kris@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: rename on UFS filesystem is not atomic
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         94849
>Category:       kern
>Synopsis:       [ufs] rename on UFS filesystem is not atomic
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-fs
>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:  Mon May 18 03:02:56 UTC 2009
>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:
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon May 18 03:02:44 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=94849 
>Unformatted:
