From: Al Viro <viro@ZenIV.linux.org.uk>
To: Marco Stornelli <marco.stornelli@gmail.com>
Cc: Linux FS Devel <linux-fsdevel@vger.kernel.org>,
Vladimir Davydov <vdavydov@parallels.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/19] pramfs: inode operations for dirs
Date: Sat, 7 Sep 2013 16:08:57 +0100 [thread overview]
Message-ID: <20130907150857.GC13318@ZenIV.linux.org.uk> (raw)
In-Reply-To: <522AE28E.3010709@gmail.com>
On Sat, Sep 07, 2013 at 10:23:42AM +0200, Marco Stornelli wrote:
> +static int pram_rmdir(struct inode *dir, struct dentry *dentry)
> +{
> + struct inode *inode = dentry->d_inode;
> + struct pram_inode *pi;
> + int err = -ENOTEMPTY;
> +
> + if (!inode)
> + return -ENOENT;
> +
> + pi = pram_get_inode(dir->i_sb, inode->i_ino);
> +
> + /* directory to delete is empty? */
> + if (pi->i_type.dir.tail == 0) {
> + inode->i_ctime = dir->i_ctime;
> + inode->i_size = 0;
> + clear_nlink(inode);
> + pram_write_inode(inode, NULL);
> + pram_dec_count(dir);
> + err = 0;
> + } else {
> + pram_dbg("dir not empty\n");
> + }
> +
> + return err;
> +}
... and here you are paying for delayed removal of entries:
mkdir foo
touch foo/bar
rm -rf foo <foo/bar
will fail, since opened-and-unlinked file in effect keeps the directory
where it used to be "not empty" from your rmdir (and rename) POV.
next prev parent reply other threads:[~2013-09-07 15:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-07 8:23 [PATCH 09/19] pramfs: inode operations for dirs Marco Stornelli
2013-09-07 15:08 ` Al Viro [this message]
2013-09-07 16:17 ` Marco Stornelli
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=20130907150857.GC13318@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marco.stornelli@gmail.com \
--cc=vdavydov@parallels.com \
/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.