[PATCH] Add missing async fsync_send()/recv() code to ceph VFS.

David Disseldorp ddiss at samba.org
Mon Apr 30 09:12:58 UTC 2018


Hi Ralph and Jeremy,

On Sat, 28 Apr 2018 16:12:07 +0200, Ralph Böhme wrote:

> Hi Jeremy,
> 
> On Fri, Apr 27, 2018 at 04:07:43PM -0700, Jeremy Allison wrote:
> > Patch that implements fsync_send()/recv() by cheating
> > and using ceph_fsync() synchronously under the covers
> > attached.
...
> > +	PROFILE_TIMESTAMP(&start_time);
> > +
> > +	/* Make sync call. */
> > +	ret = ceph_fsync(handle->data, fsp->fh->fd, false);
> > +
> > +	if (ret != 0) {
> > +		/* ceph_fsync returns -errno on error. */
> > +		state->error = -ret;
> > +	}  
> 
> Shouldn't this be:
> 
>         if (tevent_req_error(req, ret)) {
>                 return tevent_req_post(req, ev);
>         }
> 
> ?

We still need to retain the errno negation, so that'd be
tevent_req_error(req, -ret)...
 
> > +
> > +	PROFILE_TIMESTAMP(&end_time);
> > +	state->duration = nsec_time_diff(&end_time, &start_time);
> > +
> > +	/* Mark it as done. */
> > +	tevent_req_done(req);
> > +	/* Return and schedule the completion of the call. */
> > +	return tevent_req_post(req, ev);
> > +}
> > +
> > +static int cephwrap_fsync_recv(struct tevent_req *req,
> > +				struct vfs_aio_state *vfs_aio_state)
> > +{
> > +	struct vfs_aio_state *state =
> > +		tevent_req_data(req, struct vfs_aio_state);
> > +
> > +	DBG_DEBUG("[CEPH] cephwrap_fsync_recv\n");
> > +
> > +	*vfs_aio_state = *state;
> > +	if (state->error != 0) {
> > +		return -1;
> > +	}  
> 
> Then this should be:
> 
>         if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
>                 return -1;

This would mean that we don't propagate up the call duration on failure.
I'm not so familiar with the async VFS API, but is that to be expected?

Cheers, David



More information about the samba-technical mailing list