* The root inode for a PFS is only supposed to be created for PFS masters.
PFS slaves get their root inode from the mirroring operation. No longer
create the root inode for a PFS slave.
The root inode was being incorrectly created for slaves as well as
masters, causing the root inode from the mirroring operation to be
ignored.
This caused the root directory for a slave to show up as empty when
doing a mirror-copy from a HAMMER version 1 filesystem to a HAMMER
version 2 filesystem.
Reported-by: "Simon 'corecode' Schubert" <corecode@fs.ei.tum.de>
/*
* Localize the data payload. Directory entries may need their
* localization adjusted.
- *
- * PFS directory entries must be skipped entirely (return EALREADY).
*/
static
int
u_int32_t localization;
if (leaf->base.rec_type == HAMMER_RECTYPE_DIRENTRY) {
- if (data->entry.obj_id == HAMMER_OBJID_ROOT)
- return(EALREADY);
localization = leaf->base.localization &
HAMMER_LOCALIZE_PSEUDOFS_MASK;
if (data->entry.localization != localization) {
/*
* Save it back, create a root inode if we are in master
* mode and no root exists.
+ *
+ * We do not create root inodes for slaves, the root inode
+ * must be mirrored from the master.
*/
- if (error == 0)
+ if (error == 0 &&
+ (pfsm->pfsd.mirror_flags & HAMMER_PFSD_SLAVE) == 0) {
error = hammer_mkroot_pseudofs(trans, cred, pfsm);
+ }
if (error == 0)
error = hammer_save_pseudofs(trans, pfsm);