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: add ceph_fsetattr&&ceph_lchmod&&ceph_lutime #11191

Merged
merged 2 commits into from Oct 25, 2016

Conversation

renhwztetecs
Copy link
Contributor

export ceph_fsetattr() && ceph_lchmod() && ceph_lutime()

Signed-off-by: huanwen ren ren.huanwen@zte.com.cn

@jcsp
Copy link
Contributor

jcsp commented Sep 23, 2016

Can you comment on why lchmod is needed? It doesn't seem to part of e.g. Linux's file I/O implementation.

@jcsp
Copy link
Contributor

jcsp commented Sep 23, 2016

...and same question about lutime.

@renhwztetecs
Copy link
Contributor Author

@jcsp
my primitive idea,we can use lchmod &&lutime of user mode,not kernel mode.
:-)

@jcsp
Copy link
Contributor

jcsp commented Sep 26, 2016

Right, but ordinary applications presumably don't use calls like this, since they're not part of the usual Linux stdlib interface. So why does libcephfs need them?

@renhwztetecs
Copy link
Contributor Author

renhwztetecs commented Sep 26, 2016

forgive my ignorant and ill-informed, and I get it
thank you

I dropped ceph_lchmod() && ceph_lutime()

@ffilz
Copy link
Contributor

ffilz commented Sep 26, 2016

Hmm, would lchmod have allowed setting the mode of a symlink object rather than it's target? nfs-ganesha could actually use such a function, the NFS protocol allows setting attributes of symlink objects and freebsd at least supports lchmod so we could have clients trying it.

@renhwztetecs
Copy link
Contributor Author

@ffilz
thanks for your advices
ping @jcsp

@jcsp
Copy link
Contributor

jcsp commented Oct 14, 2016

Sorry for the delay. I'm okay with this now as the fsetattr is at least a normal function on some UNIX variants.

@renhwztetecs please could you add a unit test for this in test/libcephfs/test.cc.

@jcsp
Copy link
Contributor

jcsp commented Oct 17, 2016

This currently does not compile when merged to master, needs a rebase (change in definition of Client::fsetattr)

@renhwztetecs
Copy link
Contributor Author

renhwztetecs commented Oct 18, 2016

@jcsp I will add unit test for fsetattr
I triggered a compilation

Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
@renhwztetecs
Copy link
Contributor Author

@jcsp
I added the unit test for fsetattr, could you take a look?

uint64_t size = 8388608;
stx.stx_size = size;

ASSERT_EQ(ceph_fsetattr(cmount, fd, &stx, CEPH_SETATTR_SIZE), 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

You see to be passing a ceph_statx to a function that expects a struct stat?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for your reviews
I changed it

@renhwztetecs renhwztetecs force-pushed the renhw-wip-add-libcephfs branch 3 times, most recently from 36c98d6 to edcf29f Compare October 21, 2016 02:36
@renhwztetecs
Copy link
Contributor Author

@jcsp
thanks for your reviews
I changed it

@@ -1158,6 +1158,7 @@ TEST(LibCephFS, UseUnmounted) {
EXPECT_EQ(-ENOTCONN, ceph_lremovexattr(cmount, "/path", "name"));
EXPECT_EQ(-ENOTCONN, ceph_setxattr(cmount, "/path", "name", NULL, 0, 0));
EXPECT_EQ(-ENOTCONN, ceph_lsetxattr(cmount, "/path", "name", NULL, 0, 0));
EXPECT_EQ(-ENOTCONN, ceph_fsetattr(cmount, 0, &st, 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing closing ) here. Please do compile this test and check that it works before updating the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I omitted this step, the follow-up I will pay attention to this problem,
Thank you for reminding.

Signed-off-by: huanwen ren <ren.huanwen@zte.com.cn>
@jcsp jcsp merged commit e5c43e9 into ceph:master Oct 25, 2016
@jtlayton
Copy link
Contributor

Ahh, just came into this late. Yeah, I agree that lchmod/lutimes isn't really needed. We have a ceph_setattrx now, which can take an AT_SYMLINK_NOFOLLOW flag. That should allow setting any of those fields on the symlink itself.

@renhwztetecs
Copy link
Contributor Author

@jtlayton thanks
yeah, I have been removed ceph_lchmod&&ceph_lutime

@renhwztetecs renhwztetecs deleted the renhw-wip-add-libcephfs branch December 8, 2016 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cephfs Ceph File System feature
Projects
None yet
5 participants