* This is important for open-but-unlinked files, as well as mmap
* support.
*/
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
fileinfo = UNIONFS_F(file);
unionfs_lock_dentry(dentry);
orig_bstart = dbstart(dentry);
orig_bend = dbend(dentry);
- if ((err = unionfs_partial_lookup(dentry)))
+ err = unionfs_partial_lookup(dentry);
+ if (err)
goto out;
bstart = dbstart(dentry);
bend = dbend(dentry);
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
/* check if asked for local commands */
unionfs_read_lock(dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
sb = dir->i_sb;
- if ((err = is_robranch_super(sb, new_bindex)))
+ err = is_robranch_super(sb, new_bindex);
+ if (err)
goto out;
/* Create the directory structure above this dentry. */
#ifdef CONFIG_UNION_FS_XATTR
/* Selinux uses extended attributes for permissions. */
- if ((err = copyup_xattrs(old_lower_dentry, new_lower_dentry)))
+ err = copyup_xattrs(old_lower_dentry, new_lower_dentry);
+ if (err)
goto out_unlink;
#endif /* CONFIG_UNION_FS_XATTR */
verify_locked(dentry);
- if ((err = is_robranch_super(dir->i_sb, bindex))) {
+ err = is_robranch_super(dir->i_sb, bindex);
+ if (err) {
lower_dentry = ERR_PTR(err);
goto out;
}
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
inode = file->f_path.dentry->d_inode;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
rdstate = UNIONFS_F(file)->rdstate;
BUG_ON(!S_ISDIR(dentry->d_inode->i_mode));
- if ((err = unionfs_partial_lookup(dentry)))
+ err = unionfs_partial_lookup(dentry);
+ if (err)
goto out;
bstart = dbstart(dentry);
int err;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
struct file *file = iocb->ki_filp;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
int err = 0;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
/* This might be deferred to mmap's writepage */
willwrite = ((vma->vm_flags | VM_SHARED | VM_WRITE) == vma->vm_flags);
- if (unlikely((err = unionfs_file_revalidate(file, willwrite))))
+ err = unionfs_file_revalidate(file, willwrite);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
int err = -EINVAL;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
int err = 0;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
* bit redundant as we don't allow branch 0 to be read-only at the
* moment
*/
- if ((err = is_robranch_super(dentry->d_sb, 0))) {
+ err = is_robranch_super(dentry->d_sb, 0);
+ if (err) {
err = -EROFS;
goto out;
}
BUG_ON(dbstart(old_dentry) != dbstart(new_dentry));
lower_dir_dentry = lock_parent(lower_new_dentry);
- if (!(err = is_robranch(old_dentry)))
+ err = is_robranch(old_dentry);
+ if (!err)
err = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode,
lower_new_dentry);
unlock_dir(lower_dir_dentry);
*/
lower_dir_dentry = lock_parent(whiteout_dentry);
- if (!(err = is_robranch_super(dentry->d_sb, bstart)))
+ err = is_robranch_super(dentry->d_sb, bstart);
+ if (!err)
err = vfs_unlink(lower_dir_dentry->d_inode,
whiteout_dentry);
dput(whiteout_dentry);
lower_dir_dentry = lock_parent(lower_dentry);
- if (!(err = is_robranch_super(dentry->d_sb, bindex))) {
+ err = is_robranch_super(dentry->d_sb, bindex);
+ if (!err) {
mode = S_IALLUGO;
err = vfs_symlink(lower_dir_dentry->d_inode,
lower_dentry, symname, mode);
lower_parent_dentry = lock_parent(whiteout_dentry);
/* found a.wh.foo entry, remove it then do vfs_mkdir */
- if (!(err = is_robranch_super(dentry->d_sb, bstart))) {
+ err = is_robranch_super(dentry->d_sb, bstart);
+ if (!err) {
args.unlink.parent = lower_parent_dentry->d_inode;
args.unlink.dentry = whiteout_dentry;
run_sioq(__unionfs_unlink, &args);
lower_parent_dentry = lock_parent(whiteout_dentry);
/* found a.wh.foo entry, remove it then do vfs_mkdir */
- if (!(err = is_robranch_super(dentry->d_sb, bstart)))
+ err = is_robranch_super(dentry->d_sb, bstart);
+ if (!err)
err = vfs_unlink(lower_parent_dentry->d_inode,
whiteout_dentry);
dput(whiteout_dentry);
case INTERPOSE_PARTIAL:
break;
case INTERPOSE_LOOKUP:
- if (unlikely((err = new_dentry_private_data(dentry))))
+ err = new_dentry_private_data(dentry);
+ if (unlikely(err))
goto out;
break;
default:
/* default: can only be INTERPOSE_REVAL/REVAL_NEG */
- if (unlikely((err = realloc_dentry_private_data(dentry))))
+ err = realloc_dentry_private_data(dentry);
+ if (unlikely(err))
goto out;
break;
}
goto out;
}
- if ((err = check_branch(&nd))) {
+ err = check_branch(&nd);
+ if (err) {
printk(KERN_ERR "unionfs: lower directory "
"'%s' is not a valid branch\n", name);
path_release(&nd);
/* link the upper and lower dentries */
sb->s_root->d_fsdata = NULL;
- if (unlikely((err = new_dentry_private_data(sb->s_root))))
+ err = new_dentry_private_data(sb->s_root);
+ if (unlikely(err))
goto out_freedpd;
/* Set the lower dentries for s_root */
pr_info("Registering unionfs " UNIONFS_VERSION "\n");
- if (unlikely((err = unionfs_init_filldir_cache())))
+ err = unionfs_init_filldir_cache();
+ if (unlikely(err))
goto out;
- if (unlikely((err = unionfs_init_inode_cache())))
+ err = unionfs_init_inode_cache();
+ if (unlikely(err))
goto out;
- if (unlikely((err = unionfs_init_dentry_cache())))
+ err = unionfs_init_dentry_cache();
+ if (unlikely(err))
goto out;
- if (unlikely((err = init_sioq())))
+ err = init_sioq();
+ if (unlikely(err))
goto out;
err = register_filesystem(&unionfs_fs_type);
out:
int err;
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, false))))
+ err = unionfs_file_revalidate(file, false);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
BUG_ON(file == NULL);
unionfs_read_lock(file->f_path.dentry->d_sb);
- if (unlikely((err = unionfs_file_revalidate(file, true))))
+ err = unionfs_file_revalidate(file, true);
+ if (unlikely(err))
goto out;
unionfs_check_file(file);
return UNIONFS_I(inode)->hashsize;
for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
- if (!(lower_inode = unionfs_lower_inode_idx(inode, bindex)))
+ lower_inode = unionfs_lower_inode_idx(inode, bindex);
+ if (!lower_inode)
continue;
if (lower_inode->i_size == DENTPAGE)
}
lower_wh_dir_dentry = lock_parent(lower_wh_dentry);
- if (!(err = is_robranch_super(old_dentry->d_sb, bindex)))
+ err = is_robranch_super(old_dentry->d_sb, bindex);
+ if (!err)
err = vfs_unlink(lower_wh_dir_dentry->d_inode,
lower_wh_dentry);
continue;
unlink_dir_dentry = lock_parent(unlink_dentry);
- if (!(err = is_robranch_super(old_dir->i_sb, bindex)))
+ err = is_robranch_super(old_dir->i_sb, bindex);
+ if (!err)
err = vfs_unlink(unlink_dir_dentry->d_inode,
unlink_dentry);
if (unlikely(err < 0))
goto out;
lower_dir_dentry = lock_parent(lower_wh_dentry);
- if (!(err = is_robranch_super(dentry->d_sb, bindex)))
+ err = is_robranch_super(dentry->d_sb, bindex);
+ if (!err)
err = vfs_create(lower_dir_dentry->d_inode,
lower_wh_dentry,
~current->fs->umask & S_IRWXUGO,
* because this code base doesn't support stacking unionfs: the ODF
* code base supports that correctly.
*/
- if ((err = check_branch(&nd))) {
+ err = check_branch(&nd);
+ if (err) {
printk(KERN_ERR "unionfs: lower directory "
"\"%s\" is not a valid branch\n", optarg);
path_release(&nd);
int bindex;
int err = 0;
- if ((err = unionfs_partial_lookup(dentry)))
+ err = unionfs_partial_lookup(dentry);
+ if (err)
goto out;
bindex = dbstart(dentry);
/* avoid destroying the lower inode if the file is in use */
dget(lower_dentry);
- if (!(err = is_robranch_super(dentry->d_sb, bindex)))
+ err = is_robranch_super(dentry->d_sb, bindex);
+ if (!err)
err = vfs_unlink(lower_dir_dentry->d_inode, lower_dentry);
/* if vfs_unlink succeeded, update our inode's times */
if (!err)
/* avoid destroying the lower inode if the file is in use */
dget(lower_dentry);
- if (!(err = is_robranch(dentry)))
+ err = is_robranch(dentry);
+ if (!err)
err = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
dput(lower_dentry);