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

Decide what to do with the XrdCl::OpenFlags::Append flag #1126

Closed
murrayc3 opened this issue Jan 28, 2020 · 8 comments
Closed

Decide what to do with the XrdCl::OpenFlags::Append flag #1126

murrayc3 opened this issue Jan 28, 2020 · 8 comments
Assignees
Labels
Documentation Issue Missing or incorrect documentation

Comments

@murrayc3
Copy link
Contributor

The XrdCl::OpenFlags::Append flag is part of the XRootD client API. The flag is mapped to the kXR_open_apnd constant of the XRootD protocol. However the flag is not mapped and passed to the XrdSfsFile::open() method of the XRootD server API.

Please could the XrdCl::OpenFlags::Append flag either be completely removed from the XRootD client API or could the XRootD server map kXR_open_apnd to a dedicated server side flag and pass it through to the XrdSfsFile::open() method?

This issue is being created due to the following incident which uncovered the fact that the XRootD server does not pass kXR_open_apnd through to XrdSfsFile::open(). A client contacted an XRootD server with an "open for append" request using the XrdCl::OpenFlags::Append flag. This request should have been considered an "open for write" however the server incorrectly interpreted it as an "open for read" because "#define SFS_O_RDONLY 0 // open read/only".

@murrayc3
Copy link
Contributor Author

To summarize the XRootD server currently has a bug because it converts an "open for append" request to an "open for read" request.

@abh3
Copy link
Member

abh3 commented Jan 28, 2020

Well, it depends on how you define "bug" :-) Historically, flags have been defined for future features to make sure other developers don't interfere by defining conflicting flags. Such is the distributed nature of the collaboration. The append flag falls into this category. The reaction of the server when you specify this flag is, in some sense, correct in that you will completely fail should you try to append. I suppose that may be confusing but at least you won't pollute any data. Asking that the server return "not supported" would only address XRootD-based implementation but not, for instance, dCache-based servers. I suppose, we could remove the flag from the client interface "hh" file but leave it defined in the private headers.

@murrayc3
Copy link
Contributor Author

Hi Andy, the problem is SFS_O_RDONLY = 0. When a "open for write" flag such as kXR_open_apnd is sent to an XRootD server it is translated to SFS_O_RDONLY. Here at CERN we are marking files within our tape backed directories as "NOT updateable". This is an EOS specific ACL. Such files should be read-only once they have been created. An "open for write" on such files including the use of the kXR_open_apnd flag should fail either with a permissions error or with a "not supported error". In order for us to detect kXR_open_apnd it must be passed through to XrdSfsFile::open() in some way. Ignoring it and passing SFS_O_RDONLY is not correct. Removing the kXR_open_apnd flag all together is another solution.

@abh3
Copy link
Member

abh3 commented Jan 30, 2020 via email

@murrayc3
Copy link
Contributor Author

Maybe rephrasing the problem to "The XRootD server is stripping out the kXR_open_apnd flag sent by the client so that the XrdSfsFile::open() never gets to see it".

@murrayc3
Copy link
Contributor Author

Looking at the following XRootD protocol code I can see that there is a protocol flag for each desired type of open including read:

[itctabuild02] xrdcl_tests (master) > vi /usr/include/xrootd/XProtocol/XProtocol.hh
...
enum XOpenRequestOption {
kXR_compress = 1, // also locate (return unique hosts)
kXR_delete = 2,
kXR_force = 4,
kXR_new = 8,
kXR_open_read= 16,
kXR_open_updt= 32,
kXR_async = 64,
kXR_refresh = 128, // also locate
kXR_mkpath = 256,
kXR_prefname = 256, // only locate
kXR_open_apnd= 512,
kXR_retstat = 1024,
kXR_replica = 2048,
kXR_posc = 4096,
kXR_nowait = 8192, // also locate
kXR_seqio =16384,
kXR_open_wrto=32768
};

In other words read on the wire is not represented by a 0 and from what I can tell 0 means nothing/none. Would you not be able to modify the XRootD server code to return an error to the client when there are leftover flags that its translation logic has not translated/consumed?

@abh3
Copy link
Member

abh3 commented Jan 30, 2020 via email

@abh3 abh3 added the Documentation Issue Missing or incorrect documentation label Feb 18, 2020
@abh3
Copy link
Member

abh3 commented Mar 31, 2020

The decision was to remove options that were not implemented.

@abh3 abh3 closed this as completed Mar 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issue Missing or incorrect documentation
Projects
None yet
Development

No branches or pull requests

3 participants