hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/fs/nfsd/nfsfh.c
....@@ -14,6 +14,7 @@
1414 #include "nfsd.h"
1515 #include "vfs.h"
1616 #include "auth.h"
17
+#include "trace.h"
1718
1819 #define NFSDDBG_FACILITY NFSDDBG_FH
1920
....@@ -209,11 +210,14 @@
209210 }
210211
211212 error = nfserr_stale;
212
- if (PTR_ERR(exp) == -ENOENT)
213
- return error;
213
+ if (IS_ERR(exp)) {
214
+ trace_nfsd_set_fh_dentry_badexport(rqstp, fhp, PTR_ERR(exp));
214215
215
- if (IS_ERR(exp))
216
+ if (PTR_ERR(exp) == -ENOENT)
217
+ return error;
218
+
216219 return nfserrno(PTR_ERR(exp));
220
+ }
217221
218222 if (exp->ex_flags & NFSEXP_NOSUBTREECHECK) {
219223 /* Elevate privileges so that the lack of 'r' or 'x'
....@@ -267,6 +271,9 @@
267271 dentry = exportfs_decode_fh(exp->ex_path.mnt, fid,
268272 data_left, fileid_type,
269273 nfsd_acceptable, exp);
274
+ if (IS_ERR_OR_NULL(dentry))
275
+ trace_nfsd_set_fh_dentry_badhandle(rqstp, fhp,
276
+ dentry ? PTR_ERR(dentry) : -ESTALE);
270277 }
271278 if (dentry == NULL)
272279 goto out;
....@@ -452,7 +459,7 @@
452459 case FSID_DEV:
453460 if (!old_valid_dev(exp_sb(exp)->s_dev))
454461 return false;
455
- /* FALL THROUGH */
462
+ fallthrough;
456463 case FSID_MAJOR_MINOR:
457464 case FSID_ENCODE_DEV:
458465 return exp_sb(exp)->s_type->fs_flags & FS_REQUIRES_DEV;
....@@ -462,7 +469,7 @@
462469 case FSID_UUID16:
463470 if (!is_root_export(exp))
464471 return false;
465
- /* fall through */
472
+ fallthrough;
466473 case FSID_UUID4_INUM:
467474 case FSID_UUID16_INUM:
468475 return exp->ex_uuid != NULL;