]> git.baikalelectronics.ru Git - kernel.git/commit
ceph: fix iput race when queueing inode work
authorSage Weil <sage@newdream.net>
Sun, 6 Nov 2011 05:06:31 +0000 (22:06 -0700)
committerSage Weil <sage@newdream.net>
Sun, 6 Nov 2011 05:06:31 +0000 (22:06 -0700)
commit547ef1e649c5b997d5d35fcaa0498a783c4d785f
treef902cc2b7cab475c8b220147bb786dc3a772888e
parent31e0be275937a6117689787ba390c12413c5d2e9
ceph: fix iput race when queueing inode work

If we queue a work item that calls iput(), make sure we ihold() before
attempting to queue work. Otherwise our queued work might miraculously run
before we notice the queue_work() succeeded and call ihold(), allowing the
inode to be destroyed.

That is, instead of

if (queue_work(...))
ihold();

we need to do

ihold();
if (!queue_work(...))
iput();

Reported-by: Amon Ott <a.ott@m-privacy.de>
Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/inode.c