[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130907150857.GC13318@ZenIV.linux.org.uk>
Date: Sat, 7 Sep 2013 16:08:57 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Marco Stornelli <marco.stornelli@...il.com>
Cc: Linux FS Devel <linux-fsdevel@...r.kernel.org>,
Vladimir Davydov <vdavydov@...allels.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 09/19] pramfs: inode operations for dirs
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists