Skip to content

Commit 48b7773

Browse files
committed
expfs: Fix exportfs_can_encode_fh() for EXPORT_FH_FID
After commit 5402c4d ("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: 5402c4d ("exportfs: require ->fh_to_parent() to encode connectable file handles") Reviewed-by: Christian Brauner <[email protected]> Reviewed-by: Amir Goldstein <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent fd94619 commit 48b7773

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/linux/exportfs.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,16 +320,17 @@ static inline bool exportfs_can_decode_fh(const struct export_operations *nop)
320320
static inline bool exportfs_can_encode_fh(const struct export_operations *nop,
321321
int fh_flags)
322322
{
323-
if (!nop)
324-
return false;
325-
326323
/*
327324
* If a non-decodeable file handle was requested, we only need to make
328325
* sure that filesystem did not opt-out of encoding fid.
329326
*/
330327
if (fh_flags & EXPORT_FH_FID)
331328
return exportfs_can_encode_fid(nop);
332329

330+
/* Normal file handles cannot be created without export ops */
331+
if (!nop)
332+
return false;
333+
333334
/*
334335
* If a connectable file handle was requested, we need to make sure that
335336
* filesystem can also decode connected file handles.

0 commit comments

Comments
 (0)