[Devel] [PATCH] fuse kio: Add comment about why we need to wait pending read requests

Kirill Tkhai ktkhai at virtuozzo.com
Tue Oct 23 16:55:52 MSK 2018


On 23.10.2018 13:15, Pavel Butsykin wrote:
> 
> 
> On 23.10.2018 13:01, Kirill Tkhai wrote:
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
>> ---
>>   fs/fuse/kio/pcs/pcs_fuse_kdirect.c |    7 ++++++-
>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
>> index 3940d6c255ba..9b45fcbf8941 100644
>> --- a/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
>> +++ b/fs/fuse/kio/pcs/pcs_fuse_kdirect.c
>> @@ -1081,7 +1081,12 @@ static void pcs_kio_setattr_handle(struct fuse_inode *fi, struct fuse_req *req)
>>   	r->end = req->end;
>>   	if (di->size.op == PCS_SIZE_SHRINK) {
>>   		BUG_ON(!mutex_is_locked(&req->io_inode->i_mutex));
>> -		/* wait for aio reads in flight */
>> +		/*
>> +		 * Wait for already submitted aio reads. Further reads
>> +		 * (including already queued to bg_queue) will be stopped
>> +		 * by wait_shrink(), and they will be processed from
>> +		 * _pcs_shrink_end().
>> +		 */
> 
> Why do we have to wait already submitted aio reads ?

Also, see here:

[cpu0]                                                       [cpu1]
fuse_size_grow_work()
  ...
  spin_lock(&di->lock)
  di->size.op = PCS_SIZE_INACTION;
  spin_unlock(&di->lock)
  ...                                                        pcs_kio_setattr_handle()
                                                               inode_dio_wait() started
                                                               |
                                                               |
  pcs_cc_requeue(di->cluster, &pending_reqs)                   |
  ...                                                          |
    request_end()                                              v
                                                               inode_dio_wait() finished
                                                             proceed FATTR_SIZE shrink




More information about the Devel mailing list