RGWFileHandle::FLAG_BUCKET);
if (get<0>(fhr)) {
RGWFileHandle* rgw_fh = get<0>(fhr);
+ lock_guard guard(rgw_fh->mtx);
rgw_fh->set_times(req.get_ctime());
/* restore attributes */
auto ux_key = req.get_attr(RGW_ATTR_UNIX_KEY1);
fhr = lookup_fh(parent, path, RGWFileHandle::FLAG_CREATE);
if (get<0>(fhr)) {
RGWFileHandle* rgw_fh = get<0>(fhr);
+ lock_guard guard(rgw_fh->mtx);
rgw_fh->set_size(req.get_size());
rgw_fh->set_times(req.get_mtime());
/* restore attributes */
fhr = lookup_fh(parent, path, RGWFileHandle::FLAG_DIRECTORY);
if (get<0>(fhr)) {
RGWFileHandle* rgw_fh = get<0>(fhr);
+ lock_guard guard(rgw_fh->mtx);
rgw_fh->set_size(req.get_size());
rgw_fh->set_times(req.get_mtime());
/* restore attributes */
if (get<0>(fhr)) {
/* for now use the parent object's mtime */
RGWFileHandle* rgw_fh = get<0>(fhr);
+ lock_guard guard(rgw_fh->mtx);
rgw_fh->set_mtime(parent->get_mtime());
}
}
int rc = rgwlib.get_fe()->execute_req(&req);
if ((rc == 0) &&
(req.get_ret() == 0)) {
+ lock_guard(rgw_fh->mtx);
rgw_fh->set_atime(real_clock::to_timespec(real_clock::now()));
*bytes_read = req.nread;
}
if ((rc == 0) &&
(rc2 == 0)) {
/* XXX atomicity */
- LookupFHResult fhr = lookup_fh(parent, name, RGWFileHandle::FLAG_CREATE);
+ LookupFHResult fhr = lookup_fh(parent, name, RGWFileHandle::FLAG_CREATE |
+ RGWFileHandle::FLAG_LOCK);
RGWFileHandle* rgw_fh = get<0>(fhr);
if (rgw_fh) {
if (get<1>(fhr) & RGWFileHandle::FLAG_CREATE) {
real_time t = real_clock::now();
rgw_fh->create_stat(st, mask);
rgw_fh->set_times(t);
- rgw_fh->open_for_create(); // XXX needed?
parent->set_mtime(real_clock::to_timespec(t));
parent->set_ctime(real_clock::to_timespec(t));
if (st)
(void) rgw_fh->stat(st);
get<0>(mkr) = rgw_fh;
+ rgw_fh->mtx.unlock();
} else
rc = -EIO;
}
int rc, rc2;
buffer::list ux_key, ux_attrs;
+ lock_guard guard(rgw_fh->mtx);
+
switch(rgw_fh->fh.fh_type) {
case RGW_FS_TYPE_FILE:
{