*/
BUG_ON(!valid && dentry->d_inode);
- /* We start out in the leftmost branch. */
+ /*
+ * We shouldn't create things in a read-only branch; this check is a
+ * bit redundant as we don't allow branch 0 to be read-only at the
+ * moment
+ */
+ err = is_robranch_super(dentry->d_sb, 0);
+ if (err) {
+ err = -EROFS;
+ goto out;
+ }
+
+ /*
+ * We _always_ create on branch 0
+ */
bstart = 0;
lower_dentry = unionfs_lower_dentry_idx(dentry, bstart);
err = PTR_ERR(lower_parent_dentry);
goto out;
}
- /* We shouldn't create things in a read-only branch. */
- if (!(err = is_robranch_super(dentry->d_sb, bstart)))
- err = vfs_create(lower_parent_dentry->d_inode,
- lower_dentry, mode, nd);
+ err = vfs_create(lower_parent_dentry->d_inode,
+ lower_dentry, mode, nd);
if (err || !lower_dentry->d_inode)
unlock_dir(lower_parent_dentry);