NFSv4.1: Fix bulk recall and destroy of layouts
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Tue, 12 Feb 2013 14:48:42 +0000 (09:48 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 28 Feb 2013 13:38:32 +0000 (05:38 -0800)
commit345387f517d74bbb83cb1a1158f06a488b452547
tree5fa54de253e11ea7b33531d5adf008ba01795f22
parente6a6e38b72bae7e2db7e47fa5cdc15a3f2b5cc15
NFSv4.1: Fix bulk recall and destroy of layouts

commit fd9a8d7160937f94aad36ac80d7255b4988740ac upstream.

The current code in pnfs_destroy_all_layouts() assumes that removing
the layout from the server->layouts list is sufficient to make it
invisible to other processes. This ignores the fact that most
users access the layout through the nfs_inode->layout...
There is further breakage due to lack of reference counting of the
layouts, meaning that the whole thing Oopses at the drop of a hat.

The code in initiate_bulk_draining() is almost correct, and can be
used as a model for pnfs_destroy_all_layouts(), so move that
code to pnfs.c, and refactor the code to allow us to choose between
a single filesystem bulk recall, and a recall of all layouts.
Also note that initiate_bulk_draining() currently calls iput() while
holding locks. Fix that too.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/callback_proc.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h