Files
linux/include/linux
Mike Snitzer ead11ac50a nfs: fix incorrect error handling in LOCALIO
nfs4_stat_to_errno() expects a NFSv4 error code as an argument and
returns a POSIX errno.

The problem is LOCALIO is passing nfs4_stat_to_errno() the POSIX errno
return values from filp->f_op->read_iter(), filp->f_op->write_iter()
and vfs_fsync_range().

So the POSIX errno that nfs_local_pgio_done() and
nfs_local_commit_done() are passing to nfs4_stat_to_errno() are
failing to match any NFSv4 error code, which results in
nfs4_stat_to_errno() defaulting to returning -EREMOTEIO. This causes
assertions in upper layers due to -EREMOTEIO not being a valid NFSv4
error code.

Fix this by updating nfs_local_pgio_done() and nfs_local_commit_done()
to use the new nfs_localio_errno_to_nfs4_stat() to map a POSIX errno
to an NFSv4 error code.

Care was taken to factor out nfs4_errtbl_common[] to avoid duplicating
the same NFS error to errno table. nfs4_errtbl_common[] is checked
first by both nfs4_stat_to_errno and nfs_localio_errno_to_nfs4_stat
before they check their own more specialized tables (nfs4_errtbl[] and
nfs4_errtbl_localio[] respectively).

While auditing the associated error mapping tables, the (ab)use of -1
for the last table entry was removed in favor of using ARRAY_SIZE to
iterate the nfs_errtbl[] and nfs4_errtbl[]. And 'errno_NFSERR_IO' was
removed because it caused needless obfuscation.

Fixes: 70ba381e1a ("nfs: add LOCALIO support")
Reported-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
2025-01-21 11:34:43 -05:00
..
2024-10-22 15:54:11 +02:00
2024-10-11 14:34:11 -04:00
2024-10-13 17:16:57 +02:00
2024-04-24 11:06:26 -07:00
2024-04-25 20:55:49 -07:00
2024-10-11 14:37:29 +05:30
2024-10-14 23:27:57 +05:30
2024-11-11 10:45:03 +01:00
2024-10-09 15:42:48 +01:00
2024-08-28 06:53:58 -07:00
2024-11-07 14:38:07 -08:00
2024-10-14 18:33:04 -07:00
2024-07-08 01:51:05 -06:00
2024-09-03 21:15:36 -07:00
2024-06-24 18:29:20 +02:00
2024-04-23 09:03:37 +09:00
2024-06-11 12:57:49 -05:00
2024-11-05 13:32:21 +01:00
2024-10-22 11:16:56 +02:00
2024-10-19 14:16:45 +02:00
2024-10-01 17:01:40 +02:00
2024-05-19 14:36:17 -07:00
2024-11-09 14:55:33 +01:00
2024-11-28 14:49:28 +01:00
2024-08-29 10:39:37 +02:00
2024-11-24 17:05:27 -08:00
2024-07-31 13:49:48 +01:00
2024-08-08 17:15:02 +02:00
2024-10-16 21:56:59 +02:00
2024-06-24 22:24:56 -07:00
2024-10-30 19:47:20 +01:00
2024-09-03 21:15:46 -07:00
2024-09-20 18:28:26 +03:00
2024-09-01 20:26:03 -07:00
2024-11-05 16:56:26 -08:00
2024-07-03 19:30:23 -07:00
2024-10-14 16:33:24 -05:00
2024-08-11 17:04:29 +01:00
2024-07-31 09:57:18 -07:00
2025-01-09 16:58:50 +01:00
2024-07-28 16:47:51 -06:00
2024-09-23 15:03:30 -04:00
2024-06-24 22:25:02 -07:00
2024-11-05 16:56:26 -08:00
2024-03-26 11:07:20 -07:00
2024-08-30 08:22:38 +02:00
2024-11-16 10:09:30 -06:00
2024-10-02 16:23:10 -05:00
2025-01-10 11:59:00 +01:00
2024-11-05 12:55:38 +01:00
2024-04-02 18:03:32 -07:00
2024-04-09 10:53:44 +02:00
2024-09-11 20:44:31 -07:00
2024-09-11 20:44:32 -07:00
2024-05-04 18:57:21 +02:00
2024-11-30 22:41:35 -05:00
2024-11-11 00:26:44 -08:00
2024-07-10 07:59:03 +02:00
2024-11-06 12:59:44 -05:00
2024-10-02 16:53:38 +02:00
2024-05-06 12:05:00 +02:00
2024-08-06 13:42:40 +02:00
2024-11-18 11:56:21 +00:00
2024-09-12 12:20:39 +02:00
2024-06-24 18:16:44 +01:00
2024-11-06 12:59:44 -05:00
2024-04-25 20:55:48 -07:00