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

libcephfs: introduce libcephfs *at() APIs #40810

Merged
merged 5 commits into from
Apr 27, 2021

Conversation

vshankar
Copy link
Contributor

Checklist

  • References tracker ticket
  • Updates documentation if necessary
  • Includes tests for new functionality or reproducer for bug

Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@vshankar vshankar added the cephfs Ceph File System label Apr 12, 2021
@github-actions github-actions bot added the tests label Apr 12, 2021
@vshankar vshankar mentioned this pull request Apr 13, 2021
3 tasks
@vshankar vshankar requested review from a team, batrick and jtlayton April 13, 2021 06:52
@jtlayton
Copy link
Contributor

Do we really need this? We have the ceph_ll_* apis already, and you can pretty much do the same thing as the *_at apis with it by taking an Inode reference of the parent (either with or without holding open a fd).

@vshankar
Copy link
Contributor Author

Do we really need this? We have the ceph_ll_* apis already, and you can pretty much do the same thing as the *_at apis with it by taking an Inode reference of the parent (either with or without holding open a fd).

I haven't closely looked at the *_ll APIs, but they provide a low-level interface. I would be a bit weird to use them from an application POV and have to deal with Inode * stuff and the likes. Wouldn't it be beneficial to havelibcephfs users deal with normal file system paths and use *at APIs if needed?

@jtlayton
Copy link
Contributor

It depends on the application. ganesha uses the *_ll APIs just fine. What applications do you expect to use these?

My main worry is that adding so many interfaces to libcephfs will become a maintenance burden. It's also hard to remove interfaces later, once they proliferate out into the field, so we want to make sure that we're only adding things that we think applications need and will use.

@mattbenjamin
Copy link
Contributor

I guess I'm with Jeff. I don't understand the motivation to avoid handles, in general. The "low level" methods were needed to make libcephfs actually useful to protocol translators. It's less clear how important it is for the library to cater to programmers who cannot understand the concept of a handle.

@vshankar
Copy link
Contributor Author

It depends on the application. ganesha uses the *_ll APIs just fine. What applications do you expect to use these?

cephfs mirror daemon.

@mattbenjamin
Copy link
Contributor

It depends on the application. ganesha uses the *_ll APIs just fine. What applications do you expect to use these?

cephfs mirror daemon.

I would have thought that the cephfs mirror daemon would be able to use ll apis. As Jeff said, the ganesha "fsal" driver has used them since 2011 or something.

Matt

@vshankar
Copy link
Contributor Author

I would have thought that the cephfs mirror daemon would be able to use ll apis. As Jeff said, the ganesha "fsal" driver has used them since 2011 or something.

It obviously can use *_ll APIs. However, I do not expect other users of this library to switch using low-level interfaces for things like these.

@phlogistonjohn
Copy link
Contributor

In the go-ceph project we have (partial) coverage of the high level apis but none of the low-level apis, so having *at functions could give some pretty good benefits without having to understand all the details that the lowlevel api might bring. The high level apis are also a very close translation of the typical file systems api calls and thus you can often do use the docs for those calls to help understand the libcephfs apis.

I have personally been hesitant to jump into the low level api for go-ceph... as compared to the pretty good doxygen comments for the high level api the low level apis are more sparsely documented (at least I haven't found much on it). While its certainly not insurmountable, there's stuff like ceph_ll_lookup ceph_ll_put ceph_ll_forget ceph_ll_close and ceph_ll_iclose that don't have an immediate analogue and would take more extensive understanding on our part. And even then, even if we wrapped those calls our users would need to understand when and how to use them.

@batrick
Copy link
Member

batrick commented Apr 13, 2021

I'm against proliferating the low-level API any further than we already have. It started out as a hack for ceph-fuse without a lot of thought into its appropriateness for other use-cases. I don't want to increase dependencies on it.

The *at syscalls are common and standard. This PR shows it's not a stretch to add it to libcephfs -- the changeset is fairly minimal and mostly an exercise in wiring things up. I like this change overall.

@mattbenjamin
Copy link
Contributor

The "low level" api calls are somewhat similar to VFS in general, and there are extensions for NFS. While the ll calls do look hacky, the motivations for them were valid. Programs like NFS-Ganesha shouldn't be restricted to a POSIX interface when there's no strong motivation for doing that.

src/client/Client.cc Outdated Show resolved Hide resolved
src/client/Client.cc Outdated Show resolved Hide resolved
src/client/Client.cc Outdated Show resolved Hide resolved
src/client/Client.cc Show resolved Hide resolved
src/client/Client.cc Outdated Show resolved Hide resolved
src/client/Client.cc Outdated Show resolved Hide resolved
src/client/Client.cc Outdated Show resolved Hide resolved
src/client/Client.cc Show resolved Hide resolved
src/client/Client.cc Show resolved Hide resolved
src/client/Client.cc Outdated Show resolved Hide resolved
@jtlayton
Copy link
Contributor

Fair enough. If you guys feel it's worth it to duplicate this functionality, then so be it. I won't stand in the way of it.

@vshankar vshankar changed the title [RFC]: introduce libcephfs *at() APIs libcephfs: introduce libcephfs *at() APIs Apr 20, 2021
src/client/Client.h Outdated Show resolved Hide resolved
src/client/Client.h Show resolved Hide resolved
src/include/cephfs/libcephfs.h Outdated Show resolved Hide resolved
src/client/Client.h Outdated Show resolved Hide resolved
@vshankar
Copy link
Contributor Author

@batrick fixed and updated

No need to include this check since _getattr() checks this anyway.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Other tests might use the same file names and expect libcephfs
calls to succeed.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
Fixes: http://tracker.ceph.com/issues/50298
Signed-off-by: Venky Shankar <vshankar@redhat.com>
@vshankar
Copy link
Contributor Author

fixed and updated

@batrick
Copy link
Member

batrick commented Apr 26, 2021

jenkins test make check

@vshankar
Copy link
Contributor Author

jenkins test make check

@batrick batrick merged commit eb0fdad into ceph:master Apr 27, 2021
@tchaikov
Copy link
Contributor

@vshankar @batrick @petrutlucian94 please note this change breaks the windows build.

../src/client/Client.cc: In member function 'int Client::unlinkat(int, const char*, int, const UserPerm&)':
../src/client/Client.cc:7097:20: error: 'AT_REMOVEDIR' was not declared in this scope
 7097 |     return flags & AT_REMOVEDIR ? -CEPHFS_EBUSY : -CEPHFS_EISDIR;
      |                    ^~~~~~~~~~~~

see https://jenkins.ceph.com/job/ceph-dev-new-build/ARCH=x86_64,AVAILABLE_ARCH=x86_64,AVAILABLE_DIST=windows,DIST=windows,MACHINE_SIZE=gigantic/54101//consoleFull

@vshankar
Copy link
Contributor Author

@vshankar @batrick @petrutlucian94 please note this change breaks the windows build.

../src/client/Client.cc: In member function 'int Client::unlinkat(int, const char*, int, const UserPerm&)':
../src/client/Client.cc:7097:20: error: 'AT_REMOVEDIR' was not declared in this scope
 7097 |     return flags & AT_REMOVEDIR ? -CEPHFS_EBUSY : -CEPHFS_EISDIR;
      |                    ^~~~~~~~~~~~

Thanks @tchaikov. We probably need (from include/uapi/linux/fcntl.h):

#define AT_REMOVEDIR            0x200   /* Remove directory instead of
                                           unlinking file.  */

@petrutlucian94 ?

@petrutlucian94
Copy link
Contributor

@vshankar right, I suggest defining it here, next to AT_SYMLINK_NOFOLLOW: https://github.com/ceph/ceph/blob/master/src/include/win32/fs_compat.h#L33

@tchaikov thanks for keeping an eye on the Windows build.

@tchaikov
Copy link
Contributor

@vshankar @petrutlucian94 mind creating a fix?

@vshankar
Copy link
Contributor Author

@vshankar @petrutlucian94 mind creating a fix?

I'm on it.

petrutlucian94 added a commit to petrutlucian94/ceph that referenced this pull request Apr 28, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph#40810
@petrutlucian94
Copy link
Contributor

@vshankar @tchaikov I've submitted a PR here: #41064.

Sorry, haven't noticed that this one was already merged.

petrutlucian94 added a commit to petrutlucian94/ceph that referenced this pull request Apr 28, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph#40810

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
batrick pushed a commit to batrick/ceph that referenced this pull request May 21, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph#40810

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4aab6e3)
vshankar pushed a commit to vshankar/ceph that referenced this pull request May 21, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph#40810

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4aab6e3)
vshankar pushed a commit to vshankar/ceph that referenced this pull request May 21, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph#40810

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4aab6e3)
vshankar pushed a commit to ceph/ceph-ci that referenced this pull request May 22, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph/ceph#40810

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4aab6e3)
vshankar pushed a commit to ceph/ceph-ci that referenced this pull request May 25, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph/ceph#40810

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4aab6e3)
vshankar pushed a commit to ceph/ceph-ci that referenced this pull request May 27, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph/ceph#40810

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4aab6e3)
vshankar pushed a commit to ceph/ceph-ci that referenced this pull request Jun 7, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph/ceph#40810

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4aab6e3)
nizamial09 pushed a commit to rhcs-dashboard/ceph that referenced this pull request Jun 11, 2021
The AT_REMOVEDIR flag is used by a recent change [1] but isn't
defined on Windows.

This commit will add the missing definition. Note that it won't be
passed to OS functions, only being used at the CephFS level.

[1] ceph#40810

Resolves: rhbz#1956341

Signed-off-by: Lucian Petrut <lpetrut@cloudbasesolutions.com>
(cherry picked from commit 4aab6e3)
(cherry picked from commit 62c91a3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants