* race condition on looking up inodes
@ 2001-04-09 3:26 warren
2001-04-09 4:39 ` Alexander Viro
2001-04-09 5:03 ` Bernd Eckenfels
0 siblings, 2 replies; 3+ messages in thread
From: warren @ 2001-04-09 3:26 UTC (permalink / raw)
To: linux-kernel
Hi,
I had post a simillar message before.
Thanks for the replay from Albert D. Cahalan. But i found some results
confusing me.
For example, process 1 and process 2 run concurrently and execute the
following system calls.
rename("/usr/hybrid/cfg/data","/usr/mytemp/data1"); /*for process 1*/
----------------------------------------------------------------
rename("/usr/mytemp/data1","/usr/test");/* for process 2*/
----------------------------------------------------------------
It is possible that context switch happens when process 1 is look ing up
the inode for "/usr/mytemp/data1" or the inode for "/usr/hybrid/cfg/data".
It will result in diffrent behaviour for process 2 and confuses the
application.
If so,how does Linux solve?
Thanks.
Warren
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: race condition on looking up inodes
2001-04-09 3:26 race condition on looking up inodes warren
@ 2001-04-09 4:39 ` Alexander Viro
2001-04-09 5:03 ` Bernd Eckenfels
1 sibling, 0 replies; 3+ messages in thread
From: Alexander Viro @ 2001-04-09 4:39 UTC (permalink / raw)
To: warren; +Cc: linux-kernel
On Mon, 9 Apr 2001, warren wrote:
>
>
> Hi,
> I had post a simillar message before.
> Thanks for the replay from Albert D. Cahalan. But i found some results
> confusing me.
> For example, process 1 and process 2 run concurrently and execute the
> following system calls.
>
> rename("/usr/hybrid/cfg/data","/usr/mytemp/data1"); /*for process 1*/
>
> ----------------------------------------------------------------
>
> rename("/usr/mytemp/data1","/usr/test");/* for process 2*/
> ----------------------------------------------------------------
> It is possible that context switch happens when process 1 is look ing up
> the inode for "/usr/mytemp/data1" or the inode for "/usr/hybrid/cfg/data".
> It will result in diffrent behaviour for process 2 and confuses the
> application.
> If so,how does Linux solve?
Solves what, precisely? Result depends on the order of these calls. If
you don't provide any serialization - you get timing-dependent results
you were asking for. What's the problem and what behaviour do you expect?
Besides, what's the difference caused by the moment of context switch?
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: race condition on looking up inodes
2001-04-09 3:26 race condition on looking up inodes warren
2001-04-09 4:39 ` Alexander Viro
@ 2001-04-09 5:03 ` Bernd Eckenfels
1 sibling, 0 replies; 3+ messages in thread
From: Bernd Eckenfels @ 2001-04-09 5:03 UTC (permalink / raw)
To: linux-kernel
In article <000201c0c0a4$eb5c7b10$321ea8c0@saturn> you wrote:
> rename("/usr/hybrid/cfg/data","/usr/mytemp/data1"); /*for process 1*/
> rename("/usr/mytemp/data1","/usr/test");/* for process 2*/
Rename syscall is expected to be atomic on unixoid systems. And I dont know of
a case where a problem is, besides if you use some network file system, where
nobody can realy gurantee anything (well kidding, but it is harder than on a
local one).
The second rename may see the result of the first rename or the original state
before the first rename. It will not see any half-state or locked nodes.
Greetings
Bernd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-04-09 5:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-09 3:26 race condition on looking up inodes warren
2001-04-09 4:39 ` Alexander Viro
2001-04-09 5:03 ` Bernd Eckenfels
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.