Re: [RFC PATCH] shrink_dcache_parent() deadlock

From: Al Viro
Date: Mon Jan 09 2012 - 16:27:11 EST


On Tue, Jan 10, 2012 at 07:59:07AM +1100, Dave Chinner wrote:
> > Comments?
>
> Looks OK to me.

OK, grabbed. And there's *more* fixes for obvious shite - by now I'm
really sick and tired of what people are doing with failure exits;
this morning catch just from looking through d_alloc_root() callers:
isofs - inode leak
ext4 - dentry leak + completely bogus handling of ext4_mb_init()
failure (stuff that hadn't been allocated gets freed, stuff that was
allocated isn't)
ceph - d_alloc_root() can fail. NULL pointer derefs galore...
)

Frankly, d_alloc_root() had been a bad API; it should've been doing
iput() on allocation failure. I've added a trivial helper in the
local tree (d_make_root(inode) - same as d_alloc_root(inode) and do
iput(inode) if result turns out to be NULL). Looks like *all* callers
of d_alloc_root() either turn out to be buggy or trivially convert to
d_make_root(). With a lot of boilerplate crap removed...

Hell knows... Originally I thought about leaving both side-by-side, but
it really starts looking as if there's no reason to keep d_alloc_root()
at all... I still have a couple of callers to check, though.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/