-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
cephfs: support WORM(Write Once Read Many) feature #26691
Changes from all commits
ecbd280
476365b
24b3ca7
f89eed2
549c961
88ba110
fee71d0
f2a5842
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -332,6 +332,11 @@ constexpr unsigned long long operator"" _hr (unsigned long long hr) { | |
constexpr unsigned long long operator"" _day (unsigned long long day) { | ||
return day * 60 * 60 * 24; | ||
} | ||
|
||
constexpr unsigned long long operator"" _year (unsigned long long year) { | ||
return year * 60 * 60 * 24 * 365; | ||
} | ||
|
||
constexpr unsigned long long operator"" _K (unsigned long long n) { | ||
return n << 10; | ||
} | ||
|
@@ -8190,6 +8195,25 @@ std::vector<Option> get_mds_options() { | |
.set_default(2.0) | ||
.set_description("task status update interval to manager") | ||
.set_long_description("interval (in seconds) for sending mds task status to ceph manager"), | ||
|
||
Option("mds_worm_commit_period", Option::TYPE_UINT, Option::LEVEL_ADVANCED) | ||
.set_default(2_hr) | ||
.set_min_max(1_min, 30_day) | ||
.set_description("default auto commit period for worm feature"), | ||
|
||
Option("mds_worm_retention_period", Option::TYPE_UINT, Option::LEVEL_ADVANCED) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems these three options are all sharing the same default value. Did you do that deliberately? Also I've observed you silently changed the perm of all files you touched from 100644->100755, which I guess should definitely need to be addressed first.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These options had been redesigned, I think the modified file mode already restore to 100644, thanks! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might switch to the inline .set_min & .set_max helpers to perform the boundary checking, then There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed it,thanks |
||
.set_default(1_hr) | ||
.set_description("default retention period for worm feature,this value must between mds_worm_min_retention_period and mds_worm_max_retention_period"), | ||
|
||
Option("mds_worm_min_retention_period", Option::TYPE_UINT, Option::LEVEL_ADVANCED) | ||
.set_default(1_hr) | ||
.set_min_max(1_min, 30_year) | ||
.set_description("min retention period for worm feature"), | ||
|
||
Option("mds_worm_max_retention_period", Option::TYPE_UINT, Option::LEVEL_ADVANCED) | ||
.set_default(30_year) | ||
.set_min_max(1_hr, 70_year) | ||
.set_description("max retention period for worm feature"), | ||
}); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3826,7 +3826,7 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session, | |
* note: encoding matches MClientReply::InodeStat | ||
*/ | ||
if (session->info.has_feature(CEPHFS_FEATURE_REPLY_ENCODING)) { | ||
ENCODE_START(3, 1, bl); | ||
ENCODE_START(4, 1, bl); | ||
encode(oi->ino, bl); | ||
encode(snapid, bl); | ||
encode(oi->rdev, bl); | ||
|
@@ -3869,6 +3869,7 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session, | |
encode(any_i->change_attr, bl); | ||
encode(file_i->export_pin, bl); | ||
encode(snap_btime, bl); | ||
encode(policy_i->worm, bl); | ||
ENCODE_FINISH(bl); | ||
} | ||
else { | ||
|
@@ -3925,6 +3926,11 @@ int CInode::encode_inodestat(bufferlist& bl, Session *session, | |
encode(any_i->btime, bl); | ||
encode(any_i->change_attr, bl); | ||
} | ||
|
||
if (session->get_connection()->has_feature(CEPH_FEATURE_MDS_WORM)){ | ||
mempool_inode *policy_i = ppolicy ? pi : oi; | ||
encode(policy_i->worm, bl); | ||
} | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. needs to bump encoding version There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed it,thanks |
||
return valid; | ||
|
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.
I'm a little concerned with this. Suppose I accidentally set this on the wrong file. How do I fix it?
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.
I think may be only wait for file protection time expires 。any suggestion?
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.
I don't think waiting will be acceptable -- we will need to be able to fix this in some fashion, as we can't just throw away the filesystem and start over (as you would with a CD-R or something).
Maybe this could only be allowed from certain clients using a new cephfs client capability flag, and those clients would be able to undo this as well?
http://docs.ceph.com/docs/master/cephfs/client-auth/
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.
OK ! Already add a new cap flag "i" and "chattr -i"" to expired a file which is in retained state.