if (unlikely(!d_deleted(dentry) &&
(sbgen > fgen || dbstart(dentry) != fbstart(file)))) {
/* save orig branch ID */
- int orig_brid = UNIONFS_F(file)->saved_branch_ids[fbstart(file)];
+ int orig_brid =
+ UNIONFS_F(file)->saved_branch_ids[fbstart(file)];
/* First we throw out the existing files. */
cleanup_file(file);
}
}
atomic_set(&UNIONFS_F(file)->generation,
- atomic_read(&UNIONFS_I(dentry->d_inode)->generation));
+ atomic_read(
+ &UNIONFS_I(dentry->d_inode)->generation));
}
/* Copyup on the first write to a file on a readonly branch. */
struct dentry *lower_dentry;
struct file *lower_file;
int bindex, bstart, bend;
+ struct vfsmount *mnt;
bstart = fbstart(file) = dbstart(file->f_path.dentry);
bend = fbend(file) = dbend(file->f_path.dentry);
dget(lower_dentry);
unionfs_mntget(file->f_path.dentry, bindex);
- lower_file = dentry_open(lower_dentry,
- unionfs_lower_mnt_idx(file->f_path.dentry,
- bindex),
- file->f_flags);
+ mnt = unionfs_lower_mnt_idx(file->f_path.dentry, bindex);
+ lower_file = dentry_open(lower_dentry, mnt, file->f_flags);
if (IS_ERR(lower_file))
return PTR_ERR(lower_file);
err = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg);
} else if (lower_file->f_op->ioctl) {
lock_kernel();
- err = lower_file->f_op->ioctl(lower_file->f_path.dentry->d_inode,
- lower_file, cmd, arg);
+ err = lower_file->f_op->ioctl(
+ lower_file->f_path.dentry->d_inode,
+ lower_file, cmd, arg);
unlock_kernel();
}
bindex, dstart, dend);
}
} else { /* lower_dentry == NULL */
- if (bindex >= dstart && bindex <= dend) {
- /*
- * Directories can have NULL lower inodes in
- * b/t start/end, but NOT if at the
- * start/end range. Ignore this rule,
- * however, if this is a NULL dentry or a
- * deleted dentry.
- */
- if (unlikely(!d_deleted((struct dentry *) dentry) &&
- inode &&
- !(inode && S_ISDIR(inode->i_mode) &&
- bindex > dstart && bindex < dend))) {
- PRINT_CALLER(fname, fxn, line);
- pr_debug(" CD2: dentry/lower=%p:%p(%p) "
- "bindex=%d dstart/end=%d:%d\n",
- dentry, lower_dentry,
- (lower_dentry ?
- lower_dentry->d_inode :
- (void *) -1L),
- bindex, dstart, dend);
- }
+ if (bindex < dstart || bindex > dend)
+ continue;
+ /*
+ * Directories can have NULL lower inodes in b/t
+ * start/end, but NOT if at the start/end range.
+ * Ignore this rule, however, if this is a NULL
+ * dentry or a deleted dentry.
+ */
+ if (unlikely(!d_deleted((struct dentry *) dentry) &&
+ inode &&
+ !(inode && S_ISDIR(inode->i_mode) &&
+ bindex > dstart && bindex < dend))) {
+ PRINT_CALLER(fname, fxn, line);
+ pr_debug(" CD2: dentry/lower=%p:%p(%p) "
+ "bindex=%d dstart/end=%d:%d\n",
+ dentry, lower_dentry,
+ (lower_dentry ?
+ lower_dentry->d_inode :
+ (void *) -1L),
+ bindex, dstart, dend);
}
}
}
lower_mnt, bindex, dstart, dend);
}
} else { /* lower_mnt == NULL */
- if (bindex >= dstart && bindex <= dend) {
- /*
- * Directories can have NULL lower inodes in
- * b/t start/end, but NOT if at the
- * start/end range. Ignore this rule,
- * however, if this is a NULL dentry.
- */
- if (unlikely(inode &&
- !(inode && S_ISDIR(inode->i_mode) &&
- bindex > dstart && bindex < dend))) {
- PRINT_CALLER(fname, fxn, line);
- pr_debug(" CM1: dentry/lmnt=%p:%p "
- "bindex=%d dstart/end=%d:%d\n",
- dentry, lower_mnt, bindex,
- dstart, dend);
- }
+ if (bindex < dstart || bindex > dend)
+ continue;
+ /*
+ * Directories can have NULL lower inodes in b/t
+ * start/end, but NOT if at the start/end range.
+ * Ignore this rule, however, if this is a NULL
+ * dentry.
+ */
+ if (unlikely(inode &&
+ !(inode && S_ISDIR(inode->i_mode) &&
+ bindex > dstart && bindex < dend))) {
+ PRINT_CALLER(fname, fxn, line);
+ pr_debug(" CM1: dentry/lmnt=%p:%p "
+ "bindex=%d dstart/end=%d:%d\n",
+ dentry, lower_mnt, bindex,
+ dstart, dend);
}
}
}
/* check if lower inode is newer than upper one (it shouldn't) */
if (unlikely(is_newer_lower(dentry))) {
PRINT_CALLER(fname, fxn, line);
- for (bindex = ibstart(inode); bindex <= ibend(inode); bindex++) {
+ for (bindex = ibstart(inode); bindex <= ibend(inode);
+ bindex++) {
lower_inode = unionfs_lower_inode_idx(inode, bindex);
if (unlikely(!lower_inode))
continue;
if (unlikely(bindex < fstart || bindex > fend)) {
PRINT_CALLER(fname, fxn, line);
pr_debug(" CF5: file/lower=%p:%p bindex=%d "
- "fstart/end=%d:%d\n",
- file, lower_file, bindex, fstart, fend);
+ "fstart/end=%d:%d\n", file,
+ lower_file, bindex, fstart, fend);
}
} else { /* lower_file == NULL */
if (bindex >= fstart && bindex <= fend) {