<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hi,<br></div>this is my first post here, so feel free to redirect me if I'm trespassing in some way.<br><br></div>I'm trying to build a custom dm target to be used as filter for normal filesystem operations.<br><br></div>I managed to build a working prototype, but field-testing it I found that, in certain conditions (e.g.: untarring a large tar full of many small files) the number of in-flight requests rapidly rises to several thousands.<br><br></div>This is a problem since I allocate some pages for each remapping (I essentially double the allocation for the time request is fully handled by underlying device); this leads to memory starvation and, possibly, even to kernel panics.<br><br></div>I tried limiting the number/size of in-flight requests by returning DM_MAPIO_REQUEUE when resource consumption exceeded a certain threshold; This doesn't seem to work because the error is not trapped at dm-stage, but it is reported directly to filesystem and, from there, to application (tar or mkfs.ext4).<br><br></div>What is the correct way to tell dm to stop sending more requests, for a short while (i.e.: till some old requests are completed)?<br><br></div>Note: I'm using kernel v4.4.9 so I don't have DM_MAPIO_DELAY_REQUEUE<br><br></div>Note2: in my target.map I re-allocate the scatterlist, save the original one and substitute; I do the reverse in .end_io.<br><br></div>Thanks in advance<br></div>Mauro<br></div>