Commit 48b77733 authored by Jan Kara's avatar Jan Kara
Browse files

expfs: Fix exportfs_can_encode_fh() for EXPORT_FH_FID



After commit 5402c4d4 ("exportfs: require ->fh_to_parent() to encode
connectable file handles") we will fail to create non-decodable file
handles for filesystems without export operations. Fix it.

Fixes: 5402c4d4 ("exportfs: require ->fh_to_parent() to encode connectable file handles")
Reviewed-by: default avatarChristian Brauner <brauner@kernel.org>
Reviewed-by: default avatarAmir Goldstein <amir73il@gmail.com>
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent fd94619c
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -320,9 +320,6 @@ static inline bool exportfs_can_decode_fh(const struct export_operations *nop)
static inline bool exportfs_can_encode_fh(const struct export_operations *nop,
					  int fh_flags)
{
	if (!nop)
		return false;

	/*
	 * If a non-decodeable file handle was requested, we only need to make
	 * sure that filesystem did not opt-out of encoding fid.
@@ -330,6 +327,10 @@ static inline bool exportfs_can_encode_fh(const struct export_operations *nop,
	if (fh_flags & EXPORT_FH_FID)
		return exportfs_can_encode_fid(nop);

	/* Normal file handles cannot be created without export ops */
	if (!nop)
		return false;

	/*
	 * If a connectable file handle was requested, we need to make sure that
	 * filesystem can also decode connected file handles.