RGWFileHandle::FLAG_BUCKET);
if (get<0>(fhr)) {
RGWFileHandle* rgw_fh = get<0>(fhr);
- rgw_fh->set_times(req.get_ctime());
+ /* restore attributes */
+ auto ux_attrs = req.get_attr(RGW_ATTR_UNIX1);
+ if (ux_attrs) {
+ rgw_fh->decode_attrs(ux_attrs);
+ }
}
}
return fhr;
(rc2 == 0))) {
/* op failed */
rgw_fh->flags |= RGWFileHandle::FLAG_DELETED;
- rgw_fh->mtx.unlock();
+ rgw_fh->mtx.unlock(); /* !LOCKED */
unref(rgw_fh);
get<0>(mkr) = nullptr;
/* fixup rc */
if (!rc)
rc = rc2;
+ } else {
+ rgw_fh->mtx.unlock(); /* !LOCKED */
}
- rgw_fh->mtx.unlock(); /* !LOCKED */
get<1>(mkr) = rc;
return mkr;
void encode(buffer::list& bl) const {
ENCODE_START(1, 1, bl);
+ ::encode(uint32_t(fh.fh_type), bl);
::encode(fh.fh_hk.bucket, bl);
::encode(fh.fh_hk.object, bl);
::encode(state.dev, bl);
void decode(bufferlist::iterator& bl) {
DECODE_START(1, bl);
struct rgw_file_handle tfh;
+ uint32_t fh_type;
+ ::decode(fh_type, bl);
+ tfh.fh_type = static_cast<enum rgw_fh_type>(fh_type);
::decode(tfh.fh_hk.bucket, bl);
::decode(tfh.fh_hk.object, bl);
assert(fh.fh_hk == tfh.fh_hk);
::decode(state.owner_gid, bl);
::decode(state.unix_mode, bl);
ceph::real_time enc_time;
- for (auto& t : { state.ctime, state.mtime, state.atime }) {
+ for (auto t : { &(state.ctime), &(state.mtime), &(state.atime) }) {
::decode(enc_time, bl);
- const_cast<struct timespec&>(t) = real_clock::to_timespec(enc_time);
+ *t = real_clock::to_timespec(enc_time);
}
DECODE_FINISH(bl);
}
{
public:
std::string uri;
+ std::map<std::string, buffer::list> attrs;
RGWStatBucketRequest(CephContext* _cct, RGWUserInfo *_user,
const std::string& _path)
op = this;
}
+ buffer::list* get_attr(const std::string& k) {
+ auto iter = attrs.find(k);
+ return (iter != attrs.end()) ? &(iter->second) : nullptr;
+ }
+
virtual bool only_bucket() { return false; }
virtual int op_init() {
virtual void send_response() {
bucket.creation_time = get_state()->bucket_info.creation_time;
+ std::swap(attrs, get_state()->bucket_attrs);
}
bool matched() {