Hello Ubuntu Kernel Team,

I am following up on LP #2173036 to report an additional user-visible
correctness issue involving RPCSEC_GSS context expiry.

An NFSv4.0 operation can complete successfully on the server but return
ENOENT or EEXIST to the application when the client retries the same
operation with a new RPC XID after receiving the original reply.

*1. Tested kernel versions*

I reproduced this issue in two kernel configurations using isolated QEMU
client/server VMs.

*A. Upstream Linux v7.4-rc3*

   -

   Source tag: v7.4-rc3
   -

   Exact commit: aebb7274476403040d582c61478df8f4a7bf9cd3
   -

   Both client and server ran the unmodified upstream 7.4.0-rc3 kernel.
   -

   This version already includes commit 9b62ef6d239e ("SUNRPC: fix handling
   expired GSS context").

*B. Ubuntu 22.04 HWE kernel with the upstream GSS fix backported*

   -

   Source package: linux-hwe-6.8
   -

   Source version: 6.8.0-149.149~22.04.1
   -

   Applied upstream commit: 9b62ef6d239e ("SUNRPC: fix handling expired GSS
   context").
   -

   Both client and server ran the same locally built kernel containing this
   backport.

No other corrective changes were applied to either baseline.

*2. Observed behavior*

A TCP proxy held an already-generated successful server reply until after
the client's original RPCSEC_GSS context had expired.

The following sequence was observed:

   1.

   The application issued one target syscall, such as renameat().
   2.

   The server successfully executed the original operation (XID A) and
   generated its reply.
   3.

   The client received the delayed reply after context expiry and matched
   it to XID A.
   4.

   The client entered the rpc__stale_creds path and retried the same
   operation using a new XID B.
   5.

   On NFSv4.0, the server executed the target operation again.
   6.

   The application received the error from the second execution, even
   though the original operation had already succeeded.

The problem is therefore not a failure to execute the original operation,
but an incorrect application-visible result caused by retrying an already
completed operation.

*3. Reproduction results*

For both kernel configurations, we conducted 20 expiry trials for each
combination of NFS version, RPCSEC_GSS security mode (krb5, krb5i, and
krb5p), and operation (RENAME, REMOVE, MKDIR, READ, and WRITE).

The following table summarizes the NFSv4.0 results. Each operation was
tested 60 times per kernel configuration (20 trials × 3 security modes).
Operation Upstream v7.4-rc3 (krb5/i/p) Ubuntu HWE + backport
(krb5/i/p) Application
result
RENAME 60/60 retried 60/60 retried ENOENT
REMOVE 60/60 retried 60/60 retried ENOENT
MKDIR 60/60 retried 60/60 retried EEXIST
READ 60/60 retried 60/60 retried Success
WRITE 60/60 retried 60/60 retried Success

Across both kernel configurations, NFSv4.0 returned incorrect ENOENT or
EEXIST errors in all 180/180 RENAME, REMOVE, and MKDIR expiry trials per
kernel, despite successful execution of the original operations. READ and
WRITE were also re-executed but completed successfully (120/120 per kernel).

In contrast, NFSv4.1 and NFSv4.2 completed all 300/300 expiry trials per
minor version and kernel successfully, with no duplicate execution of
RENAME, REMOVE, or MKDIR observed in the server traces, consistent with
session-based reply replay.

*4. Representative NFSv4.0 RENAME failures*

*Upstream v7.4-rc3*

   -

   Original XID A: 0xc3c8024a — OP_RENAME returned NFS4_OK (0).
   -

   Retry XID B: 0xc4c8024a — OP_RENAME returned NFS4ERR_NOENT (2).
   -

   Application: one renameat() returned -1 ENOENT.

*Ubuntu HWE with commit 9b62ef6d239e backported*

   -

   Original XID A: 0xa724ed94 — OP_RENAME returned NFS4_OK (0).
   -

   Retry XID B: 0xa824ed94 — OP_RENAME returned NFS4ERR_NOENT (2).
   -

   Application: one renameat() returned -1 ENOENT.

In both cases, the server filesystem confirmed that the source no longer
existed and the destination retained the original source file, with
matching inode and SHA-256.

The application-visible errno therefore reflected the retried operation
rather than the successful original request.

For tracepoint precision, the native nfsd_compound event contains an XID,
whereas nfsd_compound_status does not. The XID-to-operation-status
associations above were obtained by correlating server events and decoded
RPC replies.

*5. Question*

Could you advise whether this correctness issue should be tracked
separately from the original hang in LP #2173036?

Thank you for your time and consideration.

Best regards,

Junyoung Im
M.S. Student
Department of Computer Science and Artificial Intelligence
Dongguk University
Seoul, Republic of Korea

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2173036

Title:
  Tasks can hang forever when using NFSv4 with the sec=krb5 mount option

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2173036/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to