On Tue, Apr 14, 2020 at 08:58:52PM +0000, Luis Chamberlain wrote: > > I think this needs a WARN_ON thrown in to enforece the calling context. > > I considered adding a might_sleep() but upon review with Bart, he noted > that this function already has a mutex_lock(), and if you look under the > hood of mutex_lock(), it has a might_sleep() at the very top. The > warning then is implicit. It might just be a personal preference, but I think the documentation value of a WARN_ON_ONCE or might_sleep with a comment at the top of the function is much higher than a blurb in a long kerneldoc text and a later mutex_lock.