Zach Brown f634a5b598 scoutfs: implement scoutfs_rename()
Previously we had lots of inode creation callers that used a function to
create the dirent items and we had unlink remove entries by hand.
Rename is different because it wants to remove and add multiple links as
it does its work, including recreating links that it has deleted.

We rework add_entry_item() so that it gets the specific fields it needs
instead of getting them from the vfs structs.  This makes it clear that
callers are responsible for the source of the fields.  Specifically we
need to be able to add entries during failed rename cleanup without
allocating a new readdir pos from the parent dir.

With callers now responsible for the inputs to add_entry_items() we move
some of its code out into all callers: checking name length, dirtying
the parent dir inode, and allocating a readdir pos from the parent.

We then refactor most of _unlink() into a a del_entry_items() to match
addition.  This removes the last user of scoutfs_item_delete_many() and
it will be removed in a future commit.

With the entry item helpers taking specific fields all the helpers they
use also need to use specific fields instead of the vfs structs.

To make rename cluster safe we need to get cluster locks for all the
inodes that we work with.  We also have to check that the locally cached
vfs input is still valid after acquiring the locks.  We only check the
basic structural correctness of the args: that parent dirs don't violate
ancestor rules to create loops and that the entries assumed by the
rename arguments still exist, or not.

Signed-off-by: Zach Brown <zab@versity.com>
2017-08-30 10:38:00 -07:00
2017-08-30 10:38:00 -07:00
S
Description
No description provided
7.7 MiB
Languages
C 86.4%
Shell 10%
Roff 2.5%
TeX 0.8%
Makefile 0.3%