lkml.org 
[lkml]   [2011]   [Mar]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [RFC] st_nlink after rmdir() and rename()
Date
Theodore Tso <tytso@MIT.EDU> writes:

> On Mar 2, 2011, at 10:24 PM, Al Viro wrote:
>
>> We have an interesting problem. Consider the following sequence
>> of syscalls:
>> mkdir("foo", 0777);
>> mkdir("bar", 0777);
>> fd1 = open("foo", O_DIRECTORY);
>> fd2 = open("bar", O_DIRECTORY);
>> rename("foo", "bar"); /* kill old bar */
>
> I must be missing something. I didn't think you could rename on
> top of a directory and have the directory disappear. Don't you get
> an error in that case?

rename is required to be able to move a directory over an empty
directory, atomically.

> What happens if bar contains files?

That's an error.

Andreas.

--
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84 5EC7 45C6 250E 6F00 984E
"And now for something completely different."


\
 
 \ /
  Last update: 2011-03-03 17:21    [W:0.105 / U:0.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site