Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide open and close callbacks to virtual filesystem implementation… #91

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dkocher
Copy link
Contributor

@dkocher dkocher commented May 25, 2020

…s as described in #38.

Signed-off-by: David Kocher dkocher@iterate.ch

@dcache-ci
Copy link

Can one of the admins verify this patch?

@kofemann
Copy link
Member

ok to test

…s as described in dCache#38.

Signed-off-by: David Kocher <dkocher@iterate.ch>
Copy link
Member

@kofemann kofemann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was trying to do something similar, but at the end decided against it. It's not symmetric, e.q. the some calls accept stateid and have a undefined behavior. Have a look at https://github.com/dCache/nfs4j/blob/master/core/src/main/java/org/dcache/nfs/v4/FileTracker.java. I think it's quite close to what you want to achieve.

@@ -47,6 +47,7 @@ public void process(CompoundContext context, nfs_resop4 result)
Inode inode = context.currentInode();

stateid4 stateid = Stateids.getCurrentStateidIfNeeded(context, _args.opclose.open_stateid);
context.getFs().close(inode, stateid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can trigger false evens it client tries to close invalid inode or stateid. I think this should be bound to state disposal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. We have worked around this by tracking the stateid in the virtual filesystem implementation.

@@ -206,6 +206,7 @@ public void process(CompoundContext context, nfs_resop4 result) throws ChimeraNF
}

context.currentInode(inode);
context.getFs().open(inode, this.getAccessMode(_args.opopen.share_access), result.opopen.resok4.stateid);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you will mess all opens by file handle, which is quite common, when client already got hanlde by previous readdir, lookup or open.

@dkocher
Copy link
Contributor Author

dkocher commented May 26, 2020

FileTracker looks great but we need to intercept open of file handles to deny if the file is supposed to be locked to trigger appropriate error messages in applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants