Merge tag 'ceph-for-6.3-rc1' of https://github.com/ceph/ceph-client
[linux-2.6-block.git] / fs / ceph / file.c
index 5dcc62e678c480acac3dd467aab1dd55bfad18b1..f4d8bf7dec88a8eddeffbb0de171514566c6fa21 100644 (file)
@@ -2098,6 +2098,9 @@ static long ceph_fallocate(struct file *file, int mode,
        loff_t endoff = 0;
        loff_t size;
 
+       dout("%s %p %llx.%llx mode %x, offset %llu length %llu\n", __func__,
+            inode, ceph_vinop(inode), mode, offset, length);
+
        if (mode != (FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE))
                return -EOPNOTSUPP;
 
@@ -2132,6 +2135,10 @@ static long ceph_fallocate(struct file *file, int mode,
        if (ret < 0)
                goto unlock;
 
+       ret = file_modified(file);
+       if (ret)
+               goto put_caps;
+
        filemap_invalidate_lock(inode->i_mapping);
        ceph_fscache_invalidate(inode, false);
        ceph_zero_pagecache_range(inode, offset, length);
@@ -2147,6 +2154,7 @@ static long ceph_fallocate(struct file *file, int mode,
        }
        filemap_invalidate_unlock(inode->i_mapping);
 
+put_caps:
        ceph_put_cap_refs(ci, got);
 unlock:
        inode_unlock(inode);