EXPORTFS: handle NULL returns from fh_to_dentry()/fh_to_parent()

While 440037287c5 "[PATCH] switch all filesystems over to
d_obtain_alias" removed some cases where fh_to_dentry() and
fh_to_parent() could return NULL, there are still a few NULL returns
left in individual filesystems. Thus it was a mistake for that commit
to remove the handling of NULL returns in the callers.

Revert those parts of 440037287c5 which removed the NULL handling.

(We could, alternatively, modify all implementations to return -ESTALE
instead of NULL, but that proves to require fixing a number of
filesystems, and in some cases it's arguably more natural to return
NULL.)

Thanks to David for original patch and Linus, Christoph, and Hugh for
review.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Cc: David Howells <dhowells@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by J. Bruce Fields and committed by Linus Torvalds a4f4d6df 218d11a8

+4
+4
fs/exportfs/expfs.c
··· 367 367 * Try to get any dentry for the given file handle from the filesystem. 368 368 */ 369 369 result = nop->fh_to_dentry(mnt->mnt_sb, fid, fh_len, fileid_type); 370 + if (!result) 371 + result = ERR_PTR(-ESTALE); 370 372 if (IS_ERR(result)) 371 373 return result; 372 374 ··· 422 420 423 421 target_dir = nop->fh_to_parent(mnt->mnt_sb, fid, 424 422 fh_len, fileid_type); 423 + if (!target_dir) 424 + goto err_result; 425 425 err = PTR_ERR(target_dir); 426 426 if (IS_ERR(target_dir)) 427 427 goto err_result;