int bindex, bstart, bend;
int fgen, err = 0;
- unionfs_read_lock(sb);
- if ((err = unionfs_file_revalidate(file, 1)))
- goto out;
- fileinfo = UNIONFS_F(file);
- BUG_ON(file->f_dentry->d_inode != inode);
- inodeinfo = UNIONFS_I(inode);
-
unionfs_check_file(file);
unionfs_read_lock(sb);
/*
*/
if ((err = unionfs_file_revalidate(file, 1)))
goto out;
+ fileinfo = UNIONFS_F(file);
+ BUG_ON(file->f_dentry->d_inode != inode);
+ inodeinfo = UNIONFS_I(inode);
/* fput all the hidden files */
fgen = atomic_read(&fileinfo->generation);
kfree(buf);
if (!err)
- err = output_file->f_op->fsync(output_file, new_hidden_dentry, 0);
+ err = output_file->f_op->fsync(output_file,
+ new_hidden_dentry, 0);
if (err)
goto out_close_out;
int err;
unionfs_read_lock(file->f_dentry->d_sb);
+ unionfs_check_file(file);
if ((err = unionfs_file_revalidate(file, 0)))
goto out;
static ssize_t unionfs_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
- int err;
-#error fixme fxn check_file? read_unlock?
+ int err = 0;
+ struct file *file = iocb->ki_filp;
+
+ unionfs_read_lock(file->f_dentry->d_sb);
+ unionfs_check_file(file);
+ if ((err = unionfs_file_revalidate(file, 0)))
+ goto out;
+
err = generic_file_aio_read(iocb, iov, nr_segs, pos);
if (err == -EIOCBQUEUED)
err = wait_on_sync_kiocb(iocb);
if (err >= 0)
- touch_atime(unionfs_lower_mnt(iocb->ki_filp->f_path.dentry),
- unionfs_lower_dentry(iocb->ki_filp->f_path.dentry));
+ touch_atime(unionfs_lower_mnt(file->f_path.dentry),
+ unionfs_lower_dentry(file->f_path.dentry));
-#if 0
out:
unionfs_read_unlock(file->f_dentry->d_sb);
unionfs_check_file(file);
-#endif
return err;
}
static ssize_t unionfs_write(struct file * file, const char __user * buf,
- size_t count, loff_t * ppos)
+ size_t count, loff_t *ppos)
{
int err = 0;
unionfs_read_lock(file->f_dentry->d_sb);
+ unionfs_check_file(file);
if ((err = unionfs_file_revalidate(file, 1)))
goto out;
int willwrite;
unionfs_read_lock(file->f_dentry->d_sb);
+ unionfs_check_file(file);
+ if ((err = unionfs_file_revalidate(file, 1)))
+ goto out;
+
/* This might be deferred to mmap's writepage */
willwrite = ((vma->vm_flags | VM_SHARED | VM_WRITE) == vma->vm_flags);
if ((err = unionfs_file_revalidate(file, willwrite)))
break;
}
+ /* for mmap */
if (ia->ia_valid & ATTR_SIZE) {
if (ia->ia_size != i_size_read(inode)) {
err = vmtruncate(inode, ia->ia_size);
int err;
unionfs_read_lock(file->f_dentry->d_sb);
+ unionfs_check_file(file);
if ((err = unionfs_file_revalidate(file, 0)))
- goto out_err;
+ goto out;
err = unionfs_do_readpage(file, page);
* page. but we no longer have to wakeup on our page here, b/c
* UnlockPage does it
*/
-
-out_err:
+out:
unlock_page(page);
+ unionfs_check_file(file);
unionfs_read_unlock(file->f_dentry->d_sb);
return err;
int err;
unionfs_read_lock(file->f_dentry->d_sb);
+ unionfs_check_file(file);
err = unionfs_file_revalidate(file, 1);
+ unionfs_check_file(file);
unionfs_read_unlock(file->f_dentry->d_sb);
return err;
BUG_ON(file == NULL);
unionfs_read_lock(file->f_dentry->d_sb);
+ unionfs_check_file(file);
if ((err = unionfs_file_revalidate(file, 1)))
goto out;
if (UNIONFS_F(file) != NULL)
lower_file = unionfs_lower_file(file);
- BUG_ON(lower_file == NULL); /* FIXME: is this assertion right here? */
+ /* FIXME: is this assertion right here? */
+ BUG_ON(lower_file == NULL);
page_data = (char *)kmap(page);
lower_file->f_pos = (page->index << PAGE_CACHE_SHIFT) + from;
ClearPageUptodate(page);
unionfs_read_unlock(file->f_dentry->d_sb);
+ unionfs_check_file(file);
return err; /* assume all is ok */
}
/* do the actual sync */
mapping = lower_page->mapping;
+ /*
+ * XXX: can we optimize ala RAIF and set the lower page to be
+ * discarded after a successful sync_page?
+ */
if (mapping && mapping->a_ops && mapping->a_ops->sync_page)
mapping->a_ops->sync_page(lower_page);