Skip to contentSkip to conversation

expfs: Fix exportfs_can_encode_fh() for EXPORT_FH_FID

PATCH In review Jan Kara 3 participants 4 messages Oct 1, 2025 – Oct 6, 2025

Subsystems (2)
lore
Share & tools
lore

Jan Kara

author reviewer
#0 lore raw

PATCH 1/1 expfs: Fix exportfs_can_encode_fh() for EXPORT_FH_FID

After commit 5402c4d4d200 ("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 5402c4d4d200 ("exportfs: require ->fh_to_parent() to encode connectable file handles")
---
 include/linux/exportfs.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
include/linux/exportfs.h +4 -3
index cfb0dd1ea49c..b80286a73d0a 100644
@@ -314,9 +314,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.
@@ -324,6 +321,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.
Signature · 1 line
2.51.0
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Jan Kara

After commit 5402c4d4d200 ("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 5402c4d4d200 ("exportfs: require ->fh_to_parent() to encode connectable file handles")
Quoted 32 lines
---
 include/linux/exportfs.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
include/linux/exportfs.h +4 -4
index cfb0dd1ea49c..b80286a73d0a 100644
@@ -314,9 +314,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.
@@ -324,6 +321,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.
--

2.51.0

maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Kara
Quoted 7 lines · Jan Kara

After commit 5402c4d4d200 ("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 5402c4d4d200 ("exportfs: require ->fh_to_parent() to encode connectable file handles")

---

author reviewer
#3 lore raw
Quoted 10 lines · Christian Brauner
Quoted 7 lines · Jan Kara

After commit 5402c4d4d200 ("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 5402c4d4d200 ("exportfs: require ->fh_to_parent() to encode connectable file handles")

---

Thanks! I've queued the patch into my tree.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR