[PATCH] fuse: fix hang on SMP
commit6c7e1a3d3d1b85ebbec3c33fc9c728ad3be4846f
authorMiklos Szeredi <miklos@szeredi.hu>
Wed, 18 Oct 2006 09:08:30 +0000 (18 11:08 +0200)
committerChris Wright <chrisw@sous-sol.org>
Sat, 4 Nov 2006 01:33:47 +0000 (3 17:33 -0800)
treebe884da9cfaeda155131d88bf83a46bb54089f12
parentebd9eb32ff883be3401baa7b231749930f3306cc
[PATCH] fuse: fix hang on SMP

Fuse didn't always call i_size_write() with i_mutex held which caused
rare hangs on SMP/32bit.  This bug has been present since fuse-2.2,
well before being merged into mainline.

The simplest solution is to protect i_size_write() with the
per-connection spinlock.  Using i_mutex for this purpose would require
some restructuring of the code and I'm not even sure it's always safe
to acquire i_mutex in all places i_size needs to be set.

Since most of vmtruncate is already duplicated for other reasons,
duplicate the remaining part as well, making all i_size_write() calls
internal to fuse.

Using i_size_write() was unnecessary in fuse_init_inode(), since this
function is only called on a newly created locked inode.

Reported by a few people over the years, but special thanks to Dana
Henriksen who was persistent enough in helping me debug it.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
fs/fuse/dir.c
fs/fuse/file.c
fs/fuse/inode.c