[PATCH] Fix might_sleep in /proc/swaps code
commitc6845c0ca139cf5b27855481b1cb7179b990296d
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>
Thu, 29 Apr 2004 00:15:20 +0000 (28 17:15 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 29 Apr 2004 00:15:20 +0000 (28 17:15 -0700)
treeb71d1cd2c2e4dad70511cdfc441a5f6349713e80
parentae08d237f10fab2abdd315362571b02862789f7b
[PATCH] Fix might_sleep in /proc/swaps code

This fixes a locking problem noted by Tim Hockin:
    * /proc/swaps uses seq_file code, calling seq_path() with swaplock held
    * seq_path() calls d_path()
    * d_path() calls mntput() which might_sleep()

We add a new semaphore protecting insertions/removals in the set of swap
components + switch of ->start()/->stop() to the same semaphore [fixes
deadlocks] + trivial cleanup of ->next().
mm/swapfile.c