Re: [PATCH] Add rpdfs_unlink() and rpdfs_rmdir()
Zach Brown <[email protected]> Tue, 3 Mar 2026 15:14:50 -0800
| Newsgroups | dev.linux.lists.rpdfs-devel |
|---|---|
| Message-ID | <[email protected]> |
On Thu, Feb 26, 2026 at 09:38:58PM +0100, Valerie Aurora wrote:
> + /* prepare all the blocks for the txn */
> + do {
> + ret = rpdfs_inode_txn_prepare(rfi, &txn, dir, RBAF_WRITE) ?:
> + rpdfs_inode_txn_prepare(rfi, &txn, inode, RBAF_WRITE) ?:
> + prepare_remove_entry(rfi, &txn, dir, kd);
> + } while (rpdfs_txn_retry(rfi, &txn, &ret));
> + if (ret < 0)
> + goto out;
> +
> + /*
> + * The VFS did a bunch of checks before calling this function,
> + * but some other node could have made changes between then and
> + * now. The prepare functions only succeed if the inodes have
> + * not been freed or reused, and if the directory entry to be
> + * removed is still there. The remaining check is if the target
> + * dir of an rmdir is still empty.
> + */
> +
> + if (S_ISDIR(inode->i_mode)) {
> + if (!simple_empty(dentry)) {
> + ret = -ENOTEMPTY;
> + goto out;
> + }
simple_empty() only checks the dcache. It's for in-memory systems only.
A dir that had entries that weren't cached would pass this test. Just
check nlink.
And this is in the apply phase so it can't generate an error. It should
have been detected in prepare. Maybe a simple prepare_unlink() that
checks the prepared inodes?
- z