]> git.baikalelectronics.ru Git - kernel.git/commit
NFS: remove BUG possibility in nfs4_open_and_get_state
authorNeilBrown <neilb@suse.de>
Thu, 11 Sep 2014 06:19:37 +0000 (16:19 +1000)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 12 Sep 2014 17:10:53 +0000 (13:10 -0400)
commitd761687c5c644b10864cdf5767a65e171a4ba280
treef529a1bcb1a4c63d0396049e9444859dd3424fde
parent50758e3c3334d6753fc9aafbe9453d6293a017bc
NFS: remove BUG possibility in nfs4_open_and_get_state

commit a2572dd4a34b833f8e995c253e7e1038079e594e
    NFS: nfs4_do_open should add negative results to the dcache.

used "d_drop(); d_add();" to ensure that a dentry was hashed
as a negative cached entry.
This is not safe if the dentry has an non-NULL ->d_inode.
It will trigger a BUG_ON in d_instantiate().
In that case, d_delete() is needed.

Also, only d_add if the dentry is currently unhashed, it seems
pointless removed and re-adding it unchanged.

Reported-by: Christoph Hellwig <hch@infradead.org>
Fixes: a2572dd4a34b833f8e995c253e7e1038079e594e
Cc: Jeff Layton <jeff.layton@primarydata.com>
Link: http://lkml.kernel.org/r/20140908144525.GB19811@infradead.org
Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Jeff Layton <jlayton@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/nfs4proc.c