>=linux-6.6.0: Resource temporarily unavailable when reading file attributes the first time

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



linux writes via Kernel.org Bugzilla:

Description
-----------
When a file is written via nfs, calling lsattr on it on the server side fails with:
Resource temporarily unavailable While reading flags from <filename>

This only happens the first time.
The error first appeared in kernel version 6.0.0.


I bisected the issue to this commit

commit 1d3dd1d56ce8322fb5b2a143ec9ff38c703bfeda
Author: Dai Ngo <dai.ngo@xxxxxxxxxx>
Date:   Thu Jun 29 18:52:40 2023 -0700

    NFSD: Enable write delegation support
    
    This patch grants write delegations for OPEN with NFS4_SHARE_ACCESS_WRITE
    if there is no conflict with other OPENs.
    
    Write delegation conflicts with another OPEN, REMOVE, RENAME and SETATTR
    are handled the same as read delegation using notify_change,
    try_break_deleg.
    
    The NFSv4.0 protocol does not enable a server to determine that a
    conflicting GETATTR originated from the client holding the
    delegation versus coming from some other client. With NFSv4.1 and
    later, the SEQUENCE operation that begins each COMPOUND contains a
    client ID, so delegation recall can be safely squelched in this case.
    
    With NFSv4.0, however, the server must recall or send a CB_GETATTR
    (per RFC 7530 Section 16.7.5) even when the GETATTR originates from
    the client holding that delegation.
    
    An NFSv4.0 client can trigger a pathological situation if it always
    sends a DELEGRETURN preceded by a conflicting GETATTR in the same
    COMPOUND. COMPOUND execution will always stop at the GETATTR and the
    DELEGRETURN will never get executed. The server eventually revokes
    the delegation, which can result in loss of open or lock state.
    
    Tracepoint added to track whether read or write delegation is granted.
    
    Signed-off-by: Dai Ngo <dai.ngo@xxxxxxxxxx>
    Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx>
    Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>

 fs/nfsd/nfs4state.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------
 fs/nfsd/trace.h     |  1 +
 2 files changed, 78 insertions(+), 20 deletions(-)


Steps to reproduce
------------------
# mkdir -p test/{shared,local}
# cd /mnt/test/local
# python test.py; lsattr -l testfile; lsattr -l testfile;

/etc/exports
----------------------------------------------------------------------
/mnt/test/local 127.0.0.1(rw,no_subtree_check,crossmnt,no_root_squash)
----------------------------------------------------------------------

/etc/fstab
---------------------------------------------------------------------
localhost:/mnt/test/local   /mnt/test/shared  nfs   rw,noatime   0 0
---------------------------------------------------------------------

/mnt/test/local/test.py
--------------------------------------------------------------------------
import os
fd = os.open("/mnt/test/shared/testfile", os.O_CREAT | os.O_EXCL | os.O_RDWR)
os.close(fd)
--------------------------------------------------------------------------


Actual result
-------------
lsattr: Resource temporarily unavailable While reading flags from testfile
testfile    Extents


Expected result
---------------
testfile    Extents
testfile    Extents


Background
----------
I am using certbot to receive letsencrypt certificates. The certbot service runs on a different host than the webserver that is used. Certbot uses nfs to write the challenge files to the webserver. The code is very similar to the one in the provided test.py. When letsencrypt tries to verify, the operation fails because the webserver receives 'Resource not available' when trying to read the file.

View: https://bugzilla.kernel.org/show_bug.cgi?id=219278#c0
You can reply to this message to join the discussion.
-- 
Deet-doot-dot, I am a bot.
Kernel.org Bugzilla (bugspray 0.1-dev)





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux