Re: [PATCH v4 2/2] nbd: fix possible page fault for nbd disk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 17, 2019 at 02:44:09PM -0500, Mike Christie wrote:
> On 09/17/2019 01:40 PM, Josef Bacik wrote:
> >>> +		nbd->destroy_complete = &destroy_complete;
> >>
> >> Also, without the mutex part of the v3 patch, we could race and
> >> nbd_dev_remove could have passed the destroy_complete check already, so
> >> below we will wait forever.
> >>
> > 
> > Oh hmm you're right,
> 
> I think I am actually wrong about that part too now :) I had forgot
> about the idr removal under the mutex when making my original comment.
> 
> If nbd_put grabs the mutex first then it will do idr_remove under the
> mutex. If nbd_genl_connect then runs, idr_find/idr_for_each will fail
> and we will allocate a new nbd device and NBD_DISCONNECT_REQUESTED will
> not be set.
> 
> If nbd_genl_connect grabs the mutex first, then idr_find/idr_for_each
> will succeed and we will set the completion. nbd_put will then grab the
> mutex and call nbd_remove_dev and see the completion.

Lol we're all wrong.  I had it in my head that complete() just did a set_bit()
so wait_on_completion() would not wait, but it does the x->done++/x->done--
thing, so cool we're good here.  Thanks,

Josef



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux