From 863981e96738983919de841ec669e157e6bdaeb0 Mon Sep 17 00:00:00 2001 From: André Fabian Silva Delgado Date: Sun, 11 Sep 2016 04:34:46 -0300 Subject: Linux-libre 4.7.1-gnu --- fs/aufs/hnotify.c | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) (limited to 'fs/aufs/hnotify.c') diff --git a/fs/aufs/hnotify.c b/fs/aufs/hnotify.c index 3016c5e73..a05aed870 100644 --- a/fs/aufs/hnotify.c +++ b/fs/aufs/hnotify.c @@ -22,7 +22,7 @@ int au_hn_alloc(struct au_hinode *hinode, struct inode *inode) AuTraceErr(err); if (unlikely(err)) { hinode->hi_notify = NULL; - au_cache_free_hnotify(hn); + au_cache_dfree_hnotify(hn); /* * The upper dir was removed by udba, but the same named * dir left. In this case, aufs assignes a new inode @@ -46,7 +46,7 @@ void au_hn_free(struct au_hinode *hinode) if (hn) { hinode->hi_notify = NULL; if (au_hnotify_op.free(hinode, hn)) - au_cache_free_hnotify(hn); + au_cache_dfree_hnotify(hn); } } @@ -480,7 +480,7 @@ static void au_hn_bh(void *_args) || au_ftest_hnjob(a->flags[AuHn_CHILD], GEN))) { inode = lookup_wlock_by_ino(sb, bfound, h_ino); try_iput = 1; - } + } args.flags = a->flags[AuHn_CHILD]; args.dentry = dentry; @@ -519,7 +519,7 @@ out: iput(a->dir); si_write_unlock(sb); au_nwt_done(&sbinfo->si_nowait); - kfree(a); + au_delayed_kfree(a); } /* ---------------------------------------------------------------------- */ @@ -625,7 +625,7 @@ int au_hnotify(struct inode *h_dir, struct au_hnotify *hnotify, u32 mask, iput(args->h_child_inode); iput(args->h_dir); iput(args->dir); - kfree(args); + au_delayed_kfree(args); } out: @@ -666,17 +666,26 @@ void au_hnotify_fin_br(struct au_branch *br) static void au_hn_destroy_cache(void) { - kmem_cache_destroy(au_cachep[AuCache_HNOTIFY]); - au_cachep[AuCache_HNOTIFY] = NULL; + struct au_cache *cp; + + flush_delayed_work(&au_dfree.dwork); + cp = au_dfree.cache + AuCache_HNOTIFY; + AuDebugOn(!llist_empty(&cp->llist)); + kmem_cache_destroy(cp->cache); + cp->cache = NULL; } +AU_CACHE_DFREE_FUNC(hnotify, HNOTIFY, hn_lnode); + int __init au_hnotify_init(void) { int err; + struct au_cache *cp; err = -ENOMEM; - au_cachep[AuCache_HNOTIFY] = AuCache(au_hnotify); - if (au_cachep[AuCache_HNOTIFY]) { + cp = au_dfree.cache + AuCache_HNOTIFY; + cp->cache = AuCache(au_hnotify); + if (cp->cache) { err = 0; if (au_hnotify_op.init) err = au_hnotify_op.init(); @@ -689,9 +698,13 @@ int __init au_hnotify_init(void) void au_hnotify_fin(void) { + struct au_cache *cp; + if (au_hnotify_op.fin) au_hnotify_op.fin(); + /* cf. au_cache_fin() */ - if (au_cachep[AuCache_HNOTIFY]) + cp = au_dfree.cache + AuCache_HNOTIFY; + if (cp->cache) au_hn_destroy_cache(); } -- cgit v1.2.3-54-g00ecf