Code Monkey home page Code Monkey logo

Comments (9)

kofemann avatar kofemann commented on July 17, 2024

I can reproduce the issue. The client/server interaction looks like:

 -> OPEN file1, open_owner1
 <- OPEN fh1, open_stateid1
 -> OPEN_CONFIRM open_stateid1
 <- OPEN_CONFIRM OK
 -> LOCK fh1, new lock owner: true, open_owner1, open_stateid1
 <- LOCK lock_stateid1
 -> LOCKU lock_stateid1
 <- LOCKU OK
 -> CLOSE fh1, open_stateid1
 <- CLOSE OK

so far so good. But then:

 -> OPEN file1, open_owner1
 <- OPEN fh1, open_stateid2
 -> OPEN_CONFIRM open_stateid2
 <- OPEN_CONFIRM OK
 -> LOCK fh1, new lock owner: false, lock_stateid1
 <- LOCK BAD_STATEID

capture file

IOW, client send second LOCK request, but uses lock_stateid1. My reading of https://tools.ietf.org/html/rfc7530#section-16.2.5 tells me, that CLOSE invalidates all locking stats, e.q. old lock_state1 is invalid.

I ask IETF-nfs4 working group to comment on it.

from nfs4j.

dkocher avatar dkocher commented on July 17, 2024

@kofemann Can I be of any help to advance the resolution of this issue?

from nfs4j.

kofemann avatar kofemann commented on July 17, 2024

@dkocher I have discussed the locking issue with NFS community and conclusion is that osx client is broken. However, I understand, that waiting for fix from apple is not an option. I will check how to a workaround to make osx client happy.

from nfs4j.

dkocher avatar dkocher commented on July 17, 2024

@kofemann Let me know if I can be of any help.

from nfs4j.

kofemann avatar kofemann commented on July 17, 2024

@dkocher Thanks for the offer. I need to find out a way how to keep expired lock-owners andl treat them as valid. This is orthogonal to the state handling implementation we have in place. But I did not forget this issue. Thinking some times takes longer time than implementing.....

from nfs4j.

kofemann avatar kofemann commented on July 17, 2024

@dkocher a shot update on this issue.

bad new: it looks like we can't fix it on the server side as by receiving invalid state id on lock
server has no sufficient information to 'guess' file's open state.

good news: looks like with latest osx update client recovers from the locking issue by itself. If re-sends open+lock with a new lock owner.

I have sent some traces and described the problem to apple. Let see what will happen.
here is a simple python code to trigger the error:

import sys
import os
import fcntl

if len(sys.argv) != 2:
  print('Usage: locktest <file>')
  sys.exit(1)

fname = sys.argv[1]  

f = os.open(fname, os.O_RDONLY)
fcntl.lockf(f, fcntl.LOCK_SH, 0, 100000000)
fcntl.lockf(f, fcntl.LOCK_UN, 0, 100000000)
os.close(f)

f = os.open(fname, os.O_RDONLY)
fcntl.lockf(f, fcntl.LOCK_SH, 0, 100000000)
fcntl.lockf(f, fcntl.LOCK_UN, 0, 100000000)
os.close(f)

from nfs4j.

dkocher avatar dkocher commented on July 17, 2024

This ist still a blocker issue. I have tested with macOS 10.13 and applications that depend on locks fail writing to the volume and do not recover.

Reverting aeb7544 would solve the error. Is there any option to introduce some compatibility mode (shudder)?

from nfs4j.

kofemann avatar kofemann commented on July 17, 2024

Well, technically, you suggest to keep old lock state-id around to identify lock owner by invalidated state-id. This will introduce state-id leak and eventually you will hit OOM.

Unfortunately osx developers completely ignore broken NFS client. As a workaround, we can put them into some-kind fixed size cache and remove them as needed. Ugly, but can work.

from nfs4j.

dkocher avatar dkocher commented on July 17, 2024

Even if fixed in later macOS versions we usually want to support two or more previous major versions. It would be awesome if you could introduce a map that is cleanup up using some deferred algorithm.

from nfs4j.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.