summaryrefslogtreecommitdiff
path: root/fs/aufs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/aufs/dir.c')
-rw-r--r--fs/aufs/dir.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/fs/aufs/dir.c b/fs/aufs/dir.c
index 716158c3c..395563e4b 100644
--- a/fs/aufs/dir.c
+++ b/fs/aufs/dir.c
@@ -143,7 +143,7 @@ out_unlock:
out:
dput(a->dentry);
au_nwt_done(&au_sbi(sb)->si_nowait);
- kfree(arg);
+ au_delayed_kfree(arg);
}
void au_dir_ts(struct inode *dir, aufs_bindex_t bindex)
@@ -179,7 +179,7 @@ void au_dir_ts(struct inode *dir, aufs_bindex_t bindex)
if (unlikely(wkq_err)) {
pr_err("wkq %d\n", wkq_err);
dput(dentry);
- kfree(arg);
+ au_delayed_kfree(arg);
}
out:
@@ -298,7 +298,7 @@ static int aufs_open_dir(struct inode *inode __maybe_unused,
};
err = au_do_open(file, &args);
if (unlikely(err))
- kfree(fidir);
+ au_delayed_kfree(fidir);
}
si_read_unlock(sb);
return err;
@@ -310,8 +310,11 @@ static int aufs_release_dir(struct inode *inode __maybe_unused,
struct au_vdir *vdir_cache;
struct au_finfo *finfo;
struct au_fidir *fidir;
+ struct au_hfile *hf;
aufs_bindex_t bindex, bbot;
+ int execed, delayed;
+ delayed = (current->flags & PF_KTHREAD) || in_interrupt();
finfo = au_fi(file);
fidir = finfo->fi_hdir;
if (fidir) {
@@ -319,22 +322,25 @@ static int aufs_release_dir(struct inode *inode __maybe_unused,
&au_sbi(file->f_path.dentry->d_sb)->si_files);
vdir_cache = fidir->fd_vdir_cache; /* lock-free */
if (vdir_cache)
- au_vdir_free(vdir_cache);
+ au_vdir_free(vdir_cache, delayed);
bindex = finfo->fi_btop;
if (bindex >= 0) {
+ execed = vfsub_file_execed(file);
+ hf = fidir->fd_hfile + bindex;
/*
* calls fput() instead of filp_close(),
* since no dnotify or lock for the lower file.
*/
bbot = fidir->fd_bbot;
- for (; bindex <= bbot; bindex++)
- au_set_h_fptr(file, bindex, NULL);
+ for (; bindex <= bbot; bindex++, hf++)
+ if (hf->hf_file)
+ au_hfput(hf, execed);
}
- kfree(fidir);
+ au_delayed_kfree(fidir);
finfo->fi_hdir = NULL;
}
- au_finfo_fin(file);
+ au_finfo_fin(file, delayed);
return 0;
}
@@ -453,7 +459,7 @@ static int aufs_fsync_dir(struct file *file, loff_t start, loff_t end,
/* ---------------------------------------------------------------------- */
-static int aufs_iterate(struct file *file, struct dir_context *ctx)
+static int aufs_iterate_shared(struct file *file, struct dir_context *ctx)
{
int err;
struct dentry *dentry;
@@ -731,7 +737,7 @@ const struct file_operations aufs_dir_fop = {
.owner = THIS_MODULE,
.llseek = default_llseek,
.read = generic_read_dir,
- .iterate = aufs_iterate,
+ .iterate_shared = aufs_iterate_shared,
.unlocked_ioctl = aufs_ioctl_dir,
#ifdef CONFIG_COMPAT
.compat_ioctl = aufs_compat_ioctl_dir,