NFS: remove BUG possibility in nfs4_open_and_get_state
NFS: remove BUG possibility in nfs4_open_and_get_state

commit 4fa2c54b5198d09607a534e2fd436581064587ed
    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 <923f7720577207a44b32e59bbfbea59d27f1ae8e@infradead.org>
Fixes: 4fa2c54b5198d09607a534e2fd436581064587ed
Cc: Jeff Layton <542dfe392278ff3cf017aafde9d989e8068d5c3e@primarydata.com>
Link: 4a5117ab21eb5c735b2e03d2dce199e150aad5d3@infradead.org
Signed-off-by: NeilBrown <1c00aa603bb92d594c03cff60ecf8e63b2a5bcb1@suse.de>
Acked-by: Jeff Layton <4376fbf8623cd7b7c0232225289bb91cedc0a27f@primarydata.com>
Signed-off-by: Trond Myklebust <cc958843532c615cbd4920e868f78c7985331a5a@primarydata.com>

KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs,KristFoundation/Programs