On 11/23/19 3:49 PM, Pavel Begunkov wrote: > There is a bug hunging my system when run fixed-link with /dev/urandom > instead of /dev/zero (see patch 1/2). > > As for me, the easiest way to fix is to grab mm and use userspace > address for this specific case (as it's done in patches). The other > way is to kmap/vmap, but the first should be short-lived and the > second needs mm anyway. > > Ideas how to do it better way? Suggestions and corrections are welcome. OK, took a quick look. kmap() etc doesn't need context, but the copy does. How about just ensuring we grab the mm for cases that don't have ->read_iter() or ->write_iter() and then just map and copy in that loop that handles that exact case? I think that's cleaner than what you have. -- Jens Axboe