All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Schwab <schwab@redhat.com>
To: Theodore Tso <tytso@MIT.EDU>
Cc: Al Viro <viro@ZenIV.linux.org.uk>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC] st_nlink after rmdir() and rename()
Date: Thu, 03 Mar 2011 17:17:32 +0100	[thread overview]
Message-ID: <m3y64wyy8z.fsf@redhat.com> (raw)
In-Reply-To: <406B4874-D3D8-4C05-9FA5-8A7A18ABF89C@mit.edu> (Theodore Tso's message of "Thu, 3 Mar 2011 09:34:08 -0500")

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."

  reply	other threads:[~2011-03-03 16:18 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-03  3:24 [RFC] st_nlink after rmdir() and rename() Al Viro
2011-03-03  4:42 ` Al Viro
2011-03-03  5:17 ` Linus Torvalds
2011-03-03  6:03   ` Al Viro
2011-03-03 20:05     ` Linus Torvalds
2011-03-03 20:05       ` Linus Torvalds
2011-03-03 20:46       ` OGAWA Hirofumi
2011-03-03 20:50         ` OGAWA Hirofumi
2011-03-03 21:02         ` Linus Torvalds
2011-03-03 21:30           ` Al Viro
2011-03-03 21:37           ` OGAWA Hirofumi
2011-03-03 21:52             ` Linus Torvalds
2011-03-03 22:26               ` OGAWA Hirofumi
2011-03-03 22:37                 ` Linus Torvalds
2011-03-03 23:14                   ` OGAWA Hirofumi
2011-03-03 23:12                 ` Al Viro
2011-03-03 22:57               ` Al Viro
2011-03-03 23:07                 ` Al Viro
2011-03-04  6:55                 ` omfs fixes Al Viro
2011-03-04 15:24                   ` Bob Copeland
2011-03-03 21:23       ` [RFC] st_nlink after rmdir() and rename() Al Viro
2011-03-03 14:34 ` Theodore Tso
2011-03-03 16:17   ` Andreas Schwab [this message]
2011-03-03 19:16   ` Al Viro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3y64wyy8z.fsf@redhat.com \
    --to=schwab@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@MIT.EDU \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.