ceph: request Fw caps before updating the mtime in ceph_write_iter
authorJeff Layton <jlayton@kernel.org>
Wed, 11 Aug 2021 10:40:42 +0000 (06:40 -0400)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 2 Sep 2021 20:49:17 +0000 (22:49 +0200)
commitb11ed50346683a749632ea664959b28d524d7395
treeea5ce54f5c3932522c67b3316c76646e26cf7c49
parentd517b3983dd3106ca92d6c5d0d09415a4a09481c
ceph: request Fw caps before updating the mtime in ceph_write_iter

The current code will update the mtime and then try to get caps to
handle the write. If we end up having to request caps from the MDS, then
the mtime in the cap grant will clobber the updated mtime and it'll be
lost.

This is most noticable when two clients are alternately writing to the
same file. Fw caps are continually being granted and revoked, and the
mtime ends up stuck because the updated mtimes are always being
overwritten with the old one.

Fix this by changing the order of operations in ceph_write_iter to get
the caps before updating the times. Also, make sure we check the pool
full conditions before even getting any caps or uninlining.

URL: https://tracker.ceph.com/issues/46574
Reported-by: Jozef Kováč <kovac@firma.zoznam.sk>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Xiubo Li <xiubli@redhat.com>
Reviewed-by: Luis Henriques <lhenriques@suse.de>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/file.c