]> git.karo-electronics.de Git - karo-tx-linux.git/commit
fuse: writepages: crop secondary requests
authorMaxim Patlasov <MPatlasov@parallels.com>
Wed, 2 Oct 2013 17:38:32 +0000 (21:38 +0400)
committerMiklos Szeredi <mszeredi@suse.cz>
Fri, 4 Oct 2013 08:50:13 +0000 (10:50 +0200)
commit4cf7c02ed86bb850c5c1f30f42d52449c5c726bc
tree89416e69b3f4c218203a04eb7ca192be4cf5f355
parent7047a8af8ecac2619162f84d504c9ee39683f124
fuse: writepages: crop secondary requests

If writeback happens while fuse is in FUSE_NOWRITE condition, the request
will be queued but not processed immediately (see fuse_flush_writepages()).
Until FUSE_NOWRITE becomes relaxed, more writebacks can happen.  They will
be queued as "secondary" requests to that first ("primary") request.

Existing implementation crops only primary request.  This is not correct
because a subsequent extending write(2) may increase i_size and then
secondary requests won't be cropped properly.  The result would be stale
data written to the server to a file offset where zeros must be.

Similar problem may happen if secondary requests are attached to an
in-flight request that was already cropped.

The patch solves the issue by cropping all secondary requests in
fuse_writepage_end().  Thanks to Miklos for idea.

Signed-off-by: Maxim Patlasov <MPatlasov@parallels.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
fs/fuse/file.c