ceph: request new max size only when there is auth cap
authorYan, Zheng <zyan@redhat.com>
Tue, 10 Mar 2020 11:34:19 +0000 (19:34 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 30 Mar 2020 10:42:43 +0000 (12:42 +0200)
When there is no auth cap, check_max_size() can't do anything and may
cause an infinite loop inside ceph_get_caps().

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/caps.c

index 78a3050..086bb3a 100644 (file)
@@ -2582,7 +2582,7 @@ again:
                        dout("get_cap_refs %p endoff %llu > maxsize %llu\n",
                             inode, endoff, ci->i_max_size);
                        if (endoff > ci->i_requested_max_size)
-                               ret = -EFBIG;
+                               ret = ci->i_auth_cap ? -EFBIG : -ESTALE;
                        goto out_unlock;
                }
                /*