-
Notifications
You must be signed in to change notification settings - Fork 526
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
curvefs: implement setxattr interface. #1935
Conversation
curvefs/src/client/curve_fuse_op.cpp
Outdated
std::string xattrValue(value, size); | ||
VLOG(9) << "FuseOpSetXattr" | ||
<< " ino " << ino << " name " << name << " value " << xattrValue | ||
<< " flags " << flags; | ||
int code = ENOTSUP; | ||
int code = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code only use in if, move it in the if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
|
||
CURVEFS_ERROR ret = CURVEFS_ERROR::NODATA; | ||
ret = CURVEFS_ERROR::NODATA; | ||
if (xValue.length() > 0) { | ||
if ((size == 0 && xValue.length() <= MAXXATTRLENGTH) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does size == 0 mean?
size == 0是什么意思,这时候不会出错吗?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/**
- Get an extended attribute
- If size is zero, the size of the value should be sent with
- fuse_reply_xattr.
- If the size is non-zero, and the value fits in the buffer, the
- value should be sent with fuse_reply_buf.
- If the size is too small for the value, the ERANGE error should
- be sent.
size ==0 means you should return value's length by fuse_reply_xattr, and this flag used to get the value's length first by kernel and the real size will be set in the next request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if size > MAXXATTRLENGTH && xValue.length() <= MAXXATTRLENGTH
it will return out of range?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
f401834
to
7ffbdfc
Compare
CURVEFS_ERROR FuseClient::FuseOpSetXattr(fuse_req_t req, fuse_ino_t ino, | ||
const char* name, const char* value, | ||
size_t size, int flags) { | ||
if (option_.disableXattr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VLOG(1) << "FuseOpSetXattr " << ****;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
curvefs/src/client/fuse_client.cpp
Outdated
} else { | ||
ret = xattrManager_->CalAllLayerSumInfo(&inodeAttr); | ||
} | ||
// get summary info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following conditions are different, please describe the function of this code as a whole.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
::curve::common::UniqueLock lgGuard = inodeWrapper->GetUniqueLock(); | ||
inodeWrapper->SetXattrLocked(strname, strvalue); | ||
ret = inodeWrapper->SyncAttr(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need to do sync every time here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The xattr will lost when cache crashed If not update the xattr to metaserver
recheck |
curvefs/src/client/fuse_client.cpp
Outdated
// otherwise only recursive computation all dirs. | ||
if (!enableSumInDir_) { | ||
if (IsOneLayer(name)) { | ||
ret = xattrManager_->CalOneLayerSumInfo(&inodeAttr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe enableSumInDir_ is more suitable as a member of xattrManager_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
LOG(ERROR) << "set xattr fail, ret = " << ret << ", inodeid = " << ino | ||
<< ", name = " << strname << ", value = " << strvalue; | ||
return ret; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
VLOG(1) << "FuseOpSetXattr end" << ****
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
37da493
to
66c7e38
Compare
Signed-off-by: wanghai01 <[email protected]>
Signed-off-by: wanghai01 [email protected]
What problem does this PR solve?
Issue Number: #xxx
Problem Summary:
What is changed and how it works?
What's Changed:
How it Works:
Side effects(Breaking backward compatibility? Performance regression?):
Check List