[dm-devel] [PATCH 0/3] dm: replace atomic_t reference counters with refcount_t

2018-08-23 Thread John Pittman
This series of patches further integrates the refcount_t API into the device-mapper layer. The refcount_t API works to prevent counter overflows and use-after-free bugs, so should make the mechanism more robust, and make troubleshooting easier. Adding here to dm-thin and dm-zoned. Refcounters

[dm-devel] [PATCH 2/3] dm zoned: metadata: use refcount_t for dm zoned reference counters

2018-08-23 Thread John Pittman
The API surrounding refcount_t should be used in place of atomic_t when variables are being used as reference counters. This API can prevent issues such as counter overflows and use-after-free conditions. Within the dm zoned metadata stack, the atomic_t API is used for mblk->ref and

[dm-devel] [PATCH 3/3] dm zoned: target: use refcount_t for dm zoned reference counters

2018-08-23 Thread John Pittman
The API surrounding refcount_t should be used in place of atomic_t when variables are being used as reference counters. This API can prevent issues such as counter overflows and use-after-free conditions. Within the dm zoned target stack, the atomic_t API is used for bioctx->ref and

[dm-devel] [PATCH 1/3] dm thin: use refcount_t for thin_c reference counting

2018-08-23 Thread John Pittman
The API surrounding refcount_t should be used in place of atomic_t when variables are being used as reference counters. It can potentially prevent reference counter overflows and use-after-free conditions. In the dm thin layer, one such example is tc->refcount. Change this from the atomic_t API

Re: [dm-devel] Deadlock when using crypto API for block devices

2018-08-23 Thread Herbert Xu
On Thu, Aug 23, 2018 at 04:39:23PM -0400, Mikulas Patocka wrote: > > 1. don't set CRYPTO_TFM_REQ_MAY_SLEEP in dm-crypt > = > If we don't set it, dm-crypt will use GFP_ATOMIC and GFP_ATOMIC may fail. > The function init_crypt in xts.c handles the

[dm-devel] Deadlock when using crypto API for block devices

2018-08-23 Thread Mikulas Patocka
Hi There's a deadlock reported here: https://bugzilla.kernel.org/show_bug.cgi?id=200835 * dm-crypt calls crypt_convert in xts mode * init_crypt from xts.c calls kmalloc(GFP_KERNEL) * kmalloc(GFP_KERNEL) recurses into the XFS filesystem, the filesystem tries to submit some bios and wait

Re: [dm-devel] [PATCH 2/3] dm zoned: metadata: use refcount_t for dm zoned reference counters

2018-08-23 Thread John Pittman
Sounds good Damien. Thanks for reviewing! On Thu, Aug 23, 2018 at 6:12 PM, Damien Le Moal wrote: > John, > > On 2018/08/23 10:37, John Pittman wrote: >> The API surrounding refcount_t should be used in place of atomic_t >> when variables are being used as reference counters. This API can >>

Re: [dm-devel] [PATCH 2/3] dm zoned: metadata: use refcount_t for dm zoned reference counters

2018-08-23 Thread Damien Le Moal
John, On 2018/08/23 10:37, John Pittman wrote: > The API surrounding refcount_t should be used in place of atomic_t > when variables are being used as reference counters. This API can > prevent issues such as counter overflows and use-after-free > conditions. Within the dm zoned metadata stack,

Re: [dm-devel] [PATCH 3/3] dm zoned: target: use refcount_t for dm zoned reference counters

2018-08-23 Thread Damien Le Moal
John, On 2018/08/23 10:37, John Pittman wrote: > The API surrounding refcount_t should be used in place of atomic_t > when variables are being used as reference counters. This API can > prevent issues such as counter overflows and use-after-free > conditions. Within the dm zoned target stack,