return -CEPHFS_ENOTCONN;
}
+ /* We can't return bytes written larger than INT_MAX, clamp len to that */
+ len = std::min(len, (loff_t)INT_MAX);
+
+ std::scoped_lock lock(client_lock);
if (fh == NULL || !_ll_fh_exists(fh)) {
ldout(cct, 3) << "(fh)" << fh << " is invalid" << dendl;
return -CEPHFS_EBADF;
tout(cct) << off << std::endl;
tout(cct) << len << std::endl;
- /* We can't return bytes written larger than INT_MAX, clamp len to that */
- len = std::min(len, (loff_t)INT_MAX);
- std::scoped_lock lock(client_lock);
-
int r = _read(fh, off, len, bl);
ldout(cct, 3) << "ll_read " << fh << " " << off << "~" << len << " = " << r
<< dendl;
return -CEPHFS_ENOTCONN;
}
+ /* We can't return bytes written larger than INT_MAX, clamp len to that */
+ len = std::min(len, (loff_t)INT_MAX);
+
+ std::scoped_lock lock(client_lock);
if (fh == NULL || !_ll_fh_exists(fh)) {
ldout(cct, 3) << "(fh)" << fh << " is invalid" << dendl;
return -CEPHFS_EBADF;
tout(cct) << off << std::endl;
tout(cct) << len << std::endl;
- /* We can't return bytes written larger than INT_MAX, clamp len to that */
- len = std::min(len, (loff_t)INT_MAX);
- std::scoped_lock lock(client_lock);
-
int r = _write(fh, off, len, data, NULL, 0);
ldout(cct, 3) << "ll_write " << fh << " " << off << "~" << len << " = " << r
<< dendl;
return -CEPHFS_ENOTCONN;
}
+ std::scoped_lock cl(client_lock);
if (fh == NULL || !_ll_fh_exists(fh)) {
ldout(cct, 3) << "(fh)" << fh << " is invalid" << dendl;
return -CEPHFS_EBADF;
}
-
- std::scoped_lock cl(client_lock);
return _preadv_pwritev_locked(fh, iov, iovcnt, off, true, false);
}
return -CEPHFS_ENOTCONN;
}
+ std::scoped_lock cl(client_lock);
if (fh == NULL || !_ll_fh_exists(fh)) {
ldout(cct, 3) << "(fh)" << fh << " is invalid" << dendl;
return -CEPHFS_EBADF;
}
-
- std::scoped_lock cl(client_lock);
return _preadv_pwritev_locked(fh, iov, iovcnt, off, false, false);
}
return retval;
}
+ retval = 0;
+ std::unique_lock cl(client_lock);
+
if(fh == NULL || !_ll_fh_exists(fh)) {
ldout(cct, 3) << "(fh)" << fh << " is invalid" << dendl;
retval = -CEPHFS_EBADF;
+ }
+
+ if (retval != 0) {
if (onfinish != nullptr) {
+ cl.unlock();
onfinish->complete(retval);
+ cl.lock();
retval = 0;
}
return retval;
}
- std::scoped_lock cl(client_lock);
-
retval = _preadv_pwritev_locked(fh, iov, iovcnt, offset, write, true,
onfinish, bl, do_fsync, syncdataonly);
/* There are two scenarios with each having two cases to handle here
if (retval < 0) {
if (onfinish != nullptr) {
//async io failed
- client_lock.unlock();
+ cl.unlock();
onfinish->complete(retval);
- client_lock.lock();
+ cl.lock();
/* async call should always return zero to caller and allow the
caller to wait on callback for the actual errno/retval. */
retval = 0;