Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1224504
| From | green@linuxhacker.ru |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 13/19] staging/lustre/llite: ASSERTION( atomic_read(&d->ld_ref) == 0 ) failed |
| Date | 2015-09-15 00:50 +0200 |
| Message-ID | <q8KJs-36x-19@gated-at.bofh.it> (permalink) |
| References | <q8KJs-36x-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Andrew Perepechko <andrew.perepechko@seagate.com>
ll_iget_for_nfs() can call unbalanced iput() causing memory
leaks. This patch removes this iput() call.
Also, avoid unhashing disconnected dentries in
d_lustre_invalidate(), which is another source of memory
leaks.
One of the symptoms of the leak is the following crash pattern:
LustreError: 14812:0:(lu_object.c:1251:lu_device_fini())
ASSERTION( atomic_read(&d->ld_ref) == 0 ) failed: Refcount is 1
LustreError: 14812:0:(lu_object.c:1251:lu_device_fini()) LBUG
Pid: 14812, comm: umount
Call Trace:
[<ffffffffa11bc895>] libcfs_debug_dumpstack+0x55/0x80 [libcfs]
[<ffffffffa11bce97>] lbug_with_loc+0x47/0xb0 [libcfs]
[<ffffffffa1458a48>] lu_device_fini+0xb8/0xc0 [obdclass]
[<ffffffffa08e9ab2>] lovsub_device_free+0x52/0x220 [lov]
[<ffffffffa145c64e>] lu_stack_fini+0x7e/0xc0 [obdclass]
[<ffffffffa146356e>] cl_stack_fini+0xe/0x10 [obdclass]
[<ffffffffa08bc1a8>] lov_device_fini+0x58/0x120 [lov]
[<ffffffffa145c619>] lu_stack_fini+0x49/0xc0 [obdclass]
[<ffffffffa146356e>] cl_stack_fini+0xe/0x10 [obdclass]
[<ffffffffa0e1279d>] cl_sb_fini+0x6d/0x190 [lustre]
[<ffffffffa0dd34bc>] ll_put_super+0x1bc/0x11e0 [lustre]
[<ffffffff811cd0f2>] ? fsnotify_clear_marks_by_inode+0x32/0xf0
[<ffffffff811a59df>] ? destroy_inode+0x2f/0x60
[<ffffffff811a5eac>] ? dispose_list+0xfc/0x120
[<ffffffff811a62a6>] ? invalidate_inodes+0xf6/0x190
[<ffffffff8118b35b>] generic_shutdown_super+0x5b/0xe0
[<ffffffff8118b446>] kill_anon_super+0x16/0x60
[<ffffffffa144e7ba>] lustre_kill_super+0x4a/0x60 [obdclass]
[<ffffffff8118bbe7>] deactivate_super+0x57/0x80
[<ffffffff811aabef>] mntput_no_expire+0xbf/0x110
[<ffffffff811ab73b>] sys_umount+0x7b/0x3a0
[<ffffffff8100b072>] system_call_fastpath+0x16/0x1b
Signed-off-by: Andrew Perepechko <andrew.perepechko@seagate.com>
Reviewed-on: http://review.whamcloud.com/15480
Xyratex-bug-id: MRP-2414
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6794
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Reviewed-by: Bobi Jam <bobijam@hotmail.com>
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lustre/llite/llite_internal.h | 10 +++++++++-
drivers/staging/lustre/lustre/llite/llite_nfs.c | 5 +----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 8a3b03e..37bf331 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -1466,7 +1466,15 @@ static inline void d_lustre_invalidate(struct dentry *dentry, int nested)
spin_lock_nested(&dentry->d_lock,
nested ? DENTRY_D_LOCK_NESTED : DENTRY_D_LOCK_NORMAL);
__d_lustre_invalidate(dentry);
- if (d_count(dentry) == 0)
+ /*
+ * We should be careful about dentries created by d_obtain_alias().
+ * These dentries are not put in the dentry tree, instead they are
+ * linked to sb->s_anon through dentry->d_hash.
+ * shrink_dcache_for_umount() shrinks the tree and sb->s_anon list.
+ * If we unhashed such a dentry, unmount would not be able to find
+ * it and busy inodes would be reported.
+ */
+ if (d_count(dentry) == 0 && !(dentry->d_flags & DCACHE_DISCONNECTED))
__d_drop(dentry);
spin_unlock(&dentry->d_lock);
}
diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c
index 8d1c253..400acacc 100644
--- a/drivers/staging/lustre/lustre/llite/llite_nfs.c
+++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c
@@ -168,11 +168,8 @@ ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, struct lu_fid *paren
spin_unlock(&lli->lli_lock);
}
+ /* N.B. d_obtain_alias() drops inode ref on error */
result = d_obtain_alias(inode);
- if (IS_ERR(result)) {
- iput(inode);
- return result;
- }
return result;
}
--
2.1.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/19] Lustre fixes green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 05/19] staging/lustre/ptlrpc: remove LUSTRE_MSG_MAGIC_V1 support green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 13/19] staging/lustre/llite: ASSERTION( atomic_read(&d->ld_ref) == 0 ) failed green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 07/19] staging/lustre/llite: deny non-root user for changelog operations green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 15/19] staging/lustre: Remove unused MAY_ constants green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 14/19] staging/lustre/obdclass: Eliminate hash bucket scans in lu_cache_shrink green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 09/19] staging/lustre/osc: LBUG in osc_lru_reclaim green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 18/19] staging/lustre/libcfs: remove unused cfs_timer_done green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 02/19] staging/lustre/obdclass: reorganize busy object accounting green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 17/19] staging/lustre/o2iblnd: leak cmid in kiblnd_dev_need_failover green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 10/19] staging/lustre/libcfs: minor fix in cfs_hash_for_each_relax() green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 01/19] staging/lustre/lnet: Reenable lnet router debugfs green@linuxhacker.ru - 2015-09-15 00:50 +0200 [PATCH 16/19] staging/lustre/osc: use global osc_rq_pool to reduce memory usage green@linuxhacker.ru - 2015-09-15 00:50 +0200
csiph-web