Beispiel #1
0
int au_finfo_init(struct file *file)
{
	struct au_finfo *finfo;
	struct dentry *dentry;
	unsigned long ul;

	dentry = file->f_dentry;
	finfo = au_cache_alloc_finfo();
	if (unlikely(!finfo))
		goto out;

	finfo->fi_hfile = kcalloc(au_sbend(dentry->d_sb) + 1,
				  sizeof(*finfo->fi_hfile), GFP_NOFS);
	if (unlikely(!finfo->fi_hfile))
		goto out_finfo;

	au_rw_init_wlock(&finfo->fi_rwsem);
	finfo->fi_bstart = -1;
	finfo->fi_bend = -1;
	atomic_set(&finfo->fi_generation, au_digen(dentry));
	/* smp_mb(); */ /* atomic_set */

	/* cf. au_store_oflag() */
	/* suppress a warning in lp64 */
	ul = (unsigned long)file->private_data;
	file->f_mode |= (vfsub_uint_to_fmode(ul) & FMODE_EXEC);
	file->private_data = finfo;
	return 0; /* success */

 out_finfo:
	au_cache_free_finfo(finfo);
 out:
	return -ENOMEM;
}
Beispiel #2
0
void au_finfo_fin(struct file *file)
{
	struct au_finfo *finfo;

	finfo = au_fi(file);
	AuDebugOn(finfo->fi_hdir);
	AuRwDestroy(&finfo->fi_rwsem);
	au_cache_free_finfo(finfo);
}
Beispiel #3
0
void au_finfo_fin(struct file *file)
{
	struct au_finfo *finfo;

	au_nfiles_dec(file->f_dentry->d_sb);

	finfo = au_fi(file);
	AuDebugOn(finfo->fi_hdir);
	AuRwDestroy(&finfo->fi_rwsem);
	au_cache_free_finfo(finfo);
}
Beispiel #4
0
void au_finfo_fin(struct file *file)
{
	struct au_finfo *finfo;
	aufs_bindex_t bindex, bend;

	fi_write_lock(file);
	bend = au_fbend(file);
	bindex = au_fbstart(file);
	if (bindex >= 0)
		/*
		 * calls fput() instead of filp_close(),
		 * since no dnotify or lock for the lower file.
		 */
		for (; bindex <= bend; bindex++)
			au_set_h_fptr(file, bindex, NULL);

	finfo = au_fi(file);
	au_dbg_verify_hf(finfo);
	kfree(finfo->fi_hfile);
	fi_write_unlock(file);
	AuRwDestroy(&finfo->fi_rwsem);
	au_cache_free_finfo(finfo);
}